@program #1192 1 1000 d i lvar target lvar count lvar j $include $lib/rp $include $lib/alynna $include $muf/rp/utils $def RPSYSTEM "$RPSYSTEM" match $def TCOST me @ " " target @ talentcost $def SCOST me @ target @ dup "/" instr 0 > if subskillcost else skillcost then $def INMYTIER me @ "class" getstatstr RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr stringcmp not $define TTPENALTY INMYTIER not if me @ "class" getstatstr "mage" stringcmp not if $enddef ( $def SCOST me @ target @ skillcost ) lvar temp lvar target2 lvar repeat lvar them : headface ( s -- ) target2 ! 0 repeat ! rpsystem "Jobs/" target2 @ strcat "/Skills" strcat getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi me @ rot rot 3 pick 3 pick getstatint + setstat temp @ 1 + temp ! temp @ repeat @ = until rpsystem "Jobs/" target @ strcat "/Special" strcat getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi me @ rot rot 3 pick 3 pick getstatint + setstat temp @ 1 + temp ! temp @ repeat @ = until ; : tails ( s -- ) target2 ! 0 repeat ! rpsystem "Jobs/" target2 @ strcat "/Skills" strcat getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi them @ rot rot 3 pick 3 pick getstatint + setstat temp @ 1 + temp ! temp @ repeat @ = until rpsystem "Jobs/" target @ strcat "/Special" strcat getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi them @ rot rot 3 pick 3 pick getstatint + setstat temp @ 1 + temp ! temp @ repeat @ = until ; : tails2 ( s -- ) target2 ! 0 repeat ! rpsystem "Jobs/" target2 @ strcat "/Skills" strcat getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi them @ rot rot 3 pick 3 pick getstatint swap - setstat temp @ 1 + temp ! temp @ repeat @ = until rpsystem "Jobs/" target @ strcat "/Special" strcat getpropstr dup not if pop exit then ":" explode repeat ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi them @ rot rot 3 pick 3 pick getstatint swap - setstat temp @ 1 + temp ! temp @ repeat @ = until ; : treehugger ( -- f ) 1.0 ; lvar tiercost : addtier me @ mlevel 4 >= if them @ "class" getstatstr "0" stringcmp not if ( Any class set? ) them @ "professionlist" getstatstr dup "," instr 0 > if dup "," instring 1 - strcut pop then them @ swap "class" swap setstat then ( Does it exist? ) RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr if str "[XP-Spend] " them @ ": " them @ "class" getstatstr "(" them @ "jobs/" them @ "class" getstatstr strcat getstatint ")->" target @ "(" them @ "jobs/" them @ "class" getstatstr strcat getstatint 1 + ") ... Cost: NIL" cat tellme them @ "jobs/" RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr strcat getstatint 1 + dup 5 > if pop 5 then them @ swap "jobs/" RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr strcat swap setstat them @ "professionlist" getstat ", " target @ strcat strcat them @ swap "professionlist" swap setstat target @ tails RPSYSTEM str "/jobs/" target @ "/bonus" cat getpropstr if them @ "bonus#" getstatint 1 + dup them @ swap "bonus#" swap setstat them @ swap "bonus#/" swap tostr strcat RPSYSTEM str "/jobs/" target @ "/bonus" cat getpropstr setstat then else "[XP-Spend] Try a tier that actually exists." tellme then else "[XP-Spend] Yer not staff." tellme then ; : cgaddtier ( d s -- ) var cost target ! them ! them @ "class" getstatstr "0" stringcmp not if ( Any class set? ) them @ "professionlist" getstatstr dup "," instr 0 > if dup "," instring 1 - strcut pop then them @ swap "class" swap setstat then ( Does it exist? ) RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr if 0 cost ! target @ "other" smatch if 25 cost ! then target @ "lutrai" smatch if -20 cost ! then str "[XP-Spend] " them @ ": " them @ "class" getstatstr "(" them @ "jobs/" them @ "class" getstatstr strcat getstatint ")->" target @ "(" them @ "jobs/" them @ "class" getstatstr strcat getstatint 1 + ") ... Cost: " cost @ cat tellme them @ "xpspent" over over getstatfloat cost @ + setstat them @ "jobs/" RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr strcat getstatint 1 + dup 5 > if pop 5 then them @ swap "jobs/" RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr strcat swap setstat target @ them @ swap "professionlist" swap setstat target @ tails RPSYSTEM str "/jobs/" target @ "/bonus" cat getpropstr if them @ "bonus#" getstatint 1 + dup them @ swap "bonus#" swap setstat them @ swap "bonus#/" swap tostr strcat RPSYSTEM str "/jobs/" target @ "/bonus" cat getpropstr setstat then else "[XP-Spend] Try a tier that actually exists." tellme then ; PUBLIC cgaddtier : deltier me @ mlevel 4 >= if them @ "class" getstatstr "0" stringcmp not if ( Any class set? ) them @ "professionlist" getstatstr dup "," instr 0 > if dup "," instring 1 - strcut pop then them @ swap "class" swap setstat then ( Does it exist? ) RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr if str "[XP-Spend] " them @ ": " them @ "class" getstatstr "(" them @ "jobs/" them @ "class" getstatstr strcat getstatint ")->" target @ "(" them @ "jobs/" them @ "class" getstatstr strcat getstatint 1 - ") ... Cost: NIL" cat tellme them @ "jobs/" RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr strcat getstatint 1 - dup 5 > if pop 5 then them @ swap "jobs/" RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr strcat swap setstat them @ "professionlist" getstat ", " target @ strcat strcat them @ swap "professionlist" swap pop pop target @ tails2 RPSYSTEM str "/jobs/" target @ "/bonus" cat getpropstr if them @ "bonus#" getstatint 1 + dup them @ swap "bonus#" swap pop pop them @ swap "bonus#/" swap tostr strcat RPSYSTEM str "/jobs/" target @ "/bonus" cat getpropstr pop pop then else "[XP-Spend] Try a tier that actually exists." tellme then else "[XP-Spend] Yer not staff." tellme then ; : buytier me @ "class" getstatstr "0" stringcmp not if ( Any class set? ) me @ "professionlist" getstatstr dup "," instr 0 > if dup "," instring 1 - strcut pop then me @ swap "class" swap setstat then ( Does it exist? ) RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr if RPSYSTEM str "/jobs/" target @ "/tier" cat getpropstr toint me @ "jobs/" RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr strcat getstatint - 1 = not if 0 pop then ( Do I meet the requirements baby? ) me @ target @ RPUtils.jobAllowed? if ( Is it within two tiers? ) ( INMYTIER not if RPSYSTEM str "/jobs/" target @ "/tier" cat getpropstr toint me @ "jobs/" me @ "class" getstatstr strcat getstatint 2 / swap >= if str "[XP-Spend] " me @ ": " target @ "(" me @ "jobs/" me @ "class" getstatstr strcat getstatint 1 + ") cannot enter tier, Insufficient level in primary profession [" me @ "class" getstatstr "]" cat tellme then then ) ( Find out how much it costs ) RPSYSTEM str "/jobs/" target @ "/tier" cat getpropstr toint dup 1 = if 50 else 1 - 10 then * INMYTIER not if treehugger * then tiercost ! ( Can I afford tier 2? ) me @ "XP" getstatfloat me @ "XPSPENT" getstatfloat - tiercost @ < not if ( Do I have enough XP ) str "[XP-Spend] " me @ ": " me @ "class" getstatstr "(" me @ "jobs/" me @ "class" getstatstr strcat getstatint ")->" target @ "(" me @ "jobs/" me @ "class" getstatstr strcat getstatint 1 + ") ... Cost: " tiercost @ cat tellme me @ "XPSPENT" getstatfloat tiercost @ + me @ swap "XPSPENT" swap setstat ( Adjust XPSPENT ) me @ "jobs/" RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr strcat getstatint 1 + dup 5 > if pop 5 then me @ swap "jobs/" RPSYSTEM str "/jobs/" target @ "/profession" cat getpropstr strcat swap setstat me @ "professionlist" getstat ", " target @ strcat strcat me @ swap "professionlist" swap setstat target @ headface RPSYSTEM str "/jobs/" target @ "/bonus" cat getpropstr if me @ "bonus#" getstatint 1 + dup me @ swap "bonus#" swap setstat me @ swap "bonus#/" swap tostr strcat RPSYSTEM str "/jobs/" target @ "/bonus" cat getpropstr setstat then else str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint 1 + ") cannot enter tier, you need " tiercost @ " XP" cat tellme then else str "[XP-Spend] You dont meet the requirements to enter [" target @ "]. You need [" RPSYSTEM str "/jobs/" target @ "/requirements" cat getpropstr "]" cat tellme then else "[XP-Spend] Try a tier that actually exists." tellme then ; : buystat var statcost me @ "growth" getstatfloat 100 + 50 * 100.0 / statcost ! 0 j ! target @ "{appearance|dexterity|intelligence|magery|perception|stamina|strength|willpower}" smatch if begin me @ target @ getstatint 25 < if me @ "XP" getstatfloat me @ "XPSPENT" getstatfloat - statcost @ < not if ( Do I have enough XP ) str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint ")->" target @ "(" me @ target @ getstatint target @ "/" instr 0 > if 2 + else 1 + then ") ... Cost: " statcost @ 2 fchop cat tellme me @ "XPSPENT" getstatfloat statcost @ + me @ swap "XPSPENT" swap setstat ( Adjust XPSPENT ) me @ target @ getstatint 1 + dup 25 > if pop 25 then me @ swap target @ swap setstat else str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint 1 + ") cannot afford it, you have " me @ "XP" getstatfloat me @ "XPSPENT" getstatfloat - 2 fchop ", you need " statcost @ 2 fchop cat tellme then else str "[XP-Spend] You cannot accumulate more than 25 points of [" target @ "]." cat tellme then j @ 1 + j ! j @ count @ = until else "[XP-Spend] Try a primary stat that actually exists." tellme then ; : buyspecial 0 j ! begin me @ "special/" target @ strcat getstatint me @ "special/" target @ strcat "/limit" strcat getstatint me @ "Caps/" target @ strcat getstatint 2 / + 5 + < not if "You have hit your limit for raising this special, wait until next IC month" .tell exit then me @ "special/" target @ strcat getstatint 25 < if TCOST 0 = not if me @ "XP" getstatfloat me @ "XPSPENT" getstatfloat - TCOST < not if ( Do I have enough XP ) str "[XP-Spend] " me @ ": " target @ "(" me @ "special/" target @ strcat getstatint ")->" target @ "(" me @ "special/" target @ strcat getstatint 1 + ") ... Cost: " TCOST 2 fchop cat tellme me @ "XPSPENT" getstatfloat TCOST + me @ swap "XPSPENT" swap setstat ( Adjust XPSPENT ) me @ "special/" target @ strcat getstatint 1 + me @ swap "special/" target @ strcat swap setstat else str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint 1 + ") cannot afford it, you have " me @ "XP" getstatfloat me @ "XPSPENT" getstatfloat - 2 fchop ", you need " TCOST 2 fchop cat tellme then else str "[XP-Spend] You appear to be at your current max for the special [" target @ "]." cat tellme then else str "[XP-Spend] You cannot accumulate more than 25 points of [" target @ "]." cat tellme then j @ 1 + j ! j @ count @ = until ; : buyskill 0 j ! RPSYSTEM str "/skill/" target @ dup "/" instr dup 0 > if 1 - strcut pop else pop then "/desc" cat getpropstr if begin me @ target @ getstatint 25 < if me @ target @ getstatint me @ target @ dup "/" instr dup 0 > if 1 - strcut pop else pop then getstatint - 5 < if SCOST 0 = not if me @ "XP" getstatfloat me @ "XPSPENT" getstatfloat - SCOST < not if ( Do I have enough XP ) str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint ")->" target @ "(" me @ target @ getstatint target @ "/" instr 0 > if 2 + else 1 + then ") ... Cost: " SCOST 2 fchop cat tellme me @ "XPSPENT" getstatfloat SCOST + me @ swap "XPSPENT" swap setstat ( Adjust XPSPENT ) me @ target @ getstatint target @ "/" instr 0 > if 2 + else 1 + then dup 25 > if pop 25 then me @ swap target @ swap setstat else str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint 1 + ") cannot afford it, you have " me @ "XP" getstatfloat me @ "XPSPENT" getstatfloat - 2 fchop ", you need " SCOST 2 fchop cat tellme then else str "[XP-Spend] You appear to be at your current max for the special [" target @ "]." cat tellme then else str "[XP-Spend] You cannot add more than 5 points of [" target @ "] above the main skill." cat tellme then else str "[XP-Spend] You cannot accumulate more than 25 points of [" target @ "]." cat tellme then j @ 1 + j ! j @ count @ = until else "[XP-Spend] Try a skill that actually exists." tellme then ; : unbuystat var statcost me @ "growth" getstatfloat 100 + 50 * 100.0 / 0 swap - statcost ! 0 j ! target @ "{appearance|dexterity|intelligence|magery|perception|stamina|strength|willpower}" smatch if begin me @ target @ getstatint 0 > if str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint ")->" target @ "(" me @ target @ getstatint target @ "/" instr 0 > if 2 - else 1 - then ") ... Cost: " statcost @ 0 swap - 2 fchop cat tellme me @ "XPSPENT" getstatfloat statcost @ + me @ swap "XPSPENT" swap setstat ( Adjust XPSPENT ) me @ target @ getstatint 1 - dup 0 < if pop 0 then me @ swap target @ swap setstat else str "[XP-Spend] You cannot accumulate less than 0 points of [" target @ "]." cat tellme then j @ 1 + j ! j @ count @ = until else "[XP-Spend] Try a primary stat that actually exists." tellme then ; : unbuyspecial 0 j ! begin me @ "special/" target @ strcat getstatint 0 > if me @ "special/" target @ strcat getstatint 1 - me @ swap "special/" target @ strcat swap setstat TCOST 0 = not if str "[XP-Spend] " me @ ": " target @ "(" me @ "special/" target @ strcat getstatint 1 + ")->" target @ "(" me @ "special/" target @ strcat getstatint ") ... Cost: " TCOST 0 swap - 2 fchop cat tellme me @ "XPSPENT" getstatfloat TCOST 0 swap - + me @ swap "XPSPENT" swap setstat ( Adjust XPSPENT ) else str "[XP-Spend] You appear to be at your current max for the special [" target @ "]." cat tellme then else str "[XP-Spend] You cannot accumulate less than 0 points of [" target @ "]." cat tellme then j @ 1 + j ! j @ count @ = until ; : unbuyskill 0 j ! RPSYSTEM str "/skill/" target @ dup "/" instr dup 0 > if 1 - strcut pop else pop then "/desc" cat getpropstr if begin me @ target @ getstatint 0 > if me @ target @ getstatint target @ "/" instr 0 > if 2 - else 1 - then dup 0 < if pop 0 then me @ swap target @ swap setstat str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint target @ "/" instr 0 > if 2 + else 1 + then ")->" target @ "(" me @ target @ getstatint ") ... Cost: " SCOST 0 swap - 2 fchop cat tellme me @ "XPSPENT" getstatfloat SCOST 0 swap - + me @ swap "XPSPENT" swap setstat ( Adjust XPSPENT ) else str "[XP-Spend] You cannot accumulate less than 0 points of [" target @ "]." cat tellme then j @ 1 + j ! j @ count @ = until else "[XP-Spend] Try a skill that actually exists." tellme then ; : main dup not if pop "[XP-Spend] You need to specify at least a skill/special to buy." tellme exit then "=" explode dup 1 = if pop strip target ! 1 count ! else dup 2 = if pop strip target ! dup toint not if match them ! else toint count ! then else dup 2 > if pop str "[XP-Spend] I cant make sense of that.. " command @ " =" cat tellme exit then then then count @ 1 < if 1 count ! then me @ "finish" getstatint if command @ "+buyspecial" stringcmp not if buyspecial then command @ "+buyskill" stringcmp not if buyskill then command @ "+buystat" stringcmp not if buystat then command @ "+unbuyspecial" stringcmp not if unbuyspecial then command @ "+unbuyskill" stringcmp not if unbuyskill then command @ "+unbuystat" stringcmp not if unbuystat then command @ "+buytier" stringcmp not if buytier then command @ "+addtier" stringcmp not if addtier then command @ "+deltier" stringcmp not if deltier then else "[XP-Spend] You have not chargenned, therefore, you kinna buy the stats, keptin." tellme then ; . c q