$include $lib/rp $include $lib/alynna $include $muf/rp/utils $include $lib/jobs $include $muf/rp/boxutils $def RPSYSTEM "$RPSYSTEM" match $def RPSYS "$RPSYSTEM" match $def GETTCOST me @ me @ "Job" getstatstr target @ talentcost $def SCOST me @ target @ dup "/" instr 0 > if subskillcost else skillcost then $def GETJP me @ "Jobs/" me @ "Job" getstatstr strcat getstatfloat $def GETJPSPENT me @ "Jobs/" me @ "Job" getstatstr strcat "spent" strcat getstatfloat $def SETJP me @ "Jobs/" me @ "Job" getstatstr strcat "spent" strcat rot setstat $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 Ivory_Approved_Gresearch_Discounts lvar target lvar target2 lvar count lvar type lvar dir lvar j lvar temp lvar repeater lvar them lvar base lvar prof lvar param ( *** Helper functions *** ) : gdiscount $ifdef Ivory_Approved_Gresearch_Discounts { dir @ target @ "gresearch" }rps dup not if pop exit else var! research { "Global Research" research @ "Researchers" me @ name }rps tofloat 2.0 / { "Global Research" research @ "Level" }rps tofloat 50 * 50 + / dup 100.0 * var! x 1 swap - * x @ if { "Your purchase of " target @ " will be discounted by " x @ 2 round "% due to your research into the subject." }cat tellme then then $endif ; MAGECALL gdiscount $libdef gdiscount : headface ( s -- ) target2 ! 0 repeater ! rpsystem "Jobs/" target2 @ strcat "/Skills" strcat getpropstr dup not if pop exit then ":" explode repeater ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi me @ rot rot 3 pick 3 pick getstatint + setstat temp @ 1 + temp ! temp @ repeater @ = until rpsystem "Jobs/" target @ strcat "/Special" strcat getpropstr dup not if pop exit then ":" explode repeater ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi me @ rot rot 3 pick 3 pick getstatint + setstat temp @ 1 + temp ! temp @ repeater @ = until ; : tails ( s -- ) target2 ! 0 repeater ! rpsystem "Jobs/" target2 @ strcat "/Skills" strcat getpropstr dup not if pop exit then ":" explode repeater ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi them @ rot rot 3 pick 3 pick getstatint + setstat temp @ 1 + temp ! temp @ repeater @ = until rpsystem "Jobs/" target @ strcat "/Special" strcat getpropstr dup not if pop exit then ":" explode repeater ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi them @ rot rot 3 pick 3 pick getstatint + setstat temp @ 1 + temp ! temp @ repeater @ = until ; : tails2 ( s -- ) target2 ! 0 repeater ! rpsystem "Jobs/" target2 @ strcat "/Skills" strcat getpropstr dup not if pop exit then ":" explode repeater ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi them @ rot rot 3 pick 3 pick getstatint swap - setstat temp @ 1 + temp ! temp @ repeater @ = until rpsystem "Jobs/" target @ strcat "/Special" strcat getpropstr dup not if pop exit then ":" explode repeater ! 0 temp ! begin "/" explode pop "Caps/" swap strcat swap atoi them @ rot rot 3 pick 3 pick getstatint swap - setstat temp @ 1 + temp ! temp @ repeater @ = until ; : treehugger ( -- f ) target @ prof ! me @ "class" getstatstr base ! base @ "Rogue" smatch if prof @ "Fighter" instring prof @ "Mage" instring or if 2.0 exit else prof @ "Monster" instring prof @ "Mundane" instring or if 2.5 exit else 3.0 exit then then then base @ "Fighter" smatch if prof @ "Rogue" instring prof @ "Acolyte" instring or if 2.0 exit else prof @ "Monster" instring prof @ "Mundane" instring or if 2.5 exit else 3.0 exit then then then base @ "Mage" smatch if prof @ "Acolyte" instring prof @ "Rogue" instring or if 2.0 exit else prof @ "Monster" instring prof @ "Mundane" instring or if 2.5 exit else 3.0 exit then then then base @ "Acolyte" smatch if prof @ "Fighter" instring prof @ "Mage" instring or if 2.0 exit else prof @ "Monster" instring prof @ "Mundane" instring or if 2.5 exit else 3.0 exit then then then base @ "Monster" smatch if prof @ "Fighter" instring prof @ "Mage" instring prof @ "Rogue" instring prof @ "Acolyte" instring or or or if 2.5 exit else 3.0 exit then then base @ "Mundane" smatch if prof @ "Fighter" instring prof @ "Mage" instring prof @ "Rogue" instring prof @ "Acolyte" instring or or or if 2.5 exit else 3.0 exit then then 1.0 ; : sniper var param var amount var skill strip param ! param @ not param @ "#help" instring or if "Type +buyall (what you want) to buy something with your XP. For skills, subskills, and special skills, you can add in =amount to buy more than one point at a time." .tell exit then param @ "/" instring if "The cost to raise the subskill of " param @ strcat " is: " strcat me @ param @ subskillcost dup not if pop "Invalid/You can't buy more." else 2 fchop then strcat "XP Cost" pretty tellme exit then param @ "{Strength|Dexterity|Stamina|Perception|Willpower|Intelligence|Charisma}" smatch if "The cost to raise this Primary Stat is 50." strcat strcat "XP Cost" pretty tellme exit then param @ "=" instring not if param @ skill ! else param @ "=" split pop skill ! then rpsys "Talents/" skill @ strcat "/desc" strcat getpropstr if "The cost to raise the special skill/component of " param @ strcat " is: " strcat me @ me @ "Job" getstatstr param @ talentcost dup not if pop "Invalid/You can't buy more." else 2 fchop then strcat "XP Cost" pretty tellme exit then rpsys "skill/" skill @ strcat "/desc" strcat getpropstr if "The cost to raise the skill of " param @ strcat " is: " strcat me @ param @ skillcost dup not if pop "Invalid/You can't buy more." else 2 fchop then strcat "XP Cost" pretty tellme exit then "Not found." "XP Cost" pretty tellme ; : fishfinder target @ "*/*" smatch if "skill" type ! exit then prog "/types/" array_get_propvals foreach var! value var! item value @ "{" instring if ( match using smatch ) target @ value @ smatch if item @ type ! "" dir ! exit then else value @ "=" instring if ( direct mapping ) target @ tolower item @ smatch if item @ type ! "" dir ! exit then else ( match using named mapping ) { value @ target @ "desc" }rps if item @ type ! value @ dir ! exit then then then repeat "" type ! ; ( *** Actual modules *** ) : buystat "stat" type ! var statcost 50 statcost ! 0 j ! target @ "{Humanity|Charisma|dexterity|intelligence|magery|perception|stamina|strength|willpower|Gaia}" smatch if begin target @ tolower "{gaia|humanity}" smatch if 10 statcost ! then me @ target @ getstatint 25 me @ "Learn Cap/" target @ strcat getstatint + target @ "Humanity" smatch if 5 + then dup var! max < if me @ jp statcost @ < not if ( Do I have enough XP ) target @ tolower "{gaia|humanity}" smatch not if me @ "Stat Buys" getstatint 15 < not if "You cannot raise your natural stats any higher." .tell exit then then str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint ")->" target @ "(" me @ target @ getstatint target @ "/" instr 0 > if 2 + else 1 + then ") ... Cost: " statcost @ 6 fchop cat tellme me @ statcost @ jpremove ( me @ "Jobs/" me @ "Job" getstatstr strcat 0 statcost @ 2 / - adjstat ( Adjust XP ) me @ "Jobs/" me @ "Job" getstatstr strcat "spent" strcat 0 statcost @ 2 / - adjstat ( Adjust XPSPENT ) ) me @ target @ getstatint 1 + target @ tolower "{gaia|humanity}" smatch not if me @ "Stat Buys" 1 adjstat then dup max @ > if pop max @ then me @ swap target @ swap setstat else str "[XP-Spend] " me @ ": " target @ "(" me @ target @ getstatint 1 + ") cannot afford it, you have " me @ jp 6 fchop ", you need " statcost @ 6 fchop cat tellme then else str "[XP-Spend] You cannot accumulate more than " max @ " points of [" target @ "]." cat tellme then j @ 1 + j ! j @ count @ = until else "[XP-Spend] I do not understand what stat you want to buy." tellme then ; SAFECALL buystat : buyspecial "talent" type ! 0 j ! rpsys { "Talents/" target @ "/desc" }cat getpropstr not if "[XP-Spend] There is no such special skill." .tell exit then ( me @ "Special Overload" getstatint if "WARNING: We show that you have more than half your JP spent as special skills. You may want to reconsider this purchase and spend more JP on basic/subskills. This will keep your Ranked JP lower, and stop you from advancing in age brackets as quickly(Which means more JP for you!)" .tell then ) begin GETTCOST gdiscount var! TCOST me @ "_prefs/buy" getprop tostr "{yes|ye|y}" smatch not if str "Are you sure you want to buy " target @ " to the level of " me @ "Special/" target @ strcat getstatint 1 + " for " TCOST @ 6 fchop "?" cat .tell read "y" instring not if "Aborting." .tell pid kill then then me @ "special/" target @ strcat getstatint me @ "special/" target @ strcat "/limit" strcat getstatint pop 20 me @ "Caps/" target @ strcat getstatint 2 / + 5 + < not if me @ "skillcycleoverride" getstat not if "You have hit your limit for raising this special, wait until next IC month" .tell exit then then me @ "special/" target @ strcat getstatint 25 < if TCOST @ 0.001 < not if GETJP GETJPSPENT - me @ "Universal JP" getstatfloat 0 greater + 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 @ 6 fchop cat tellme GETJP GETJPSPENT - TCOST @ lesser var! cost GETJPSPENT TCOST @ + SETJP ( Adjust XPSPENT ) me @ "Universal JP" getstatfloat TCOST @ cost @ - - me @ "Universal JP" rot setstat me @ { "Jobs/" me @ "Job" getstatstr }cat getstatfloat TCOST @ cost @ - + me @ { "Jobs/" me @ "Job" getstatstr }cat rot setstat 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 " GETJP GETJPSPENT - 6 fchop ", you need " TCOST @ 6 fchop cat tellme then else TCOST @ 0 < if str "[XP-Spend] You need to raise [" rpsystem str "Talents/" target @ "/Requirement" cat getpropstr "]." cat tellme exit then 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 points of [" target @ "]." cat tellme then j @ 1 + j ! j @ count @ = until ; SAFECALL buyspecial : buyresources count @ 1 greater count ! me @ "resources" getstatint count @ + 100 > if "You cannot raise your resources above 100." .tell exit then me @ jp count @ 6 * < if "You cannot afford to raise your resources. It costs 6 JP per point." .tell exit then { "Are you sure you want to raise your resources by " count @ " for " count @ 6 * " JP?" }cat .tell read tolower "{y|yes}" smatch not if "Aborting." .tell exit then me @ count @ 6 * jpspend me @ "resources" count @ adjstat { "You raise your resources by " count @ " for " count @ 6 * " JP. It is now " me @ "Resources" getstatint "." }cat .tell exit ; SAFECALL buyresources : buyskill 0 j ! RPSYSTEM str "/skill/" target @ dup "/" instr dup 0 > if 1 - strcut pop else pop then "/desc" cat getpropstr if me @ "_prefs/buy" getprop tostr "{yes|ye|y}" smatch not if str "Are you sure you want " target @ "?" cat .tell read "y" instring not if "Aborted." .tell pid kill then then 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 GETJP GETJPSPENT - me @ "Universal JP" getstatfloat 0 greater + 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 ) 1 + ") ... Cost: " SCOST 6 fchop cat tellme GETJP GETJPSPENT - SCOST lesser var! cost GETJPSPENT SCOST + SETJP ( Adjust XPSPENT ) me @ "Universal JP" getstatfloat SCOST cost @ - - me @ "Universal JP" rot setstat me @ { "Jobs/" me @ "Job" getstatstr }cat getstatfloat SCOST cost @ - + me @ { "Jobs/" me @ "Job" getstatstr }cat rot setstat me @ target @ getstatint ( target @ "/" instr 0 > if 2 + else 1 + then ) 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 " GETJP GETJPSPENT - 6 fchop ", you need " SCOST 6 fchop cat tellme break then else str "[XP-Spend] You appear to be at your current max for the skill [" target @ "]." cat tellme break then else str "[XP-Spend] You cannot add more than 5 points of [" target @ "] above the main skill." cat tellme break then else str "[XP-Spend] You cannot accumulate more than 25 points of [" target @ "]." cat tellme break then j @ 1 + j ! j @ count @ = until else "[XP-Spend] This is an invalid stat.." tellme then ; SAFECALL buyskill : buysong me @ "gaia" getstat 10 < if "[XP-Spend] You need at least Gaia of 10 to learn a dreamsong." .tell exit then me @ "job" getstatstr var! myJob 75 var! cost myJob @ "Blue Mage" smatch if 50 cost ! then myJob @ "Monster" smatch if 50 cost ! then myJob @ "Geomancer" smatch if 50 cost ! then myJob @ requirementsDict "Blue Mage" [] if 50 cost ! then myJob @ requirementsDict "Monster" [] if 50 cost ! then myJob @ requirementsDict "Geomancer" [] if 50 cost ! then cost @ gdiscount cost ! me @ "_prefs/buy" getprop tostr "{yes|ye|y}" smatch not if { "Are you sure you want the song " target @ " for " cost @ "JP?" }cat .tell read "y" instring not if "Aborted." .tell pid kill then then me @ jp cost @ >= if me @ cost @ jpspend me @ "jNote" target @ createBoxItem j ! me @ "jnote" j @ "Desc" { "A Gaian Dreamsong. +wiki " target @ capitalize }cat setBoxProp me @ "jnote" j @ "Cost" cost @ setBoxProp { "[XP-Spend] You learn the dreamsong '" target @ "' for " cost @ "JP." }cat tellme else { "[XP-Spend] You couldn't afford the dreamsong. You need " cost @ "JP." }cat tellme then ; SAFECALL buysong : main strip dup param ! command @ "+cost" stringcmp not if sniper exit then param @ not param @ "#help" instring or if "Type +buy (what you want) to buy something with your XP. For skills, subskills, and special skills, you can add in =amount to buy more than one point at a time." .tell exit then me @ "finish" getstatint not if "[XP-Spend] You have not chargenned, therefore, you kinna buy the stats, keptin." tellme exit then begin param @ "/" instring param @ "/" rinstring = not if param @ "/" rsplit pop swap pop dup param ! then param @ "/" instring param @ "/" rinstring = until 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 { "[XP-Spend] I cant make sense of that.. " command @ " =" }cat tellme exit then then then count @ 1 < if 1 count ! then fishfinder prog "?" flag? if { "Command: " command @ "; Target: " target @ "; Count: " count @ "; Type: " type @ }cat tellme then command @ "+buyall" smatch if "+buy" command ! then command @ "+buy" smatch if { "+buy" type @ }cat command ! then prog command @ "" "+" subst cancall? if prog command @ "" "+" subst call else "I dont know what you want to buy." tellme then ;