$def HR "^blue^>^yellow^------------------------------------------------------------^blue^<^ ^" .tell $include #2123 $include #3840 $include $lib/rp $include $lib/alynna $include $muf/rp/utils $include $muf/rp/boxutils $include $lib/jmail $include $lib/research $include $lib/jobs : pnotify[ ref:target str:subj -- ] target @ player? not if exit then target @ awake? dup not if 0 else target @ idletime 600 > not then and if target @ str "^yellow^" subj @ "^normal^" cat ansi_notify else target @ "Request Notification" subj @ jmail-player "me" match me ! then ; lvar curr lvar target lvar s1 lvar target lvar result lvar roll1 lvar roll2 lvar roll3 lvar max lvar roll4 lvar fumbles lvar crits lvar succs lvar number lvar bonusstat lvar temp lvar gearbox lvar shop lvar doctor lvar n lvar x1 lvar x2 lvar curprop lvar group lvar param : time2long dup S1 ! 60 > not if "less than a minute" else S1 @ 60 / 60 > not if S1 @ 60 / dup 1 > if " minutes" else " minute" then swap intostr swap strcat else S1 @ 60 / 60 / 24 > not if S1 @ 60 / 60 / dup 1 > if " hours" else " hour" then swap intostr swap strcat ", " strcat S1 @ 60 / begin 60 - dup 60 < until dup 1 > if " minutes" else " minute" then swap intostr swap strcat strcat else S1 @ 60 / 60 / 24 / dup 1 > if " days" else " day" then swap intostr swap strcat ", " strcat S1 @ 60 / 60 / begin 24 - dup 24 < until dup 1 > if " hours" else " hour" then swap intostr swap strcat ", " strcat S1 @ 60 / begin 24 60 * - dup 24 60 * < until begin 60 - dup 60 < until dup 1 > if " minutes" else " minute" then swap intostr swap strcat strcat strcat then then then ; : badgecheck[ ref:target -- ] me @ "Votedfor" getstatint var! total total @ 10 > if me @ "Fresh Face" "You're new, but people are getting to know you. You've received 10 votes." addbadge then total @ 100 > if me @ "Well Known" "Anyone who can get over 100 votes must be well known." addbadge then total @ 1000 > if me @ "Minor Celebrity" "1000 votes can't be wrong! They love you!" addbadge then total @ 10000 > if me @ "Star" "Can you hear that? It's the sound of 10,000 votes cheering for you." addbadge then total @ 100000 > if me @ "Superstar" "Everyone knows who you are! And this isn't even an old bar related sitcom. Can I have your autograph?" addbadge then ; var struct : folklore-refresh ( -- ) ( Check for and add caps to folklore and get more studypoints ) "" struct ! me @ "Professionlist" getstatstr "scholar" instring me @ "Jobs/Mundane" getstatint 1 > and if me @ "Studypoints" getstatint 1 + me @ "Studypoints" rot setstat me @ "XP" getstatfloat me @ "XPspent" getstatfloat - number ! number @ 3 < if exit then random rpsys "Scholar#" getpropstr atoi % 1 + target ! rpsys "Scholar#/" target @ intostr strcat getpropstr target ! 140.0 me @ "Jobs/Mundane" getstatint 8 * - me @ "Caps/Folk-Lore" getstatint dup 8 > if pop 8 then 20 * - rpsys "Scholarcost/" target @ strcat getpropstr dup not if pop else atoi 100 * + then x1 ! me @ target @ "Folk-Lore/" swap strcat getstatint 25 = if exit then me @ target @ "Folk-Lore/" swap strcat getstatint dup not if pop 5.0 else sqrt then x1 @ * 0.5 * 100 / x1 ! x1 @ number @ > if exit then me @ target @ "Folk-Lore/" swap strcat getstatint 1 + me @ target @ "Folk-Lore/" swap strcat rot setstat me @ "XPspent" getstatfloat x1 @ 2 / + me @ "XPspent" rot setstat str "You make a study breakthrough in ^GREEN^" target @ "^ ^." cat "Folk-lore" pretty struct ! then ; : lore-refresh ( -- ) ( Check for and add caps to lore and get more studypoints ) "" struct ! me @ "Professionlist" getstatstr "sage" instring me @ "Jobs/Mundane" getstatint 3 > and if me @ "Studypoints" getstatint 1 + me @ "Studypoints" rot setstat me @ "XP" getstatfloat me @ "XPspent" getstatfloat - number ! number @ 3 < if exit then random rpsys "lScholar#" getpropstr atoi % 1 + target ! rpsys "lScholar#/" target @ intostr strcat getpropstr target ! 140.0 me @ "Jobs/Mundane" getstatint 8 * - me @ "Caps/Lore" getstatint dup 8 > if pop 8 then 20 * - rpsys "Scholarcost/" target @ strcat getpropstr dup not if pop else atoi 100 * + then x1 ! me @ target @ "Lore/" swap strcat getstatint 25 = if exit then me @ target @ "Lore/" swap strcat getstatint dup not if pop 5.0 else sqrt then 0.5 * x1 @ * 100 / x1 ! x1 @ number @ > if exit then me @ target @ "Lore/" swap strcat getstatint 1 + me @ target @ "Lore/" swap strcat rot setstat me @ "XPspent" getstatfloat x1 @ 2 / + me @ "XPspent" rot setstat str "You make a study breakthrough in ^GREEN^" target @ "^ ^." cat "Lore" pretty struct ! then ; : materials-refresh ( Check for and add new materials to commodity producers ) "" struct ! me @ "Caste" getstatint -1 = not if me @ "@rp/materials/" nextprop if systime me @ "MLast Cycle" getstatint - dup timex str swap "^GREEN^" swap "^ ^ until your next material refresh." cat struct ! 86400 7 * > if me @ "Mlast Cycle" systime setstat "Materials refreshed." struct ! me @ "@rp/materials/" nextprop begin curprop ! random me @ curprop @ getpropval 1 + % curprop @ "" "@rp/materials/" subst "" "/" subst temp ! me @ temp @ getstatint + me @ temp @ rot setstat me @ curprop @ nextprop dup not until pop then then then ; : vote-refresh ( Refresh one's supply of votes ) "" struct ! me @ "voted" "" setstat me @ "last cycle" systime setstat me @ "votes" getstatint 4 + dup 10 > if pop 10 then me @ swap "votes" swap setstat str "You gain " 4 " votes, for a total of ^GREEN^" me @ "votes" getstatint "^ ^." cat struct ! ; : hp-refresh ( Regenerate some more HP ) "" struct ! me @ target ! me @ RPlib.getMaxHp number ! me @ "HP" getstatint number @ over > if me @ RPlib.getMaxHP random 3 % 2 + me @ "Jnote" "Quick Healer" findboxitem if 1 + then * 10.0 / temp ! me @ "Exotic Food" getstatint dup if 1 - me @ "Exotic Food" rot setstat struct @ "You dine on fine food. " strcat struct ! 115 me @ "Cooking" getstatint + * 100 / else pop me @ "Average Food" getstatint dup if 1 - me @ "Average Food" rot setstat struct @ "You dine on normal food. " strcat struct ! 110 me @ "Cooking" getstatint + * 100 / else pop me @ "Sea Food" getstatint dup if 1 - me @ "Sea Food" rot setstat struct @ "You dine on sea food. " strcat struct ! 110 me @ "Cooking" getstatint + * 100 / else pop me @ "Dull Food" getstatint dup if 1 - me @ "Dull Food" rot setstat struct @ "You dine on dull food. " strcat struct ! 105 me @ "Cooking" getstatint + * 100 / else pop then then then then me @ "Doctor" getstatint dup if dbref dup player? if doctor ! doctor @ "Intelligence" getstatint doctor @ "perception" getstatint + 2 / doctor @ "Medicine" getstatint 2 / doctor @ "Chemistry" getstatint doctor @ "Herbalism" getstatint + 4 / + 5 * dup intostr str swap " Your healing rate is set to " swap strcat "% thanks to your doctor. " cat struct @ swap strcat struct ! temp @ * 100 / int temp ! else pop then else pop then temp @ + me @ "HP" rot toint setstat str "HP regained: ^RED^" temp @ "^ ^" cat struct @ swap strcat struct ! me @ RPlib.getMaxHp number ! me @ "HP" getstatint number @ over < if pop me @ RPlib.getMaxHp me @ "HP" rot setstat then target @ "@rp/HPMPInit" getpropval not target @ "finish" getstatint and if target @ "HPMPInit" 1 setstat me @ RPlib.getMaxHp target @ "HP" rot setstat "HP set to ^GREEN^MAX^ ^ due to first time HP init." struct ! then then ; lvar tempxp lvar rpjp ( : growthfactor ( i d -- f ) var target var number target ! number ! target @ "growth" getstatfloat 100 / + number @ * ; ) : xp-refresh ( Give them a XP if they are here and awake ) var xpg "" struct ! me @ "voted" "" setstat me @ "Totaljp" getstatint #0 "JP Cap" getstatint < not me @ "Jnote" "Job Oriented" findboxitem not and if exit then me @ player? if ( me @ "votedfor" getstatfloat sqrt dup xpg ! ) me @ badgecheck me @ "Jobs/" me @ "Job" getstatstr strcat getstatfloat 1.0 0 xpg ! ( me @ "Votedfor" 0 setstat ) me @ "Jobswitch" getstatint not if 1 + "You gain an additional JP for not switching jobs." .tell then me @ "Jnote" "Growth" findboxitem if 1 + "You gain an additional JP for Growth merit." .tell then tempxp ! me @ "Months" getaccountstat toint 3 < if "For being a newbie player, we will give you an extra JP." "Bonus JP" pretty .tell tempxp @ 1 + tempxp ! then me @ "global research" getstatstr "0" smatch not if var topic me @ "global research" getstatstr topic ! rpsys str "Global Research/" topic @ "/Finished" cat getpropval if "You are researching something that is already completed." .tell else topic @ canprogress? not if "Your research requires more gil and/or material goods to continue." .tell else tempxp @ topic @ dailyjp - tempxp ! str "You continue to work on " topic @ "." me @ topic @ researchcontinue if " It is completed!" else me @ "Race" getstatstr "human" instring if me @ "Human Bonus" getstatint 1 - me @ "Human Bonus" rot setstat me @ "Human Bonus" getstatint 1 < if me @ "Human Bonus" 10 setstat me @ topic @ researchcontinue if " It is completed!" then then then me @ "resources/Laboratory" getstatint me @ "Jnote" "Scientifically Minded" findboxitem if 5 * 4 / then me @ "Improvements/Lab" getgroupstat toint dup not if pop else 5 * 5 + 3 / + then dup var! lab if me @ "Lab Bonus" lab @ adjstat me @ "Lab Bonus" getstatint 29 > if me @ "Lab Bonus" -30 adjstat me @ topic @ researchcontinue if " It is completed!" then then then then cat "Global Research" pretty .tell then then then me @ "Bonus JP" getstatfloat dup not if pop else dup str "You gain " rot 1 round 0 greater " JP for being well rested." cat "Bonus JP" pretty tellme tempxp @ + tempxp ! then me @ "RPXP" getstatint dup rpjp ! 3 < me @ "RPJP Stash" getstatfloat and if ( Did not gain the full 2.0 JP, but has some stashed ) me @ "RPJP Stash" getstatfloat 3 me @ "RPXP" getstatfloat - lesser var x x ! me @ "RPJP Stash" getstatfloat x @ - me @ "RPJP Stash" rot setstat tempxp @ x @ + tempxp ! x @ str "You gain " rot 1 round " JP from your stash of RPJP." cat "Bonus JP" pretty tellme then group @ if rpsys str "Groups/" group @ "/JP Tax" cat getpropstr toint dup not me @ "Alt Group" getstatint or if pop else var gsac 5 / tempxp @ * 100.0 / gsac ! str "You sacrifice " gsac @ 2 fchop " JP to the betterment of your adventuring group." cat "Group" pretty tellme tempxp @ gsac @ - tempxp ! rpsys str "Groups/" group @ "/XP" cat getprop tofloat gsac @ + rpsys str "Groups/" group @ "/XP" cat rot setprop me @ "Group XP" getstatfloat gsac @ + me @ "Group XP" rot setstat then then me @ "Totaljp" getstatint me @ "Universal JP" getstatint + #0 "Max JP" getstatint 2 / > not if #0 "Max JP" getstatint 2 / me @ "Totaljp" getstatint me @ "Universal JP" getstatint + - 20.0 / random 60 % 70 + * 100 / var! boost { "To help you get to middle range of the JP curve, you are given " boost @ 2 fchop " extra JP." }cat .tell tempxp @ boost @ 10 lesser + tempxp ! boost @ 10 > if me @ "Universal JP" boost @ 10.0 - adjstat then then me @ "Ranked JP" getstatint 100 * #0 "Max JP" getstatint / case 31 < when "You are a newbie and gain 5 extra JP." .tell me @ "Age" "Newbie" setstat tempxp @ 5 + tempxp ! end 46 < when "You are extremely behind the curve and gain two bonus JP." .tell me @ "Age" "Young" setstat tempxp @ 2 + tempxp ! end 71 < when "You are just a little behind the curve and gain a bonus JP." .tell me @ "Age" "Maturing" setstat tempxp @ 1 + tempxp ! end 80 < when "You are fairly average in the JP race." .tell end me @ "Age" "Mature" setstat 96 < when "You are a JP leader of the game and lose 1 JP of progress due to confidence." .tell me @ "Age" "Old" setstat tempxp @ 1 - tempxp ! end pop when "Nothing can challenge you! You are the king!" .tell me @ "Age" "Ancient" setstat tempxp @ 2 / tempxp ! end endcase me @ "RPXP" 0 setstat tempxp @ 1 me @ "Totaljp" getstatint 3000 lesser 500 / 1 for pop 9 * 10 / repeat me @ "500 Reward" getstatint me @ "Totaljp" getstatint 3000 lesser 500 / < if "You gain some perk points for maturing!" .tell me @ "500 reward" getstatint 1 + me @ "Totaljp" getstatint 3000 lesser 500 / 1 for dup me @ "Perks" getstatint + me @ "Perks" rot setstat str "You gain " rot " perk points!" cat tellme repeat me @ "500 reward" me @ "Totaljp" getstatint 3000 lesser 500 / setstat then "To adjust your lifepath savings, &lifepath me=(number from one to fifty)" .tell me @ "Lifepath" getprop toint 0 greater 50 lesser me @ "Dedicated?" rot setstat me @ "Jnote" "Static" findboxitem if tempxp @ 10 / tempxp ! then me @ "Dedicated?" getstatint dup not if pop else tempxp @ * 100 / var! lifepathed tempxp @ lifepathed @ - tempxp ! me @ "Lifepool" getstatfloat lifepathed @ + me @ "Lifepool" rot setstat lifepathed @ if str "You gain " lifepathed @ 2 fchop " JP in your lifepath pool." cat .tell then then tempxp @ 0.05 greater tempxp ! me @ "Jobs/" me @ "Job" getstatstr strcat getstatfloat tempxp @ + me @ "Jobs/" me @ "Job" getstatstr strcat rot setstat str "Total JP gained: " tempxp @ 2 fchop "(" tempxp @ rpjp @ + 2 fchop " if you include RPJP)" cat struct ! ( str me @ "species" getpropstr " " me @ "Class" getstatstr " gained a level!" cat gauntlet ) me @ "Votes" getstatint 4 + me @ "Votes" rot setstat me @ "Votes" getstatint 10 > if 10 me @ "Votes" rot setstat then then ; : study-refresh ( If studying, adcance ones study a bit ) "" struct ! me @ "Intelligence" getstatint me @ "Arcana" getstatint + me @ "Lore" getstatint + 2.5 / me @ "Arcana/Research" getstatint me @ "Jobs/Mage" getstatint 2 * + + 10.0 / int me @ "Jnote" "Fast Study" findboxitem if 2 * then 10 + 2 / me @ "Resources/Library" getstatint me @ "faction" getstatint 5 = if 5 + then 0.05 * 1 + * me @ "Studypoints" getstatint + target ! me @ "Spell" getstatstr dup "0" smatch not if curprop ! me @ "Spells/" curprop @ strcat getstatfloat target @ 6.0 * 5.0 / + dup 100 > if pop 100 me @ "spell" 0 setstat then me @ "Spells/" curprop @ strcat rot setstat str "Spell study progress: (^GREEN^" curprop @ strcat "^ ^) = ^GREEN^" me @ "Spells/" curprop @ strcat getstatfloat 2 fchop "%^ ^" cat struct ! 0 target ! else curprop ! me @ "Intelligence" getstatint target @ > me @ "Arcana/Research" getstatint target @ > me @ "Lore" getstatint target @ > and and if me @ "Intelligence" getstatint me @ "Jnote" "Fast Study" findboxitem if 2 * then 10 + 2 / me @ "Resources/Library" getstatint me @ "faction" getstatint 5 = if 5 + then 0.05 * 1 + * target ! str "Spell study points gained: ^GREEN^" target @ "^ ^" cat struct ! then then me @ "Studypoints" target @ setstat ; : lifestyle-refresh var gil ( Skip it if they're a slave ) me @ "Caste" getstatint -1 = not if ( And now, account for ones lifestyle ) "" struct ! me @ "Gil" getstatfloat me @ "BoxGil" getstatfloat + gil ! me @ "Gil" gil @ tofloat setstat var output me @ income output ! group @ if rpsys str "Groups/" group @ "/Tax" cat getpropstr toint dup not me @ "Alt Group" getstatint or if pop else var gsac 5 / output @ * 100.0 / gsac ! str "You sacrifice " gsac @ 2 fchop " gil to the betterment of your adventuring group." cat "Group" pretty tellme output @ gsac @ - output ! rpsys str "Groups/" group @ "/Gil" cat getprop tofloat gsac @ + rpsys str "Groups/" group @ "/Gil" cat rot setprop me @ "Group Gil" getstatfloat gsac @ + me @ "Group Gil" rot setstat then then me @ "Improvements/Business" getgroupstat toint dup not if pop else case 1 = when str "You gain " random 10 % 1 + dup output @ + output ! " gil from your group's business dealings." cat "Group" pretty tellme end 2 = when str "You gain " random 10 % 1 + random 10 % 1 + + dup output @ + output ! " gil from your group's business dealings." cat "Group" pretty tellme end 3 = when str "You gain " random 20 % 1 + random 20 % 1 + + random 20 % 1 + + dup output @ + output ! " gil from your group's business dealings." cat "Group" pretty tellme end 4 = when str "You gain " random 25 % 1 + random 25 % 1 + + random 25 % 1 + + random 25 % 1 + + dup output @ + output ! " gil from your group's business dealings." cat "Group" pretty tellme end endcase then output @ me @ "Gil" getstatfloat + me @ "Gil" rot setstat me @ maxgil var cost dup me @ "Gil" getstatfloat < if me @ "gil" getstatfloat over - dup cost ! "You lose " swap intostr strcat " gil due to maximums, this becomes credit for the future." strcat .tell me @ "Gil" rot setstat me @ "Credit" getstatfloat cost @ + me @ "Credit" rot setstat else pop then output @ 2 fchop str swap "Income: ^GREEN^" swap "^ ^ " cat struct @ swap strcat struct ! 0 me @ "Used Credit" 0 setstat me @ maxgil 5 / me @ "Used Credit" getstatfloat > me @ "Credit" getstatfloat and if me @ maxgil 5 / me @ "Used Credit" getstatfloat - me @ "Credit" getstatfloat lesser me @ maxgil me @ "gil" getstatfloat - lesser 0 greater cost ! str "From past earned credit, you earn " cost @ " gil." cat .tell me @ "Used Credit" getstatfloat cost @ + me @ "Used Credit" rot setstat me @ "Credit" getstatfloat cost @ - me @ "Credit" rot setstat group @ if rpsys str "Groups/" group @ "/Tax" cat getpropstr toint dup not me @ "Alt Group" getstatint or if pop else var gsac 5 / cost @ * 100.0 / gsac ! str "You sacrifice " gsac @ 2 fchop " gil to the betterment of your adventuring group." cat "Group" pretty tellme cost @ gsac @ - cost ! rpsys str "Groups/" group @ "/Gil" cat getprop tofloat gsac @ + rpsys str "Groups/" group @ "/Gil" cat rot setprop me @ "Group Gil" getstatfloat gsac @ + me @ "Group Gil" rot setstat then then me @ "gil" getstatfloat cost @ + me @ "gil" rot setstat then me @ "Dependants" getstatint dup if 5 * 1 - random swap % tofloat 1.0 + 10 / over over * ".. Expenses for " me @ "Dependants" getstatstr strcat " Dependants: ^RED^" strcat swap tofloat 2 fchop strcat "^ ^" strcat struct @ swap strcat struct ! 1.0 + * else pop then target ! struct @ "Lifestyle" pretty tellme "" struct ! me @ "Gil" getstatfloat target @ < if "Oh no! you can't afford your life style. Your life style has been stripped, use +lifestyle to set a new one" "Lifestyle" pretty tellme me @ "Life Style" "Bum" setstat me @ "Lifecost" 0.0 setstat else me @ "Gil" getstatfloat target @ - me @ "Gil" rot setstat then me @ "Gil" getstatfloat me @ "BoxGil" getstatfloat - gil ! me @ "Gil" gil @ setstat str "New Gil Balance: ^YELLOW^" me @ "Gil" getstatfloat 2 fchop "^ ^" cat struct @ swap strcat struct ! else me @ "Caste" getstatint -1 = if "You're a slave. You make no money." "Lifestyle" pretty tellme me @ "@rp/resources" remove_prop me @ "@rp/resourcesspent" remove_prop me @ "resources" 1 setstat me @ "gil" getstatint dup 30 > if pop me @ "gil" 30 setstat "You had more gil than you could carry. You've lost all but 30 gil." struct ! then then then ; : refresh-report ( s -- ) ( Report the output of the last module) struct @ if struct @ swap pretty tellme then ; : init-refresh ( Do pre-module adjustments ) me @ "idlexp" 0 setstat ; : finish-refresh ( Do post-module adjustments ) me @ "last cycle" systime setstat ; : market-refresh var item var value var maxmarket var total var value me @ "Caste" getstatint -1 = not if "" struct ! 0 total ! 10.0 me @ caste2storage me @ "storage" getstatfloat + + me @ "Resources/Warehouse" getstatfloat 5 * + maxmarket ! rpsys "/materials/" array_get_propdirs foreach item ! pop item @ "Shards*" smatch if continue then rpsys str "Materials/" item @ "/Cost" cat getprop toint dup not if pop 4000 then rpsys str "bMaterials/" item @ "/Cost" cat getprop toint dup not if pop 4000 then lesser rpsys str "Native Materials/" item @ "/Cost" cat getprop toint dup not if pop 4000 then lesser rpsys str "Local Materials/" item @ "/Cost" cat getprop toint dup not if pop 4000 then lesser value ! me @ item @ getstat tofloat maxmarket @ > if total @ me @ item @ getstat toint maxmarket @ - value @ * 200 / + total ! then repeat total @ toint if me @ "gil" over over getstatfloat total @ 0.25 * - setstat me @ "gil" getstat dup 0 < if var! x me @ "credit" over over getstat x @ + setstat else pop then { "Your excess market items (over capacity) cost you " total @ 0.25 * 2 fchop " gil to store." }cat "Warehouse" pretty tellme me @ "credit" getstat 0 < if { "You are destitute. The warehouses are selling off some of your excess items." }cat "Warehouse" pretty tellme rpsys "/materials/" array_get_propdirs foreach item ! pop item @ "Shards*" smatch if continue then me @ item @ getstat tofloat maxmarket @ > if me @ item @ over over getstat dup 0.10 * toint dup x ! - setstat { "The warehouses throw " x @ " of your " item @ " onto the street." }cat "Warehouse" pretty tellme then repeat then me @ "gil" getstat 0.0 < if me @ "gil" 0.0 setstat then me @ "credit" getstat 0.0 < if me @ "credit" 0.0 setstat then then else var foundItem rpsys "/materials/" array_get_propdirs foreach item ! me @ item @ getstatint dup 0 > if foundItem ! else pop then me @ item @ 0 setstat repeat foundItem @ 0 > if "You have no where to store your materials and they become lost." struct ! then 0 foundItem ! rpsys "/bmaterials/" array_get_propdirs foreach item ! me @ item @ getstatint dup 0 > if foundItem ! else pop then me @ item @ 0 setstat repeat foundItem @ 0 > if "You discard your black market items to prevent blame falling on your master." "Black-Market" pretty tellme then then ; lvar diff : book-refresh var target var caps var cap me @ "bookcap" getstatint caps ! me @ "bookskill" getstatstr target ! target @ "linguistics" instring not if caps @ me @ "Linguistics/Writing" getstatint 5 / > if me @ "Linguistics/Writing" getstatint 5 / caps ! then then me @ "caps/" target @ strcat getstatint cap ! cap @ caps @ < not if "You have learned all you can from this book." "Book" pretty .tell exit then cap @ not if 4 else 2 cap @ * then me @ "Jnote" "Fast Study" findboxitem if 2 * 3 / then me @ "Intelligence" getstatint 12.5 / int / rpsys "Skill/" target @ strcat "/desc" strcat getpropstr if 1 else 2 then * 60 60 * 24 * 7 * * 2.0 / me @ "Special/aptitude" getstatint 1.5 * dup 0 > if 100 / 1 swap - * else pop then me @ "Blearnstart" getstatint + dup systime < if pop "You learn from your book!" "Book" pretty .tell me @ "Caps/" target @ strcat getstatint 1 + me @ "Caps/" target @ strcat rot setstat me @ "Blearnstart" systime setstat else systime swap - timex " until you understand your book further." strcat "Book" pretty tellme then ; : mentor-refresh var timemod var myclass var theirclass exit me @ "bookcap" getstatint if book-refresh then me @ "Class" getstatstr myclass ! "" struct ! me @ "mentored" getstatint dup not if pop exit then dbref target ! target @ "approved?" getstatint not if "Your student is no longer a viable target." struct ! me @ "mentored" 0 setstat exit then target @ "Class" getstatstr theirclass ! systime me @ "Met/" target @ int intostr strcat getstatint - 60 60 * 24 * > if "You haven't seen your student in some time" struct ! force_level 0 = if exit then target @ "learnstart" getstatint systime me @ "Met/" target @ int intostr strcat getstatint - dup 60 60 * 24 * > if pop 60 60 * 24 * then + target @ "learnstart" rot setstat exit then me @ "Mentorjob" getstatstr dup "0" smatch if pop exit then curprop ! target @ "Caps/" curprop @ strcat getstatfloat 5 > if "Your student has learned all they can possibly learn from mentoring." struct ! exit then 2 timemod ! rpsys "Skill/" curprop @ strcat nextprop not if rpsys "Talents/" curprop @ strcat nextprop not if exit else 2 timemod ! then else 1 timemod ! then timemod @ 2 = if myclass @ theirclass @ smatch not me @ "professionlist" getstatstr "tutor" instring not and if myclass @ "Fighter" smatch theirclass @ "Mage" smatch and if "Opposite Class, no automated special mentoring" struct ! exit then myclass @ "Mage" smatch theirclass @ "Fighter" smatch and if "Opposite Class, no automated special mentoring" struct ! exit then myclass @ "Acolyte" smatch theirclass @ "Rogue" smatch and if "Opposite Class, no automated special mentoring" struct ! exit then myclass @ "Rogue" smatch theirclass @ "Acolyte" smatch and if "Opposite Class, no automated special mentoring" struct ! exit then myclass @ "Mundane" smatch theirclass @ "Monster" smatch and if "Opposite Class, no automated special mentoring" struct ! exit then myclass @ "Monster" smatch theirclass @ "Mundane" smatch and if "Opposite Class, no automated special mentoring" struct ! exit then then then target @ "Caps/" curprop @ strcat getstatint dup 4 > if "Your student cannot profit by being taught any more on this subject." struct ! pop exit then temp ! timemod @ 2 = not if me @ curprop @ getstatint 5 / else me @ "Special/" curprop @ strcat getstatint not if 0 else rpsys "Talents/" curprop @ strcat "/caps" strcat getpropstr "/" 5 eselect atoi me @ "Special/" curprop @ strcat getstatint swap < not if 5 else rpsys "Talents/" curprop @ strcat "/caps" strcat getpropstr "/" 4 eselect atoi me @ "Special/" curprop @ strcat getstatint swap < not if 4 else rpsys "Talents/" curprop @ strcat "/caps" strcat getpropstr "/" 3 eselect atoi me @ "Special/" curprop @ strcat getstatint swap < not if 3 else rpsys "Talents/" curprop @ strcat "/caps" strcat getpropstr "/" 2 eselect atoi me @ "Special/" curprop @ strcat getstatint swap < not if 2 else rpsys "Talents/" curprop @ strcat "/caps" strcat getpropstr "/" 1 eselect atoi me @ "Special/" curprop @ strcat getstatint swap < not if 1 else 0 then then then then then then then temp @ > me @ "Caps/" curprop @ strcat getstatint temp @ > or not if "Your student knows as much or more than you do" struct ! exit then target @ "Learnstart" getstatint systime swap - 2.5 * diff ! temp @ not if 2 then temp @ 1 = if 1 then temp @ 2 = if 2 then temp @ 3 = if 3 then temp @ 4 = if 4 then temp @ 4 > if 4 then timemod @ * me @ "Willpower" getstatint target @ "willpower" getstatint < me @ "professionlist" getstatstr "tutor" instring not and if 1 + then me @ "Class" getstatstr target @ "class" getstatstr smatch if 1 - then me @ "Professionlist" getstatstr "teacher" instring if 0.5 * then dup 1 < if pop 0.5 then 60 * 60 * 24 * 7 * target @ "Special/aptitude" getstatint 1.5 * dup 0 > if 100 / 1 swap - * else pop then diff @ tofloat swap / target @ "Caps/" curprop @ strcat getstatfloat + target @ "Caps/" curprop @ strcat rot setstat ( < not if diff @ - timex " until student learns" strcat struct ! exit then ) str "Your student learns more " curprop @ "!" cat struct ! #21 str "p #mail " target @ name "=You have gained cap in " curprop @ " from being mentored!" cat force target @ "Learnstart" systime setstat ; : monthly-refresh exit var curprop me @ "skillcycle" getstatint systime swap - 60 60 * 24 * 30 * 2.5 / int - dup 0 < if timex " time remaining until monthly cycle" strcat struct ! exit then me @ "Tiercycle" 0 setstat me @ "Skillcycle" systime setstat pop me @ "@rp/Special/" nextprop curprop ! curprop @ not if exit then begin me @ curprop @ getpropval me @ curprop @ "/limit" strcat rot setprop me @ curprop @ nextprop curprop ! curprop @ not until "Special Skill limits reset" struct ! ; $def STORAGECOST 2.0 : affinity-refresh ( -- ) var jobs var affins exit "" struct ! me @ "Professionlist" getstatstr jobs ! 0 jobs @ "Elemental Mage" instring if 4 + then jobs @ "Elemental Scholar" instring if 4 + then jobs @ "Geomancer" instring if 4 + then jobs @ "Elemental Sorcerer" instring if 4 + then me @ "Jobs/Mage" getstatint + affins ! me @ "Affinspent2" getstatint affins @ < me @ player? and if 1 if me @ "Affinspent2" getstatint affins @ swap - affins ! begin "You have Points to spend in elemental affinities" .tell str me @ "Special/Fire-Affinity" getstatint " Fire" cat .tell str me @ "Special/Ice-Affinity" getstatint " Ice" cat .tell str me @ "Special/White-Affinity" getstatint " White" cat .tell str me @ "Special/Black-Affinity" getstatint " Black" cat .tell str me @ "Special/Lightning-Affinity" getstatint " Lightning" cat .tell str me @ "Special/Night-Affinity" getstatint " Night" cat .tell str me @ "Special/Day-Affinity" getstatint " Day" cat .tell str me @ "Special/Earth-Affinity" getstatint " Earth" cat .tell str me @ "Special/Air-Affinity" getstatint " Air" cat .tell str me @ "Special/Water-Affinity" getstatint " Water" cat .tell "Where will you put a point?" .tell read strip dup not if pop continue else dup "{fire|ice|earth|air|lightning|day|night|white|black|water}" smatch not if pop continue then then "-Affinity" strcat jobs ! me @ "Special/" jobs @ strcat getstatint 1 + dup 25 > if pop continue then me @ "Special/" jobs @ strcat rot setstat me @ "Affinspent2" getstatint 1 + me @ "Affinspent2" rot setstat affins @ 1 - affins ! affins @ not until "Affinities set" struct ! then then ; : lifepath-refresh var lifepath var x var max var stat var ideal var cost var debuger var dedicated me @ "Totaljp" getstatint #0 "JP Cap" getstatint < not me @ "Jnote" "Job Oriented" findboxitem not and if exit then "" struct ! me @ "Job" getstatstr dup "0" smatch if pop "No Life Path" struct ! exit then "Jobs/" swap strcat lifepath ! me @ "Dedicated?" getstatint dup not if pop exit then dedicated ! rpsys "Lifepaths/" lifepath @ strcat array_get_proplist 0 var! found ( dup not if pop "Invalid Life Path, no path found. If you beleive this to be in error, alert Nuku" exit then ) foreach swap pop ":" explode pop stat ! atoi ideal ! random ideal @ % 1 + me @ stat @ getstatint > if ( We want to buy this! ) 1 found ! stat @ "special" instring if ( It's a special skill! ) me @ stat @ dup "/" instring strcut swap pop me @ "Job" getstatstr swap talentcost x ! else ( Not a special, awww. ) stat @ "/" instring if ( Subskill, yay! ) me @ stat @ subskillcost else me @ stat @ skillcost then x ! then x @ -1 = if continue then x @ 0 = stat @ "/" instring and if rpsys "Talents/" stat @ dup "/" instring strcut swap pop strcat "/lp?" strcat getpropstr atoi x ! then x @ 0 = if continue then ( x @ 0.7 * x ! ) dedicated @ not if ( Not dedicated ) me @ "XP" getstatfloat me @ "XPspent" getstatfloat - x @ > not if ( Can't afford it, NOOOO! ) ( "You can't afford to progress further." struct ! ) exit then me @ "XPspent" getstatfloat x @ + me @ "XPspent" rot setstat ( XP Adjusted ) else ( Dedicated ! ) me @ "Lifepool" getstatfloat x @ > not if ( Can't afford it. ) ( "You can't afford to progress further." struct ! ) exit then me @ "Lifepool" getstatfloat x @ - me @ "Lifepool" rot setstat me @ "Universal JP" getstatfloat x @ 0.3 * + me @ "Universal JP" rot setstat me @ str "Jobs/" me @ "Job" getstatstr cat getstatfloat x @ + me @ str "Jobs/" me @ "Job" getstatstr cat rot setstat me @ str "Jobs/" me @ "Job" getstatstr "Spent" cat getstatfloat x @ + me @ str "Jobs/" me @ "Job" getstatstr "Spent" cat rot setstat then me @ stat @ getstatint 1 + ( stat @ "/" instring if stat @ "special" instring not if 1 + then then ) me @ stat @ rot setstat str "You advance in your lifepath, learning " stat @ " for " x @ 2 fchop "!" cat .tell struct @ "Lifepath" pretty tellme dedicated @ not if exit then lifepath-refresh exit then 0 until found @ not if me @ "Lifepool" getstatfloat me @ str "Jobs/" me @ "Job" getstatstr cat getstatfloat + me @ str "Jobs/" me @ "Job" getstatstr cat rot setstat me @ "Lifepool" 0 setstat "You have mastered this lifepath." struct ! else "You make no progress in your life path, patience is needed" struct ! then ; $libdef lifepath-refresh PUBLIC Lifepath-Refresh : nonmon-refresh me @ "growthdays" getstatint if ( Hyper Growthed ) me @ "growthdays" getstatint 1 - me @ "growthdays" rot setstat me @ "growthdays" getstatint 1 < if ( Time's up! ) me @ "Growth" getstatfloat 20 - me @ "Growth" rot setstat "Your accelerated growth ends." struct ! else "You are still growing quickly!" struct ! then then ; : mutant-refresh var slots var cur "" struct ! 1 me @ "MutantSlots" getstatint 1 for cur ! me @ str "Mutant/" cur @ "/Locked?" cat getstatint random 100 % and if ( Locked, Skip) continue then random 30 % 1 + me @ "Humanity" getstatint < me @ str "Mutant/" cur @ cat getstatstr "0" smatch not and if ( Failed the check, skip) continue then random 100 % not if "A small portion of your humanity is stripped from you!" .tell me @ "Humanity" getstatint 1 - dup 1 < if pop 1 then me @ "Humanity" rot setstat then random 100 % 1 + case 61 < when "Minor Positive Mutation" end 81 < when "Minor Negative Mutation" end 91 < when "Major Positive Mutation" end 101 < when "Major Negative Mutation" end endcase slots ! rpsys slots @ "/" strcat array_get_propdirs SORTTYPE_SHUFFLE array_sort 0 array_getitem var! result slots @ "Negative" "Positive" slots @ "negative" instring if swap then subst var! slot2 rpsys slot2 @ "/" strcat array_get_propdirs SORTTYPE_SHUFFLE array_sort 0 array_getitem " / " strcat result @ strcat dup me @ str "Mutant/" cur @ cat rot setstat str "You gain the " slots @ " of " cat swap dup slots @ "/" strcat swap strcat slots ! strcat "!" strcat me @ str "Mutant/" cur @ "/desc" cat rpsys slots @ "/desc" strcat getpropstr setstat me @ str "Mutant/" cur @ "/Locked?" cat 0 setstat struct @ "\r" swap strcat strcat struct ! 0 until ; : ammo-refresh var cur var bullets var cost me @ "@rp/arms/" array_get_propdirs foreach cur ! pop me @ str "Arms/" cur @ "/Ammo" cat getstatint me @ str "Arms/" cur @ "/AmmoLeft" cat getstatint - dup 1 < if pop continue else dup bullets @ + bullets ! me @ str "Arms/" cur @ "/Rating" cat getstatint dup not if pop 1 then * cost @ + cost ! me @ str "Arms/" cur @ "/Ammo" cat getstatint me @ str "Arms/" cur @ "/AmmoLeft" cat rot intostr setstat then 0 until "" struct ! bullets @ if str "Charges Purchased: " bullets @ ". Total Cost: " cost @ cat "Ammo" pretty tellme then me @ "Gil" 0 cost @ - adjstat ; : condition-refresh "" struct ! me @ "Condition" getstatint dup not if pop exit else 1 - me @ "Condition" rot setstat then me @ "hp" me @ maxhp setstat "You feel better after some rest." struct ! ; : rental-refresh var room var rent var cost var hub 0 rent ! var target me @ int target ! 1 dbtop int 1 for var cur dbref cur ! cur @ room? not if continue then cur @ name "[Tent]:" instring if continue then cur @ name "[Hiding]:" instring if continue then cur @ "mudspace?" envstatval if continue then cur @ "Owner" getstatint target @ = if str "You own " cur @ name "." cat .tell cur @ location cur @ "room?" getstatint if "Room" else "Hub" then "Rental" strcat "@rp/" swap strcat envprop swap hub ! toint dup cost ! rent @ + rent ! me @ "gil" getstatint cost @ < if "You can no longer afford one of your rented rooms! It is nuked." .tell cur @ "room?" getstatint if hub @ contents_array foreach var ex ex ! pop ex @ exit? not if continue then ex @ getlink cur @ dbcmp if ex @ recycle then repeat else "Because it is a hub, you are simply being removed as the owner, consult your IC landlord, or staff if NPC, to regain control of your hub." .tell cur @ "Owner" 21 setstat then else me @ "Gil" getstatfloat cost @ - me @ "Gil" rot setstat var owner hub @ "Owner" getstatint dbref dup owner ! str "You are paid " cost @ 9 * 10 / " gil of rent by " me @ name "!" cat pnotify var group owner @ "Adventuring Group" getstatstr group ! cost @ 9 * 10 / cost ! group @ "0" smatch not if group @ if rpsys str "Groups/" group @ "/Tax" cat getpropstr toint dup not me @ "Alt Group" getstatint or if pop else var gsac 5 / cost @ * 100.0 / gsac ! owner @ str "You sacrifice " gsac @ 2 fchop " gil to the betterment of your adventuring group." cat "Group" pretty pnotify cost @ gsac @ - cost ! rpsys str "Groups/" group @ "/Gil" cat getprop tofloat gsac @ + rpsys str "Groups/" group @ "/Gil" cat rot setprop owner @ "Group Gil" getstatfloat gsac @ + owner @ "Group Gil" rot setstat then then then owner @ "Gil" getstatint cost @ + owner @ "Gil" rot setstat then then repeat str "You pay " rent @ " in land rental fees." cat struct ! ; : stat-refresh me @ "Background" getstatstr strlen 5 > me @ "Background Growth" getstatint not and if me @ "Background Growth" 1 setstat me @ "Stat Growth" getstatint 5 - me @ "Stat Growth" rot setstat then me @ "Stat Growth" getstatint 1 + me @ "TotalJP" getstatint 3000 lesser 200 / 1 for var stat begin random 8 % case 0 = when "Strength" end 1 = when "Willpower" end 2 = when "Intelligence" end 3 = when "Perception" end 4 = when "Dexterity" end 5 = when "Magery" end 6 = when "Stamina" end 7 = when "Charisma" end endcase stat ! me @ stat @ getstatint 24 me @ "Learn Cap/" stat @ strcat getstatint + > me @ stat @ getstatint 5 < or if continue else break then repeat me @ stat @ getstatint 1 + me @ stat @ rot setstat str "Your " stat @ " increases!!" cat "Growth" pretty .tell me @ "Stat Growth" me @ "TotalJP" getstatint 3000 lesser 200 / setstat repeat ; : ranked-refresh ( -- ) var tot var max var min var z var spam param @ "spam" instring if 1 spam ! then me @ "totaljp" getstatint dup max ! tot ! me @ "Jnote" "Job Oriented" findboxitem if max @ 2 / me @ "Ranked JP" rot setstat exit then var skill me @ "@rp/Special/" array_get_propvals foreach var val toint val ! skill ! val @ me @ "Learn Cap/Special/" skill @ strcat getstatint - val ! rpsys "Cost/" skill @ strcat getpropstr tofloat 1.0 + 4 * skill @ "Aptitude" smatch if 4 * 6 / then ( rpsys "Talents/" skill @ strcat "/Shock" strcat getpropstr toint if ) 3 * 4 / ( then ) 0 round dup z ! val @ * min @ + min ! spam @ if str "The special of " skill @ " costs " z @ " per point and you have " me @ "Special/" skill @ strcat getstatint " points for a total of " z @ me @ "Special/" skill @ strcat getstatint * " points." cat .tell then repeat me @ "@rp/Craft/" array_get_propvals foreach var val toint val ! skill ! val @ not if continue then 2 dup z ! val @ * min @ + min ! spam @ if str "The synth skill of " skill @ " costs " z @ " per point and you have " me @ "Craft/" skill @ strcat getstatint " points for a total of " z @ me @ "Craft/" skill @ strcat getstatint * " points." cat .tell then repeat me @ "Resources" getstatint val ! "Resources" skill ! val @ 50 - 0 greater val ! 6 dup z ! val @ * min @ + min ! spam @ if str "51+ Resources has a growth cost of " z @ " per point and you have " val @ " points for a total of " z @ val @ * " points." cat .tell then min @ 100 me @ "Special/Aptitude" getstatint 2.0 / - * 100 / min ! min @ max @ lesser min ! force_level not if "Minimum ranked JP due to specials: " min @ tostr strcat .tell then rpsys "Skill/" array_get_propdirs foreach skill ! pop tot @ me @ skill @ getstatint 0 greater 2 * - tot ! me @ str "@rp/" skill @ "/" cat array_get_propvals foreach toint tot @ swap - tot ! pop repeat repeat force_level not if "Total JP gained: " max @ tostr strcat .tell "Calculated Ranked Points: " tot @ tostr strcat .tell then tot @ max @ 2 / greater min @ greater tot ! me @ "Ranked JP" tot @ setstat str "Rankable JP: " tot @ cat struct ! min @ max @ 2 / < not if me @ "Special Overload" 1 setstat else me @ "Special Overload" 0 setstat then ; : heat rpsys "bmaterials/" array_get_propdirs foreach var cur cur ! pop me @ cur @ getstatint if (You have something naughty!!) me @ str "Illegals/" time @ "/Desc" cat str "Sold " target @ " on " "%a %b %e" time @ timefmt cat setstat me @ str "Illegals/" time @ "/Heat" cat rpsys str "bmaterials/" cur @ "/heat" cat getprop toint me @ cur @ getstatint 5 / + setstat me @ str "Illegals/" time @ "/Duration" cat 86400 setstat me @ str "Illegals/" time @ "/Obfuscation" cat 16 setstat me @ str "Illegals/" time @ "/Skill" cat "Streetwise/Black Market" setstat then repeat ; $undef jp : mageguild var target me @ "Totaljp" getstatint #0 "JP Cap" getstatint < not me @ "Jnote" "Job Oriented" findboxitem not and if exit then 0 var! tot me @ "@rp/Special/" array_get_propvals foreach toint var! val var! stat rpsys { "Talents/" stat @ "/Shock" }cat getpropstr not if continue then val @ rpsys { "Cost/" stat @ }cat getpropstr tofloat 1.0 + * tot @ + tot ! repeat me @ "Resources/Mage Guild" getstatint var! res res @ not if exit then me @ "Studying Spell" getstatstr "0" smatch me @ "Special/" me @ "Studying Spell" getstatstr strcat getstatint me @ "Resources/Mage Guild" getstatint > or me @ "Cancel Study" getpropstr or if me @ "Cancel Study" "" setprop begin rpsys "talents/" array_get_propdirs dup array_count random swap % array_getitem target ! me @ "Special/" target @ strcat getstatint me @ "Resources/Mage Guild" getstatint > if continue then rpsys { "Cost/" target @ }cat getpropstr tofloat tot @ 150.0 / > if continue then rpsys "Talents/" target @ strcat "/Requirement" strcat getpropstr dup not if pop else me @ "Talents/" rot strcat getstatint me @ "Talents/" target @ strcat getstatint dup var! curval < if continue then then 0 var! found me @ jobtree foreach var! val var! job job @ "*spent" smatch if continue then rpsys { "Jobs/" job @ "/Special" }cat getpropstr ":" explode_array foreach "/" split toint var! max var! cur pop cur @ target @ smatch not if continue then curval @ max @ < if 1 found ! break then repeat found @ if break then repeat found @ not if continue then rpsys "Talents/" target @ strcat "/shock" strcat getpropstr if break else continue then repeat target @ var! spell me @ "Studying Spell" spell @ setstat me @ "Mage Guild JP" 0 setstat str "New Mage Guild Class: " spell @ cat "MAGE GUILD" pretty tellme else me @ "Studying Spell" getstatstr spell ! then res @ 0.15111111 * me @ "Jnote" "Static" findboxitem if 10 / then me @ "Mage guild JP" getstatfloat + dup var! jp me @ "Mage Guild JP" rot setstat rpsys "Cost/" spell @ strcat getprop tofloat 1.0 + 4 * var! cost jp @ cost @ < if str "You continue studying " spell @ ". To cancel this class, type @set me=Cancel Study:Yes" cat .tell else me @ "Universal JP" getstatfloat cost @ 10.0 / < if str "You need " cost @ 10.0 / 2 fchop " uJP to complete studying. You gain " res @ 0.15111111 * 2 / 2 round " uJP from this resource." cat "MAGE GUILD" pretty tellme me @ "Universal JP" getstatfloat res @ 0.11111111 * 2 / + me @ "Universal JP" rot setstat else str "You complete studying " spell @ "." cat "MAGE GUILD" pretty tellme me @ "Universal JP" getstatfloat cost @ 10.0 / - me @ "Universal JP" rot setstat 0 var! found me @ jobtree foreach var! val var! job job @ "*spent" smatch if continue then rpsys { "Jobs/" job @ "/Special" }cat getpropstr ":" explode_array foreach "/" split toint var! max var! cur pop cur @ spell @ smatch not if continue then me @ "Special/" spell @ strcat getstatint max @ < if 1 found ! break then repeat found @ if break then repeat found @ if me @ { "Jobs/" job @ }cat cost @ adjstat me @ { "Jobs/" job @ "spent" }cat cost @ adjstat then me @ "Special/" spell @ strcat getstatint 1 + dup 4 > if me @ "Studying Spell" 0 setstat else me @ "Mage Guild JP" 0 setstat then me @ "Special/" spell @ strcat rot setstat then then ; : rescycle { "People" "Real Estate" "Smuggler" "Ship" "Refinery" "Gem Mine" "Forest" "Mine" "Industry" "Farm" "University" }list foreach var! res pop me @ "Resources/" res @ strcat getstatint var! val val @ not if continue then 0 var! done res @ case "University" smatch when me @ "Totaljp" getstatint #0 "JP Cap" getstatint < not me @ "Jnote" "Job Oriented" findboxitem not and if #21 { "+Radjust " me @ name "=University=0" }cat force break then me @ "Universal JP" getstatfloat val @ 0.111111111 2 / * me @ "Jnote" "Static" findboxitem if 10 / then + me @ "Universal JP" rot setstat str "You gain " val @ 0.111111111 2 / * 2 fchop " uJP from paid training(University)." cat "RESOURCES" pretty .tell 1 done ! end "Ship" smatch when #0 "Shipping Lane Protection" getstatint val @ + dup val ! #0 "Shipping Lane Protection" rot setstat #0 "@rp/Marketplace/" array_get_propvals var! mats random mats @ array_count % var! x mats @ foreach var! amt var! mat amt @ 50 < random 3 % and rpsys { "Materials/" mat @ "/Cost" }cat getpropstr toint and if break else continue then x @ 0 < until amt @ 50 < if rpsys str "Materials/" mat @ "/Cost" cat getpropstr toint dup var! matval 10 / val @ DEBUG_LINE > not if ( Shuffle time! ) ( Find a material in excess ) "" var! highmat 0 var! highamt mats @ foreach var! amt2 var! mat2 var highval rpsys str "Materials/" mat2 @ "/Cost" cat getpropstr toint var! matval2 matval2 @ not if continue then amt2 @ 150 > not if continue then amt2 @ highamt @ > if amt2 @ highamt ! mat2 @ highmat ! matval2 @ highval ! then repeat highmat @ if highmat @ mat2 ! highamt @ amt2 ! amt2 @ 150 - dup var! loss highval @ 6 * 5 / * var! difference #0 "Marketplace/" mat2 @ strcat 150 setstat difference @ matval @ / var! gain amt @ gain @ + amt ! #0 "Marketplace/" mat @ strcat amt @ setstat str "Shipping Lanes trade " loss @ 2 fchop " units of " mat2 @ " for " gain @ " units of " mat @ "." cat "SHIPPING LANE" pretty dup .tell #21 swap "market " swap strcat force val @ matval @ 10 / - val ! #0 "Shipping Lane Protection" val @ setstat then then then 1 done ! end "Smuggler" smatch when #0 "Smuggling" getstatint val @ + dup val ! #0 "Smuggling" rot setstat #0 "@rp/bMarketplace/" array_get_propvals var! mats random mats @ array_count % var! x mats @ foreach var! amt var! mat amt @ 50 < random 3 % and rpsys { "Materials/" mat @ "/Cost" }cat getpropstr toint and if break else continue then x @ 0 < until amt @ 50 < if rpsys str "bMaterials/" mat @ "/Cost" cat getpropstr toint dup var! matval 10 / val @ > not if ( Shuffle time! ) ( Find a material in excess ) #0 "@rp/Marketplace/" array_get_propvals mats ! "" var! highmat 0 var! highamt mats @ foreach var! amt2 var! mat2 rpsys str "Materials/" mat2 @ "/Cost" cat getpropstr toint var! matval2 matval2 @ not if continue then amt2 @ 150 > not if continue then amt2 @ highamt @ > if amt2 @ highamt ! mat2 @ highmat ! matval2 @ highval ! then repeat highmat @ if highmat @ mat2 ! highamt @ amt2 ! amt2 @ 150 - dup var! loss highval @ * var! difference #0 "Marketplace/" mat2 @ strcat 150 setstat difference @ matval @ / var! gain amt @ gain @ + amt ! #0 "bMarketplace/" mat @ strcat amt @ setstat str "Smuggling trade " loss @ 2 fchop " units of " mat2 @ " for " gain @ " units of " mat @ "." cat "SMUGGLING" pretty dup .tell #21 swap "market " swap strcat force val @ matval @ 10 / - val ! #0 "Smuggling" val @ setstat then then then 1 done ! end endcase done @ if continue then val @ res @ "gem mine" smatch if 2 * then res @ "People" smatch if me @ "Special/Workforce" getstatint dup if 5 greater then * 25 / then 50 * me @ "Market Credit/" res @ strcat getstatint + dup var! credit res @ case "People" smatch me @ "special/Workforce" getstatint and when { me @ "People Resource" getpropstr dup not if "@set me=People Resource:commodity" .tell pop "Water" then }list end "Forest" smatch when { "Wood" "Wood" "Paper" "Leather" }list end "Gem Mine" smatch when { "Gems" "Crystal" "Diamonds" }list end "Mine" smatch when { "Iron" "Coal" "Copper" }list end "Farm" smatch when { "Dull Food" "Average-Food" "Wine" "Chocobo" }list end "Industry" smatch when { "Chemicals" "Gunpowder" "Rare Metals" }list end "Refinery" smatch when { "Steel" "Mythril" "Adamant" }list end "Real Estate" smatch #0 "Marketplace/Water" getstatint 250 < and when { "Water" "Water" }list end pop 1 when { }list end endcase dup array_count not if pop continue else dup array_count var! max me @ "Rescycle/" res @ strcat getstatint array_getitem var! mat then rpsys str "Materials/" mat @ "/cost" cat getprop toint var! mult credit @ mult @ < not if credit @ mult @ / 1 greater var! amount me @ mat @ getstatint amount @ + me @ mat @ rot setstat #0 "Marketplace/" mat @ strcat getstatfloat amount @ 3 * 2 / + #0 "Marketplace/" mat @ strcat rot setstat credit @ mult @ amount @ * - credit ! str "You gain ^green^" amount @ " X " mat @ "^normal^!" cat "RESOURCES" pretty tellme me @ "Rescycle/" res @ strcat getstatint 1 + dup max @ < not if pop 0 then me @ "Rescycle/" res @ strcat rot setstat else res @ "people" smatch me @ "Special/workforce" getstatint 0 > and if { "Your work force continues labor on " mat @ ".(" credit @ "/" mult @ ")" cat "RESOURCES" pretty tellme then then me @ "Market Credit/" res @ strcat credit @ setstat repeat ; : main ( -- ) var repeater dup param ! systime me @ location "ATB Last" getstatint - 60 60 * < if exit then ( Check if finished, die if not chargenned ) me @ "Background" getstatstr "0" smatch not if me @ "Finish" 1 setstat me @ "Human Quickbg" getstatint not me @ "Race" getstatstr "human" instring and if me @ "Human Quickbg" 1 setstat "You receive perk points for being a quickBGed human." .tell me @ "Perks" getstatint 2 me @ "Race" getstatstr "pure" instring if 2 + then + me @ "Perks" rot setstat then then me @ "Finish" getstatint not if "You have not finished chargen, no refresh." "REFRESH" pretty tellme exit then me @ "Approved?" getstatint if me @ "Caste" getstatint 0 = me @ "Resources" getstatint 29 > and if me @ "Caste" 1 setstat "Caste upgraded to Businessman due to wealth." .tell then me @ "Caste" getstatint 1 = me @ "Resources" getstatint 59 > and if me @ "Caste" 6 setstat "Caste upgraded to Wealthy due to wealth." .tell then me @ "Growth" getstatint 0 > if me @ "Growth" getstatint 20 me @ "Meritpoints" getstatint - lesser 0 greater 10 * me @ "Jnote" "Well Learned" findboxitem if 2 * then me @ "Retirement JP" getstatint - 0 greater me @ "Universal JP" getstatfloat + me @ "Universal JP" rot setstat me @ "Growth" 0 setstat "Remaining merit points converted to uJP." .tell then me @ "Jnote" "Aphasic" findboxitem not if me @ "Linguistics/Valente" getstatint 10 greater me @ "Linguistics/Valente" rot setstat then #0 "Max JP" getstatint 5 / me @ "Jnote" "Well Learned" findboxitem if 200 + then me @ "Totaljp" getstatfloat - me @ "Universal JP" getstatfloat - dup 0 < systime me @ "Last Awesome" getstatint - 30 days < or if pop else me @ "Last Awesome" systime setstat var! amount { "You gain " amount @ " uJP to remain at least 20% of the top JP score." }cat .tell me @ "Universal JP" amount @ adjstat then then stat-refresh "Growth" refresh-report ( Increase stats +1 per 200 JP ) force_level not if ranked-refresh "Ranked" refresh-report (Figure out their JP for ranking ) then me @ "iclocal" getstatint not me @ "Level" getstatint nextlevel me @ "level" getstatint < if ( Gained a level ! ) str "You have grown! You are now level " me @ "Level" getstatint "!" cat "Level" pretty .tell then me @ "Perks" getstatint begin me @ "lastfive" getstatint me @ "Level" getstatint swap - 4 > if me @ "Lastfive" getstatint 5 + 5 / me @ "Perks" getstatint + me @ "Perks" rot setstat me @ "Lastfive" getstatint 5 + me @ "Lastfive" rot setstat else break then 0 until me @ "Perks" getstatint swap - dup if "You gain " swap intostr strcat " Perk points!" strcat "Level" pretty .tell then me @ "Adventuring Group" getstatstr dup "0" smatch if pop else group ! then ( Make it slower for non-players. ) systime me @ "Last Cycle" getstatint - 86400 3 * 4 / me @ player? not if 3 * then < if systime me @ "Last Cycle" getstatint - dup 86400 3 * 4 / me @ player? not if 3 * then swap - timex str swap "^GREEN^" swap "^ ^ until your next refresh." cat "REFRESH" pretty tellme exit else me @ "RPXP" getstatfloat me @ "RPJP Stash" getstatfloat + 0.41 < systime me @ "Last Cycle" getstatint - 86400 4 * < not and if force_level not if "RP in a public place to refresh." .tell then exit then then me @ "Player Account" getstatstr "0" smatch if "Please type +register and link this character to a player account. You cannot +refresh until then." .tell exit then systime me @ "Last Cycle" getstatint - 1 days < force_level and if me @ "Refresh Notice" getstatint not if "You can refresh now, but you are early. Type +refresh whenever you'd like to refresh. It is advised you +refresh before you have to go for the day." .tell me @ "Refresh Notice" 1 setstat then exit then systime me @ "Last Cycle" getstatint - 1 days < force_level not and if { "You have " systime me @ "Last Cycle" getstatint - 1 days swap - timex " before your natural point of refresh. Do you want to refresh now?" }cat .tell read tolower "{y|yes}" smatch not if "aborting." .tell exit then then me @ "Refresh Notice" 0 setstat systime me @ "True Cycle" getstatint dup not if pop me @ "Last Cycle" getstatint then - 86400 - 86400.0 / dup 10 > if pop 10 then me @ "Bonus JP" rot setstat me @ "approved?" getstatint not or if me @ "iclocal" 0 setstat "You must be approved and have been on the grid to refresh." "REFRESH" pretty tellme exit then me @ "Theme Agree" getstatint not if "You have not agreed to theme, no refresh.(Type +theme)" "REFRESH" pretty tellme exit then me @ "Last Cycle" systime setstat me @ "True Cycle" systime setstat systime me @ "Weekly Refresh" getstatint - 604800 > if me @ "Refreshes" 0 setstat then me @ "Refreshes" getstatint 6 > if "You can only refresh 7 times a week." .tell exit then me @ "+job" force me @ "Ranked JP" getstatint dup #0 "Max JP" getstatint > not me @ mlevel 3 > or if pop else #0 "Max JP" rot setstat #0 "JP Leader" me @ name setstat "You are the game leader in JP!" .tell then ( begin refresh ) init-refresh "Refresh" header tellme ( Pre-module refresh ) folklore-refresh "Folk-lore" refresh-report ( Attempt to give cap in Folk-lore ) me @ "lorecatchup" getstatint not if 0 repeater ! else 29 repeater ! then begin lore-refresh "Lore" refresh-report ( Attempt to give cap in Lore ) repeater @ 1 + repeater ! repeater @ 30 = until me @ "lorecatchup" 1 setstat me @ "Herbing Times" 0 setstat me @ "Hunting Times" 0 setstat ranked-refresh "Ranked" refresh-report (Figure out their JP for ranking ) me @ "Mutantslots" getstatint if ( Mutant! ) mutant-refresh "Mutant" refresh-report ( Handle possible mutant slot shuffling ) then study-refresh "Study" refresh-report ( Update that which you are studying ) Ammo-Refresh "ARMs" refresh-report ( Restock the ARMs ) lifestyle-refresh "Lifestyle" refresh-report ( Give or take gil according to study ) rental-refresh "Rental" refresh-report ( Pay for owned room and hubs ) me @ "randompoints" getstatint 3 * 4 / me @ "Randompoints" rot setstat market-refresh "Market" refresh-report ( Charge gil for storage of excess ) materials-refresh "Materials" refresh-report ( Attempt to refresh materials ) hp-refresh "HP" refresh-report ( Attempt to regenerate HP ) xp-refresh "JP" refresh-report ( Calculate and add XP ) mentor-refresh "Mentor" refresh-report ( Automated basic skill mentoring ) monthly-refresh "Monthly" refresh-report ( Figure out where skills are ) mageguild rescycle me @ "zombie" flag? if nonmon-refresh "Non-Monster" refresh-report ( Non-Monster Stuff ) then ( affinity-refresh "Affinity" refresh-report ) condition-refresh "Health" refresh-report me @ "Lifepath" getpropstr toint 0 > if lifepath-refresh "Lifepath" refresh-report ( Automated Life Paths ) random 5 % not if lifepath-refresh "Lifepath" refresh-report then then me @ "Ranked JP" getstatint dup #0 "Max JP" getstatint > not me @ mlevel 3 > or if pop else #0 "Max JP" rot setstat #0 "JP Leader" me @ name setstat "You are the game leader in JP!" .tell then me @ "Judge" getstatint if me @ "+pj #refresh" force then depth 1 swap 1 for pop pop repeat me @ "Refund Points" getstatfloat 1.0 me @ "Age" getstatstr case "Old" smatch random 2 % and when 1.0 + "You gain an additional refund point for your age." .tell end "Ancient" smatch when 1.0 + "You gain an additional refund point for your age." .tell end pop 1 when 0.0 + end endcase random 30 % me @ "Special/Aptitude" getstatint < if 1 + "You gain an additional refund point from Aptitude." .tell then me @ "Totaljp" getstatint #0 "JP Cap" getstatint < not me @ "Jnote" "Job Oriented" findboxitem not and if 1 + "You gain an additional refund point for being at the JP cap." .tell then + 50.0 lesser dup me @ "Refund Points" rot setstat { "You have " rot toint " +Refund points available." }cat .tell me @ "MPspent" 0 setstat finish-refresh "SC: Heart of the Empire" footer tellme ( Post-module refresh ) me @ "Harvested?" 0 setstat me @ "PJReward" getstatfloat 1.0 - dup -3 < if 1 var! adv then -3.0 greater me @ "PJReward" rot setstat adv @ me @ "Jnote" "Adventurer" findboxitem dup tostr debug and if me @ "Gil" 30 adjstat "You gain 30 gil from being an adventurer." .tell then me @ "Jobswitch" 0 setstat me @ "Fishing Times" 0 setstat me @ "GadgetWorkLock" 0 setstat me @ "Synth Refresh" 0 setstat me @ "Sellcycle" 0 setstat me @ "Last Researched" 0 setstat me @ "Gardened?" 0 setstat me @ "Refreshes" getstatint 1 + me @ "Refreshes" rot setstat ;