@program #5050 1 10000 d i $libdef Find_Cost $include $lib/alynna $include $muf/cron $include #2123 $include $lib/rp $include $muf/rp/boxutils $include $muf/rp/utils lvar multiples lvar rework lvar baked? lvar qualmod lvar xp? lvar skill lvar quiet lvar xchamber $def rpsys "$rpsystem" match $def myMP me @ GetMaxMP me @ "mpspent" getstatfloat - : find-max ( d s -- i ) var target var prop var toggle var cur prop ! target ! 1 9999 1 for cur ! target @ str "@rp/" prop @ "/" cur @ "/" cat propdir? not if toggle @ ++ toggle ! then toggle @ 5 > until cur @ ; : array_put_proplist ( d s a -- ) swap "#" strcat over foreach 3 pick "/" strcat rot ++ intostr strcat 5 pick swap rot setprop repeat swap array_count intostr setprop ; : array_get_proplist ( d s -- a ) "#" strcat 2 dupn getprop dup string? if atoi then 0 array_make 1 rot 1 for intostr 3 pick "/" strcat swap strcat 4 pick swap getprop swap array_appenditem repeat -3 rotate pop pop ; : greater ( i i -- i ) over over <= if swap then pop ; : lesser ( i i -- i ) over over >= if swap then pop ; : israwsynth?[ string:synth -- int:mytails ] { synth @ ":" explode_array foreach swap pop "/" split pop repeat }array foreach swap pop var! curr rpsys { "materials/" curR @ "/cost" }cat getprop not if 0 exit then repeat 1 ; : synth2dict[ string:synth -- dict:result ] { synth @ ":" explode_array foreach swap pop "/" split atoi repeat }dict ; : elementcolor ( s -- s ) var target target ! target @ not if exit then target @ case "earth" smatch when "^yellow^" end "white" smatch when "^white^" end "black" smatch when "^gloom^" end "water" smatch when "^blue^" end "wind" smatch when "^green^" end "fire" smatch when "^red^" end "lightning" smatch when "^cyan^" end "ice" smatch when "^aqua^" end endcase target @ strcat "^normal^" strcat ; : recipefind ( s -- s ) var target var result var element var cur var cur2 var number var materials dup swap strip swap me @ "Craft Practice/" rot strcat getstatint if capitalize exit then ":" split strip "+" explode array_make target ! strip element ! element @ not if "" exit then rpsys "recipes/" array_get_propdirs foreach cur ! pop rpsys str "recipes/" cur @ "/element" cat getpropstr element @ stringcmp not if ( Element match ) rpsys str "recipes/" cur @ "/materials" cat getpropstr dup not if cur @ " has no materials!" strcat debug then ":" explode array_make dup materials ! foreach swap pop "/" split atoi dup not if pop 1 then number ! cur2 ! 0 target @ foreach swap pop cur2 @ stringcmp not if 1 + then 0 until number @ = not if ( Oops, not this recipe, move on) -1 number ! break then 0 until ( Scanned recipe, looks ok ) target @ dup array_union array_count materials @ array_count = not if -1 number ! then number @ -1 = if ( oops, it's all bad ) continue then cur @ result ! break else continue then ( Element Not Found, let's continue on ) 0 until .debug-off result @ dup string? if capitalize then ; : check-materials ( s -- i i ) var target var cur var cur2 var num var found? var number var cur3 var amountUsed target ! 1 found? ! .debug-off rpsys "recipes/" target @ strcat "/materials" strcat getpropstr rework @ if pop target @ "/1" strcat then ":" explode array_make foreach cur ! pop cur @ "/" split atoi dup not if pop 1 then number ! cur ! me @ str "Fish/" cur @ cat getstatint number @ < not if continue then me @ str "Hunt/" cur @ cat getstatint number @ < not if continue then rpsys str "Materials/" cur @ "/cost" cat getprop rpsys str "bMaterials/" cur @ "/cost" cat getpropstr or if ( It's a market good ) me @ "@rp/" cur @ strcat getpropval number @ < not if ( Have enough) continue else str "You appear to be lacking enough " cur @ " to make the item." cat quiet @ if pop else .tell then 0 found? ! break then else 1 baked? ! 0 cur2 ! 0 amountUsed ! me @ "@/~rp/boxes/gear/" array_get_propdirs foreach tostr cur3 ! pop me @ "@/~rp/boxes/gear/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not if (Old line: cur2 @ ++ cur2 !) (Change by Chinthliss to hopefully allow for quantities) me @ "gear" cur3 @ atoi getBoxQuantity (Work out how many we need to use) number @ cur2 @ - over - dup 0 < if + else pop (Use all available!) then cur2 @ over + cur2 ! AmountUsed ! (This varible can be used for modifiers) (amountUsed @) 0 if "Considering using x" amountUsed @ intostr strcat " of gear item " strcat cur3 @ strcat " : " strcat me @ "gear" cur3 @ atoi "name" getBoxProp strcat "(" strcat me @ "gear" cur3 @ atoi "quality" getBoxProp strcat ")" strcat .tell then (Now modify 'num' like the code below used to do) me @ "@/~rp/boxes/gear/" cur3 @ strcat "/Quality" strcat getpropstr case "Poor" stringcmp not when -10 amountUsed @ * num @ + num ! end "Masterpiece" stringcmp not when 5 amountUsed @ * num @ + num ! end endcase then (cur2 @ number @ > not) ( me @ "@/~rp/boxes/gear/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not and if) ( Only count quality up to the number we need) ( me @ "@/~rp/boxes/gear/" cur3 @ strcat "/Quality" strcat getpropstr case) ( "Poor" stringcmp not when -10 num @ + num ! end) ( "Masterpiece" stringcmp not when 5 num @ + num ! end) ( endcase) ( then ) cur2 @ number @ > if break then .debug-off 0 until cur2 @ number @ < if ( Not enough ) me @ "@rp/weapons/" array_get_propdirs foreach tostr cur3 ! pop me @ "@rp/weapons/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not if cur2 @ ++ cur2 ! then cur2 @ number @ < not me @ "@/rp/weapons/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not and if ( Only count quality up to the number we need) me @ "@rp/weapons/" cur3 @ strcat "/Value" strcat getpropstr case "Poor" stringcmp not when -10 num @ + num ! end "Masterpiece" stringcmp not when 5 num @ + num ! end endcase then cur2 @ number @ > if break then 0 until cur2 @ number @ < not me @ "@rp/Armors/" array_get_propdirs foreach tostr cur3 ! pop me @ "@rp/Armors/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not if cur2 @ ++ cur2 ! then cur2 @ number @ < not me @ "@/rp/Armors/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not and if ( Only count quality up to the number we need) me @ "@rp/Armors/" cur3 @ strcat "/Value" strcat getpropstr case "Poor" stringcmp not when -10 num @ + num ! end "Masterpiece" stringcmp not when 5 num @ + num ! end endcase then cur2 @ number @ > if break then 0 until pop cur2 @ number @ < if ( Not enough ) str "You appear to be lacking enough " cur @ " to make the item." cat quiet @ if pop else .tell then 0 found? ! break then then then 0 until ( It passed the test! ) .debug-off num @ found? @ ; lvar totalskills : check-skills ( d s -- i ) var target var cur var num var number var nme target ! nme ! 0 number ! rpsys "recipes/" target @ strcat "/skills" strcat getpropstr ":" explode array_make foreach cur ! pop cur @ "/" split atoi dup totalskills @ + totalskills ! num ! cur ! nme @ "Craft/" cur @ strcat getstatfloat dup num @ < me @ "Craft Raise/" cur @ strcat getstatint systime swap - 3600 24 * 7 * me @ "Special/Synthesization" getstatint 100 swap - * 100 / > and if 1 xp? ! then cur @ "metal" instring if nme @ "Craft/Blades" getstatfloat 4 / 5 / + nme @ "Craft/Smithing" getstatfloat 2 / 5 / + nme @ "Craft/Brawling" getstatfloat 4 / 5 / + then cur @ "Smithing" instring if nme @ "Craft/Metallurgy" getstatfloat 2 / 5 / + nme @ "Craft/Blades" getstatfloat 2 / 5 / + nme @ "Craft/Brawling" getstatfloat 2 / 5 / + then cur @ "Tailor" instring if nme @ "Craft/Leather" getstatfloat 2 / 5 / + nme @ "Craft/Grass" getstatfloat 2 / 5 / + nme @ "Craft/Silk" getstatfloat 2 / 5 / + nme @ "Craft/Cotton" getstatfloat 2 / 5 / + then cur @ "Torso" instring if nme @ "Craft/Metallurgy" getstatfloat 8 / 5 / + nme @ "Craft/Smithing" getstatfloat 3 / 5 / + nme @ "Craft/Tailor" getstatfloat 3 / 5 / + then cur @ "Mechanics" instring if nme @ "Special/Make-Plan" getstatfloat 10 / 5 / + nme @ "Special/Repair" getstatfloat 10 / 5 / + then cur @ "Necromancy" instring if nme @ "Special/Animate-Dead" getstatfloat 10 / 5 / + then cur @ "Precision" instring if nme @ "Craft/Mechanics" getstatfloat 2 / 5 / + then cur @ "Intricate" instring if nme @ "Craft/Jewelry" getstatfloat 2 / 5 / + then cur @ "Grass" instring if nme @ "Craft/Tailor" getstatfloat 2 / 5 / + then cur @ "Silk" instring if nme @ "Craft/Tailor" getstatfloat 2 / 5 / + then cur @ "Blade" instring if nme @ "Craft/Brawling" getstatfloat 8 / 5 / + nme @ "Craft/Metallurgy" getstatfloat 4 / 5 / + nme @ "Craft/Smithing" getstatfloat 2 / 5 / + then nme @ "Professionlist" getstatstr "mastersmith" instring if 0.5 + then nme @ "Professionlist" getstatstr "apprentice" instring if 0.3 + then dup num @ - skill @ dup not if pop else + 2 / then skill ! nme @ "Lore/Elemental Crystals" getstatint 0.01 * + dup num @ > if num @ - 3 * else num @ - 10 * then number @ + number ! 0 until number @ nme @ "Craft Practice/" target @ strip strcat getstatfloat 2 / dup 5 < nme @ "Professionlist" getstatstr "blacksmith" instring and if 5 + 2 / then 5 - + rpsys "recipes/" target @ strcat "/element" strcat getpropstr case "fire" smatch when nme @ "Special/Fire-affinity" getstatint 5 / nme @ "Special/Ice-Affinity" getstatint 5 / - + end "ice" smatch when nme @ "Special/Fire-affinity" getstatint 5 / nme @ "Special/Ice-Affinity" getstatint 5 / swap - + end "Wind" smatch when nme @ "Special/Air-affinity" getstatint 5 / nme @ "Special/Earth-Affinity" getstatint 5 / - + end "Earth" smatch when nme @ "Special/Air-affinity" getstatint 5 / nme @ "Special/Earth-Affinity" getstatint 5 / swap - + end "White" smatch when nme @ "Special/White-affinity" getstatint 5 / nme @ "Special/Black-Affinity" getstatint 5 / - + end "Black" smatch when nme @ "Special/White-affinity" getstatint 5 / nme @ "Special/Black-Affinity" getstatint 5 / swap - + end "Water" smatch when nme @ "Special/Water-affinity" getstatint 5 / nme @ "Special/Lightning-Affinity" getstatint 5 / - + end "Lightning" smatch when nme @ "Special/Water-affinity" getstatint 5 / nme @ "Special/Lightning-Affinity" getstatint 5 / swap - + end endcase toint ; : report-skills ( s -- i ) var target var cur var num var number target ! 0 number ! rpsys "recipes/" target @ strcat "/skills" strcat getpropstr ":" explode array_make foreach cur ! pop cur @ "/" split atoi num ! cur ! str me @ "Craft/" cur @ strcat getstatfloat num @ - case -5 < when "You shiver in fear considering your " cur @ " skill." end -3 < when "You have large fears about your " cur @ " skill." end -1 < when "You have doubts about your " cur @ " skill." end 0 < when "You are confident about your " cur @ " skill." end 3 < when "You are quite ready to use your " cur @ " skill." end 9999 < when "You know your " cur @ " skill will pull you through with ease." end endcase cat .tell 0 until ; : delete-weapon ( d i -- ) var Weapon var Target intostr Weapon ! Target ! Target @ "@rp/weapons/" Weapon @ strcat remove_prop Target @ "@rp/weapons/" array_get_propdirs foreach swap pop dup dup dup Weapon @ stringcmp 0 > if atoi 1 - -3 rotate swap target @ "@rp/weapons/" rot strcat target @ "@rp/weapons/" 5 pick atoi 1 - intostr strcat 1 copyprops pop target @ "@rp/weapons/" rot strcat remove_prop else pop pop then 0 until ; : delete-armor ( d i -- ) var Armor var Target intostr Armor ! Target ! Target @ "@rp/armors/" Armor @ strcat remove_prop Target @ "@rp/armors/" array_get_propdirs foreach swap pop dup dup dup Armor @ stringcmp 0 > if atoi 1 - -3 rotate swap target @ "@rp/armors/" rot strcat target @ "@rp/armors/" 5 pick atoi 1 - intostr strcat 1 copyprops pop target @ "@rp/armors/" rot strcat remove_prop else pop pop then 0 until ; : check-waste ( s -- ) var target var cur var num var number var cur3 var cur2 var deleted 0 array_make deleted ! target ! 50 qualmod @ 2 / - num ! ( chance of destruction per item ) rpsys "recipes/" target @ strcat "/materials" strcat getpropstr rework @ if pop target @ "/1" strcat then ":" explode array_make foreach cur ! pop 0 cur2 ! cur @ "/" split atoi dup not if pop 1 then number ! cur ! random 100 % num @ < if ( Destroy!!! ) me @ str "Fish/" cur @ cat getstatint if ( It's a fish! ) random number @ % 1 + number ! me @ str "Fish/" cur @ cat getstatint number @ - me @ str "Fish/" cur @ cat rot setstat str "You lose ^green^" number @ " " cur @ "^normal^!" cat .tell continue then me @ str "Hunt/" cur @ cat getstatint if ( It's a hunt! ) random number @ % 1 + number ! me @ str "Hunt/" cur @ cat getstatint number @ - me @ str "Hunt/" cur @ cat rot setstat str "You lose ^green^" number @ " " cur @ "^normal^!" cat .tell continue then rpsys str "Materials/" cur @ "/cost" cat getpropstr rpsys str "bMaterials/" cur @ "/cost" cat getpropstr or if ( Market good ) random number @ % 1 + number ! str "You lose ^green^" number @ " units of " cur @ "^normal^!" cat .tell me @ cur @ getstatint number @ - me @ cur @ rot setstat continue else ( Inventory ) str "You lose ^green^" cur @ "^normal^!" cat .tell me @ "Gear" cur @ findboxitem if 1 number @ 1 for me @ "Gear" me @ "Gear" cur @ findboxitem deleteOrDecrementBoxItem 0 until else ( Must be a weapon or armor ) 1 number @ 1 for me @ "@rp/weapons/" array_get_propdirs foreach tostr cur3 ! pop me @ "@rp/weapons/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not if me @ cur3 @ atoi delete-weapon break then 0 until 0 until deleted @ dup not if pop else ( Found weapons, destroy! ) foreach me @ swap delete-weapon pop 0 until then 0 array_make deleted ! 1 number @ 1 for me @ "@rp/armors/" array_get_propdirs foreach tostr cur3 ! pop me @ "@rp/armors/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not if me @ cur3 @ atoi delete-armor break then 0 until 0 until then continue then then 0 until ; : spend-items ( s -- ) ( Same as check-waste, but with the chances rigged to 100% ) var target var cur var num var number var cur2 var found? var cur3 var deleted 0 cur2 ! 0 array_make deleted ! target ! rpsys "recipes/" target @ strcat "/materials" strcat getpropstr rework @ if pop target @ "/1" strcat then ":" explode array_make foreach cur ! pop 0 cur2 ! cur @ "/" split atoi dup not if pop 1 then number ! cur ! 1 if ( Destroy!!! ) me @ str "Fish/" cur @ cat getstatint if ( It's a fish! ) me @ str "Fish/" cur @ cat getstatint number @ - me @ str "Fish/" cur @ cat rot setstat continue then me @ str "Hunt/" cur @ cat getstatint if ( It's a hunt! ) me @ str "Hunt/" cur @ cat getstatint number @ - me @ str "Hunt/" cur @ cat rot setstat continue then rpsys str "Materials/" cur @ "/cost" cat getpropstr rpsys str "bMaterials/" cur @ "/cost" cat getpropstr or if ( Market good ) me @ cur @ getstatint number @ - me @ cur @ rot setstat continue else ( Inventory ) me @ "Gear" cur @ findboxitem if 1 number @ 1 for me @ "Gear" me @ "Gear" cur @ findboxitem deleteOrDecrementBoxItem 0 until else pop ( Must be a weapon or armor ) 1 number @ 1 for 1 me @ "weapons" find-max 1 for tostr cur3 ! me @ "@rp/weapons/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not if me @ cur3 @ atoi delete-weapon break then 0 until 0 until deleted @ dup not if pop else ( Found weapons, destroy! ) foreach me @ swap delete-weapon pop 0 until then 0 array_make deleted ! 1 number @ 1 for 1 me @ "armors" find-max 1 for tostr cur3 ! me @ "@rp/armors/" cur3 @ strcat "/name" strcat getpropstr cur @ stringcmp not if me @ cur3 @ atoi delete-armor break then 0 until 0 until then continue then then 0 until ; : improve-skills var target var cur var num var number var cost target ! 0 number ! multiples @ not if random 3 % random 3 % + 2 / 1 + multiples ! then rpsys "recipes/" target @ strcat "/skills" strcat getpropstr ":" explode array_make foreach cur ! pop cur @ "/" split atoi num ! cur ! me @ "Craft/" cur @ strcat getstatfloat 4.0 / cost ! me @ "XP" getstatfloat me @ "XPSpent" getstatfloat - cost @ < me @ "synth.noskillraise" getstat not and if continue then me @ "Craft/" cur @ strcat getstatfloat dup num @ > if pop else num @ swap - 5 * dup 20 > if pop 20 then me @ "Special/Synthesization" getstatint + me @ "Jobs/Mundane" getstatint 5 + * 5 / cur @ tolower "{necromancy|magic|geomancy}" smatch if me @ "Jobs/Mage" getstatint 5 + * 5 / then cur @ tolower "{traps|drugs|explosives|locks}" smatch if me @ "Jobs/Rogue" getstatint 5 + * 5 / then cur @ tolower "{wood|straw|magic|necromancy}" smatch if me @ "Jobs/Monster" getstatint 10 + * 10 / then cur @ tolower "{gardening|fletching|medicinal|herbalism}" smatch if me @ "Jobs/Acolyte" getstatint 5 + * 5 / then cur @ tolower "{blades|blunts|brawl}" smatch if me @ "Jobs/Fighter" getstatint 10 + * 10 / then cur @ tolower "{grenades|assembly}" smatch if me @ "Jobs/Fighter" getstatint 20 + * 20 / then cur @ "necromancy" stringcmp not me @ "Professionlist" getstatstr "necromancer" instring and if 11 * 10 / then multiples @ 4 + * 5 / random 100 % > systime me @ "Last Craftskill Improve" getstatint - 3600 24 * 3 * > or me @ "Craft Raise/" cur @ strcat getstatint systime swap - 3600 24 * 7 * me @ "Special/Synthesization" getstatint 100 swap - * 100 / > and if ( They increased the skill, rapture ) me @ "Last Craftskill Improve" systime setstat me @ "Crafts/" cur @ strcat getstatint me @ cur @ getstatint greater me @ "Lore/" cur @ strcat getstatint greater me @ "Artistry/" cur @ strcat getstatint greater me @ "Special/" cur @ strcat getstatint greater me @ "Survival/" cur @ strcat getstatint greater me @ "Folk-Lore/" cur @ strcat getstatint greater me @ "Homekeeping/" cur @ strcat getstatint greater me @ "Security/" cur @ strcat getstatint greater me @ "Farming/" cur @ strcat getstatint greater me @ "Science/" cur @ strcat getstatint greater me @ "Crafts" getstatint 5 / greater cur @ "blade" instring if me @ "Crafts/Swords" getstatint greater me @ "Crafts/Daggers" getstatint greater me @ "Crafts/Long Swords" getstatint 5 / + me @ "Crafts/Small Swords" getstatint 5 / + me @ "Crafts/Melee" getstatint 10 / + then cur @ "Fletch" instring if me @ "Crafts/Bows" getstatint greater me @ "Crafts/Ranged" getstatint greater me @ "Crafts/Crossbows" getstatint greater then cur @ "Necromancy" instring if me @ "Special/Animate-Dead" getstatint 4 * 3 / greater then cur @ "Mechanics" instring if me @ "Special/Make-Plan" getstatint greater me @ "Special/Repair" getstatint greater then cur @ "Smith" instring if me @ "Crafts/metallurgy" getstatint 2 / greater me @ "Crafts/metal" getstatint greater me @ "Science/Metallurgy" getstatint 2 / greater me @ "Lore/Metallurgy" getstatint 2 / greater me @ "Craft/Metallurgy" getstatint 5 * 4 / greater then cur @ "gear" instring if me @ "Crafts/Geartech" getstatint greater me @ "Science/Geartech" getstatint greater then cur @ "magic" instring if me @ "Arcana" getstatint 5 / greater me @ "Jobs/Mage" getstatint 2 * greater then cur @ "Spear" instring if me @ "Craft/Spears" getstatint greater me @ "Crafts/Melee" getstatint 5 / + me @ "Crafts/Pole Arms" getstatint 3 / + then cur @ "Farming" instring if me @ "Housekeeping/Gardening" getstatint greater me @ "Farming/Gardening" getstatint greater me @ "Farming" getstatint 3 / greater then cur @ tolower "{necromancy|magic|geomancy}" smatch if me @ "Jobs/Mage" getstatint 10 + * 10 / then cur @ tolower "{traps|drugs|explosives|locks}" smatch if me @ "Jobs/Rogue" getstatint 10 + * 10 / then cur @ tolower "{wood|straw|magic|necromancy}" smatch if me @ "Jobs/Monster" getstatint 20 + * 20 / then cur @ tolower "{gardening|fletching|medicinalherbalism}" smatch if me @ "Jobs/Acolyte" getstatint 10 + * 10 / then cur @ tolower "{blades|blunts|brawl}" smatch if me @ "Jobs/Fighter" getstatint 20 + * 20 / then cur @ tolower "{grenades|assembly}" smatch if me @ "Jobs/Fighter" getstatint 40 + * 40 / then cur @ "necromancy" stringcmp not me @ "Professionlist" getstatstr "necromancer" instring and if 22 * 20 / then 5 * 100 + random 50 me @ "Special/Synthesization" getstatint + % 1 + * 2 * 100000.0 / multiples @ * me @ "XP" getstatfloat me @ "XPSpent" getstatfloat - 1 < not if 0 if me @ "XPSpent" getstatfloat 1 + me @ "XPSPent" rot setstat 2 * dup 0.1 < if pop 0.1 then then then var am dup 0.2 > if 0.2 + 2 / then me @ "Craft/" cur @ strcat getstatint dup 11 < if pop else / 10 * then dup 1.0 > if pop 1.0 then dup am ! me @ "Craft/" cur @ strcat getstatfloat + me @ "Craft/" cur @ strcat getstatint over int < if ( Increased ) me @ "Craft Raise/" cur @ strcat systime setstat then me @ "Craft/" cur @ strcat rot setstat me @ "XPSpent" getstatfloat cost @ + me @ "XPSpent" rot setstat str "Your skill in ^green^" cur @ "^normal^ increased .. " "(^green^" am @ 2 round " ^normal^- ^yellow^" me @ "Craft/" cur @ strcat getstatfloat 2 round "^normal^) for ^YELLOW^" cost @ 2 round "^NORMAL^XP!" cat .tell then then 0 until ; : find-space ( d -- i ) var target var x var ok? target ! 1 x ! 0 ok? ! begin target @ "Weapons/" x @ intostr strcat "/name" strcat getstatstr "0" smatch if 1 ok? ! then ok? @ not if x @ 1 + x ! then ok? @ until x @ ; : find-aspace ( d -- i ) var target var x var ok? target ! 1 x ! 0 ok? ! begin target @ "Armors/" x @ intostr strcat "/name" strcat getstatstr "0" smatch if 1 ok? ! then ok? @ not if x @ 1 + x ! then ok? @ until x @ ; : make-item ( s:target -- i:exit-code ) var target var mp? var chamber 0 chamber ! target ! var insurance me @ "Synth Busy" getstatint systime > if "You are busy synthesizing. Try again in a moment." .tell 0 exit then me @ "Synth Points" getstatfloat 0 > not if me @ "MPSpent" getstatfloat me @ maxmp swap - 20 >= if 1 mp? ! else "You're worn out from synthesizing today, wait until tommorow(IC time)." "Synthesize" pretty tellme -1 exit then then target @ recipefind dup not if pop str target @ " does not seem to actually create anything." cat .tell exit then target ! { "You sit down and try to make " target @ strip ", concentrating intently on the materials and the crystal hovering in front of you." }cat .tell target @ check-materials not if pop exit else qualmod ! then me @ target @ check-skills qualmod @ + qualmod ! target @ report-skills mp? @ not me @ "Gear" "Synthesis Chamber" findboxitem if "Synthesis chamber found, do you wish to use it? It will cause additional drain, lowering the amount of synths you can perform today.(y/N)" .tell read "y" instring if me @ "Gear" me @ "Gear" "Synthesis Chamber" findboxitem "Quality" getboxprop tostr case "Poor" smatch when 1 chamber ! end "Average" smatch when 2 chamber ! end "Masterpiece" smatch when 3 chamber ! end endcase chamber @ not if 2 chamber ! then then then qualmod @ chamber @ 10 * + qualmod ! me @ "Elemental Crystals" getstatint 0 > if "You may use one of your high quality Elemental Crystals units for an increased chance of favorable results.(Y/n)" .tell read "n" instring not if me @ "Elemental Crystals" getstatint 1 - me @ "Elemental Crystals" rot setstat qualmod @ 10 + qualmod ! then then me @ "Gil" getstatint 9 > rework @ not and if "You may 'insure' your materials against accidental loss due to failure for 10 gil.(y/N)" .tell read "y" instring if me @ "Gil" getstatfloat 10 - me @ "Gil" rot setstat 1 insurance ! then then { "Synth: " target @ }cat header .tell { "Element: " rpsys "Recipes/" target @ strcat "/element" strcat getpropstr elementcolor ", Synthesis chamber: " chamber @ case 1 = when "^RED^Poor^NORMAL^" end 2 = when "^YELLOW^Average^NORMAL^" end 3 = when "^GREEN^Masterpiece^NORMAL^" end default pop "None" end endcase ", Insured: " insurance @ if "^GREEN^Yes^NORMAL^" else "^RED^No^NORMAL^" then }tell { "Chances: " "Success: ^YELLOW^" 80 qualmod @ + dup 80 > if pop 80 then "%^NORMAL^, " "Poor Quality: ^RED^" 10 qualmod @ 0 < if qualmod @ - else qualmod @ 3 / - then dup 1 < if pop 1 then "%^NORMAL^, " "Masterpiece: ^GREEN^" 10 qualmod @ 0 < if pop 1 else qualmod @ 3 / + then me @ "Crafts" getstatint 5 / + dup 30 > if 90 + 4 / then "%" }tell { "Costs: " 1 chamber @ 0.3 * + me @ "Craft Practice/" target @ strip strcat getstatint skill @ 2 * + 200.0 / - dup 0.1 < if pop 0.1 then ( Alynna here again ) rpsys { "Recipes/" target @ "/drain" }cat getprop tofloat dup not if pop 10.0 then 10.0 / * rpsys { "Recipes/" target @ "/Materials" }cat getprop israwsynth? if 0.8 else 1.0 then * 0.1 50.0 limit var! burn mp? @ if { burn @ 20.0 + 2 fchop "MP (" MyMP "->" MyMP burn @ 20.0 + - 2 fchop ")" }cat else { burn @ 2 fchop " synth points (" me @ "Synth Points" getstat 2 fchop "->" me @ "Synth Points" getstat burn @ - 0.0 99.9 limit 2 fchop ")" me @ "Synth Points" getstat burn @ < if { ", ^RED^and " me @ "Synth Points" getstat burn @ - -1 * 10.0 + 2 fchop "MP.^NORMAL^" }cat then }cat then }tell "-----------------------------------------------------------------------------" .tell me @ "_prefs/nosynthprompt" getprop not if { "Type N or No to abort, or ENTER to proceed ..." }tell read_wants_blanks read read_wants_blanks "n*" smatch if "Aborted." .tell exit then then chamber @ not if str me @ name " sits down with some things and concentrates intently on a floating, spinning " rpsys "Recipes/" target @ strcat "/element" strcat getpropstr elementcolor " crystal." cat "Synthesis" pretty tellhere else str me @ name " places some things in a large device and concentrates intently on a floating, spinning " rpsys "Recipes/" target @ strcat "/element" strcat getpropstr elementcolor " crystal." cat "Synthesis" pretty tellhere then systime me @ "Last Craftskill Improve" getstatint - 3600 24 * 3 * > not me @ "XP" getstatfloat me @ "XPSpent" getstatfloat - 1 < not me @ "synth.noskillraise" getstat not and and pop 0 if "You are not guaranteed to raise your skills, even if you are making something that would normally qualify, for 0.5XP, you can insure that the next opportunity to raise a skill will work.(y/N)" .tell read "y" instring if me @ "XPSpent" getstatfloat 0.5 + me @ "XPSPent" rot setstat 1 me @ "Last Craftskill Improve" 0 setstat then then rework @ if target @ spend-items then 1 6 1 for multiples ! multiples @ 1 = if random 100 % 80 qualmod @ + dup 80 > if pop 80 then < not if multiples @ 1 - multiples ! break then else me @ "Craft Practice/" target @ strip strcat getstatint dup skill @ 3 * < if 2 else 1 then + me @ "Craft Practice/" target @ strip strcat rot setstat ( They made it, give them a practice point ) random 100 % 10 qualmod @ 0 < if pop 1 else qualmod @ 3 / + then dup 30 > if 90 + 4 / then baked? @ not if 20 + then me @ "Special/W-Craft" getstatint + dup 65 > if pop 65 then > if multiples @ 1 - multiples ! break then then 0 until multiples @ if ( Success ) me @ target @ improve-skills var newdesc var num var quality var qual2 var type rpsys "Recipes/" target @ strcat "/damage" strcat getpropstr strtof dup not if pop else var damage damage ! me @ str "Mix+" me @ "Special/Alchemy" getstatint 2 / me @ "Special/Mix" getstatint 2 / lesser cat roller damage @ * damage ! 1 999 1 for num ! me @ "Craft Practice/" target @ strip strcat getstatint dup skill @ 3 * < if 2 else 1 then + me @ "Craft Practice/" target @ strip strcat rot setstat ( They made it, give them a practice point ) random 100 % 10 qualmod @ 0 < if pop 1 else qualmod @ 3 / + then dup 30 > if 90 + 4 / then baked? @ not if 20 + then me @ "Special/W-Craft" getstatint + dup 65 > if pop 65 then > until random 100 % 10 qualmod @ 0 < if qualmod @ - else qualmod @ 3 / - then dup 1 < if pop 1 then < if ( Poor! ) 1 quality ! else random 100 % 10 qualmod @ 0 < if pop 1 else qualmod @ 3 / + then me @ "Crafts" getstatint 5 / + dup 30 > if 90 + 4 / then < if ( Masterpiece! ) 3 quality ! else ( Average ) 2 quality ! then then quality @ damage @ * dup rpsys "Recipes/" target @ strcat "/damage" strcat getpropstr strtof me @ "Special/Mix" getstatint 5 / * < if pop rpsys "Recipes/" target @ strcat "/damage" strcat getpropstr strtof me @ "Special/Mix" getstatint 5 / * then damage ! str me @ name " creates ^green^" target @ "^normal^ battle mixture! It activates " num @ " times with " damage @ me @ "Level" getstatint 3 * 100 + * 100 / toint " damage." cat "Synthesis" pretty tellhere me @ "Craft Practice/" target @ strip strcat getstatint dup skill @ 3 * < if 2 else 1 then + me @ "Craft Practice/" target @ strip strcat rot setstat ( They made it, give them a practice point ) mp? @ not if me @ "Synth Points" getstatfloat ( Alynna was here, hackin' yer code ) 1 chamber @ 0.3 * + totalskills @ 2 - 0.1 * + me @ "Craft Practice/" target @ strip strcat getstatint skill @ 2 * + 200.0 / - dup 0.5 < if pop 0.5 then ( Specifically, right here ) rpsys { "Recipes/" target @ "/drain" }cat getprop tofloat dup not if pop 10.0 then 10.0 / * - me @ "Synth Points" rot setstat then exit then rpsys "Recipes/" target @ strcat "/Type" strcat getpropstr case "weap" instring when ( Weapon ! ) me @ "Weapons/" me @ find-space dup num ! intostr strcat "/Name" strcat target @ strip setstat 1 type ! end "armor" instring when ( Armor ! ) me @ "armors/" me @ find-aspace dup num ! intostr strcat "/Name" strcat target @ strip setstat 2 type ! end pop 1 when me @ "Gear" target @ strip createboxitem num ! end endcase random 100 % var qualname 10 qualmod @ 0 < if qualmod @ - else qualmod @ 3 / - then dup 1 < if pop 1 then < if ( Poor! ) "You are creating a poor quality item." .tell "Poor" 1 quality ! else random 100 % 10 qualmod @ 0 < if pop 1 else qualmod @ 3 / + then me @ "Crafts" getstatint 5 / + dup 30 > if 90 + 4 / then < if ( Masterpiece! ) "You are creating a high quality item, it's a masterpiece!" .tell "Masterpiece" 3 quality ! else ( Average ) "You are creating an average item." .tell "Average" 2 quality ! then then qualname ! str me @ name " creates " multiples @ " " quality @ 1 = if "Poor " else quality @ 2 = if "Average " else "Masterpiece " then then target @ multiples @ 1 > if "s" then "." cat debug rpsys "Recipes/" target @ strcat "/desc" strcat getpropstr "You may enter an additional bit of desc to personalize your item. Just hit ENTER to have no additional description." .tell read_wants_blanks read read_wants_blanks strip dup not if pop else " {Additional Desc: " swap strcat "}" strcat strcat then newdesc ! { "Description entered." }tell 1 multiples @ 1 for multiples ! multiples @ 1 = not if ( create the box item ) rpsys "Recipes/" target @ strcat "/Type" strcat getpropstr case "weap" instring when ( Weapon ! ) me @ "Weapons/" me @ find-space dup num ! intostr strcat "/Name" strcat target @ strip setstat 1 type ! end "armor" instring when ( Armor ! ) me @ "armors/" me @ find-aspace dup num ! intostr strcat "/Name" strcat target @ strip setstat 2 type ! end pop 1 when me @ "Gear" target @ strip createboxitem num ! end endcase then me @ "Gear" num @ "Quality" qualname @ setboxprop type @ if qualname @ qual2 ! then me @ "Gear" num @ "Desc" newdesc @ type @ 1 = if swap pop swap pop swap pop swap pop me @ str "Weapons/" num @ "/Desc" cat rot setstat else type @ 2 = if swap pop swap pop swap pop swap pop me @ str "Armors/" num @ "/Desc" cat rot setstat else setboxprop then then type @ 1 = if rpsys "Recipes/" target @ strcat "/Accuracy" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "Weapons/" num @ "/Accuracy" cat rot setstat rpsys "Recipes/" target @ strcat "/WElement" strcat getpropstr dup not if "Physical" then "/" explode array_make dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "Weapons/" num @ "/Element" cat rot setstat rpsys "Recipes/" target @ strcat "/Skill" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "Weapons/" num @ "/Skill" cat rot setstat rpsys "Recipes/" target @ strcat "/Strength" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "Weapons/" num @ "/Strength" cat rot setstat rpsys "Recipes/" target @ strcat "/WP" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "Weapons/" num @ "/WP" cat rot setstat rpsys "Recipes/" target @ strcat "/WType" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "Weapons/" num @ "/Type" cat rot setstat rpsys "Recipes/" target @ strcat "/Status" strcat getpropstr dup not if pop "None" then "/" explode array_make dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "Weapons/" num @ "/Status" cat rot setstat rpsys "Recipes/" target @ strcat "/Subskill" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "Weapons/" num @ "/Subskill" cat rot setstat qual2 @ me @ str "Weapons/" num @ "/Value" cat rot setstat then type @ 2 = if rpsys "Recipes/" target @ strcat "/Accuracy" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "armors/" num @ "/Accuracy" cat rot setstat rpsys "Recipes/" target @ strcat "/AElement" strcat getpropstr dup not if "Physical" then "/" explode array_make dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "armors/" num @ "/Element" cat rot setstat rpsys "Recipes/" target @ strcat "/Skill" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "armors/" num @ "/Skill" cat rot setstat rpsys "Recipes/" target @ strcat "/Strength" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "armors/" num @ "/Strength" cat rot setstat rpsys "Recipes/" target @ strcat "/AC" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "armors/" num @ "/AC" cat rot setstat rpsys "Recipes/" target @ strcat "/Material" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "armors/" num @ "/Material" cat rot setstat rpsys "Recipes/" target @ strcat "/AType" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "armors/" num @ "/Type" cat rot setstat rpsys "Recipes/" target @ strcat "/Status" strcat getpropstr dup not if pop "None" then "/" explode array_make dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "armors/" num @ "/Status" cat rot setstat rpsys "Recipes/" target @ strcat "/Subskill" strcat getpropstr "/" explode array_make array_reverse dup array_count quality @ < if dup array_count else quality @ then 1 - array_getitem me @ str "armors/" num @ "/Subskill" cat rot setstat qual2 @ me @ str "armors/" num @ "/Value" cat rot setstat then rework @ until background random 10 % random 10 % random 10 % + + dup systime + me @ "Synth Busy" rot setstat sleep str me @ name " creates ^green^" rework @ if 1 else multiples @ then " " quality @ 1 = if "Poor " else quality @ 2 = if "Average " else "Masterpiece " then then target @ rework @ if 1 else multiples @ then 1 > if "s" then "^normal^!" cat "Synthesis" pretty tellhere else ( Failure ) "You failed to create the item, the crystal is wasted." .tell str me @ name "'s crystal shatters, and the effort is wasted." cat "Synthesis" pretty tellhere insurance @ not if rework @ not if qualmod @ target @ Check-Waste then else str me @ name "'s items glow with a strange light before falling to the ground, unharmed." cat "Synthesis" pretty tellhere then random 3 % not me @ "Jnote" "Synth, Learn Through Pain" findboxitem or qualmod @ -30 > and if target @ improve-skills then mp? @ if 1 chamber @ 0.3 * + me @ "Craft Practice/" target @ strip strcat getstatint skill @ 2 * + 200.0 / - dup 0.1 < if pop 0.1 then ( Alynna here again ) rpsys { "Recipes/" target @ "/drain" }cat getprop tofloat dup not if pop 10.0 then 10.0 / * rpsys { "Recipes/" target @ "/Materials" }cat getprop israwsynth? if 0.8 else 1.0 then * 0.1 50.0 limit dup var! burn MyMP burn @ 20.0 + < if MyMP 20.0 - burn ! then { "MP usage: " burn @ 20.0 + 2 fchop " (" MyMP "->" MyMP burn @ 20.0 + - 2 fchop ")" }cat "Synthesis" pretty .tell me @ "mpspent" over over getstat burn @ 20.0 + + setstat then exit then rework @ not if target @ spend-items then mp? @ not if me @ "Synth Points" getstatfloat 1 chamber @ 0.3 * + me @ "Craft Practice/" target @ strip strcat getstatint skill @ 2 * + 200.0 / - dup 0.1 < if pop 0.1 then ( Alynna here again ) rpsys { "Recipes/" target @ "/drain" }cat getprop tofloat dup not if pop 10.0 then 10.0 / * rpsys { "Recipes/" target @ "/Materials" }cat getprop israwsynth? if 0.8 else 1.0 then * 0.1 50.0 limit dup var! burn { "Synth points usage: " burn @ 2 fchop " (" me @ "Synth Points" getstat 2 fchop "->" me @ "Synth Points" getstat burn @ - 2 fchop ")" }cat "Synthesis" pretty .tell - me @ "Synth Points" rot setstat me @ "Synth Points" getstat 0 <= if me @ "Synth Points" over over getstat -1 * var! overrun me @ "mpspent" over over getstat 10.0 overrun @ + + setstat { "MP usage: " overrun @ 10.0 + 2 fchop " (" MyMP "->" MyMP overrun @ 10.0 + - 2 fchop ")" }cat "Synthesis" pretty .tell 0 setstat then else 1 chamber @ 0.3 * + me @ "Craft Practice/" target @ strip strcat getstatint skill @ 2 * + 200.0 / - dup 0.1 < if pop 0.1 then ( Alynna here again ) rpsys { "Recipes/" target @ "/drain" }cat getprop tofloat dup not if pop 10.0 then 10.0 / * rpsys { "Recipes/" target @ "/Materials" }cat getprop israwsynth? if 0.8 else 1.0 then * 0.1 50.0 limit dup var! burn MyMP burn @ 20.0 + < if MyMP 20.0 - burn ! then { "MP usage: " burn @ 20.0 + 2 fchop " (" MyMP "->" MyMP burn @ 20.0 + - 2 fchop ")" }cat "Synthesis" pretty .tell me @ "mpspent" over over getstat burn @ 20.0 + + setstat then ; : list-recipes var cur var known var num var tally var target var chance var filter .debug-off strip filter ! target ! 0 tally { "^UNDERLINE^" "Recipe Name" 22 left "|" "Element" 9 center "|" "Recipe" 34 center "|Cost|" "Chance" 5 center "|^NORMAL^" }cat .tell rpsys "Recipes/" array_get_propdirs foreach cur ! pop rpsys "Recipes/" cur @ strcat "/known" strcat getpropstr "/" split atoi num ! known ! target @ "Craft Practice/" cur @ strcat getstatint ( Have I made one before? ) known @ if target @ known @ getstatint num @ < not ( Do I know it as a basic skill to the required level? ) target @ "Special/" known @ strcat getstatint num @ < not ( Do I know it as a special skill? ) or target @ "Crafts/" known @ strcat getstatint num @ < not ( Do I know it as a craft? ) or target @ "Lore/" known @ strcat getstatint num @ < not ( Do I know it as a Lore? ) or target @ "Folk-Lore/" known @ strcat getstatint num @ < not ( Do I know it as a Folk-Lore? ) or target @ "Survival/" known @ strcat getstatint num @ < not ( Do I know it as a Survival? ) or target @ "Artistry/" known @ strcat getstatint num @ < not ( Do I know it as an Artistry? ) or target @ "Jobs/" known @ strcat getstatint num @ < not ( Do I know it as a Job? ) or target @ "Arcana/" known @ strcat getstatint num @ < not ( Do I know it as an Arcana? ) or target @ "Security/" known @ strcat getstatint num @ < not ( Do I know it as a Security? ) or target @ "Science/" known @ strcat getstatint num @ < not ( Do I know it as a Sciencey? ) or target @ "Artistry/" known @ strcat getstatint num @ < not ( Do I know it as an Artistry? ) or target @ "Farming/" known @ strcat getstatint num @ < not ( Do I know it as a Farming? ) or target @ "Homekeeping/" known @ strcat getstatint num @ < not ( Do I know it as a Homekeeping? ) or known @ and or then known @ "Swords" stringcmp not if me @ "Crafts/swords" getstatint me @ "Crafts/Long Swords" getstatfloat 5 / + me @ "Crafts/Small Swords" getstatfloat 5 / + num @ < not or then known @ "electricity" stringcmp not if me @ "Science/electricity" getstatint me @ "Crafts/Electronics" getstatfloat + num @ < not or then known @ "metal" stringcmp not if ( Check for metallurgy too ) "Metallurgy" known ! target @ known @ getstatint num @ < not ( Do I know it as a basic skill to the required level? ) target @ "Special/" known @ strcat getstatint num @ < not ( Do I know it as a special skill? ) or target @ "Crafts/" known @ strcat getstatint num @ < not ( Do I know it as a craft? ) or target @ "Lore/" known @ strcat getstatint num @ < not ( Do I know it as a Lore? ) or target @ "Science/" known @ strcat getstatint num @ < not ( Do I know it as a Science? ) or known @ and or then known @ "`" instring if ( It's based on a craft skill ) known @ "" "`" subst known ! target @ "Craft/" known @ strcat getstatint num @ < not or then filter @ if rpsys "Recipes/" cur @ strcat "/Skills" strcat getpropstr filter @ instring filter @ "battle" stringcmp not rpsys "Recipes/" cur @ strcat "/damage" strcat getpropstr and or and then if ( I know this recipe! ) 0 xp? ! me @ "Craft Practice/" cur @ strcat getstatint dup not if pop 10 then me @ "Craft Practice/" cur @ strcat rot setstat rpsys "Recipes/" cur @ strcat "/Skills" strcat getpropstr not if cur @ " has no skills!" strcat debug continue then str cur @ capitalize 22 left "|" rpsys "Recipes/" cur @ strcat "/Element" strcat getpropstr elementcolor 9 center "^normal^|" 1 quiet ! cur @ check-materials swap pop if ( dup int? if pop then )"^white^" then rpsys "Recipes/" cur @ strcat "/Materials" strcat getpropstr 34 center "^normal^|" ( Alynna's section again ) target @ cur @ check-skills pop 1 xchamber @ 0.3 * + target @ "Craft Practice/" cur @ strip strcat getstatint skill @ 2 * + 200.0 / - dup 0.5 < if pop 0.5 then rpsys { "Recipes/" cur @ "/drain" }cat getprop tofloat dup not if pop 10.0 then 10.0 / * rpsys { "Recipes/" cur @ "/Materials" }cat getprop israwsynth? if 0.8 else 1.0 then * 0.1 50.0 limit dup var! tempx 2 fchop 4 rj target @ "synth points" getstat tempx @ > if tempx @ 0.1 = if "^YELLOW^" else "^GREEN^" then else "^RED^" then swap "^NORMAL^|" 80 target @ cur @ check-skills + xchamber @ 10 * + dup 80 > if 80 - 3 / me @ "Crafts" getstatint 5 / + 10 + dup 30 > if 90 + 4 / then "(" swap dup chance ! intostr strcat ")" strcat else dup chance ! intostr then "%" strcat xp? @ not if "^red^" else "^green^" then swap strcat 5 right "^normal^|" cat ( chance @ 1 < if pop else .tell then ) .tell tally @ ++ tally ! then 0 until { { "Total Recipes Known: " tally @ }cat 45 lj "Current synth points: " target @ "Synth points" getstatfloat 2 fchop 5 rj }cat .tell "^YELLOW^^UNDERLINE^Synth Skills: " .tell var skill var toggle target @ "@rp/Craft/" array_get_propvals dup not if pop "None." .tell else foreach str rot rot dup float? if 2 round then swap dup skill ! 12 left " " strcat "[" rot 2 fchop 5 rj "]" cat 20 left "^normal^ | " strcat target @ "Craft Raise/" skill @ strcat getstatint systime swap - 3600 24 * 7 * target @ "Special/Synthesization" getstatint 100 swap - * 100 / > if "^green^" else "^red^" then swap strcat toggle @ ++ toggle ! toggle @ 3 = if 0 toggle ! strcat strcat .tell then 0 until then toggle @ 1 = if .tell then toggle @ 2 = if strcat .tell then "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" .tell "() chances represent the chance of masterpiece and are 80% chance to succeed." .tell "Red percents mean no synth skills will be gained from making that item. Remember to check +smarket to sell your creations." .tell ; $def AUCTIONEER #6649 $def AUCT AUCTIONEER swap "Bounty " swap strcat force : give_weapon ( d i -- ) var target var x var y var curprop intostr x ! target ! target @ ok? not if "I don't see that here." .tell exit then target @ find-space y ! me @ "@rp/Weapons/" x @ "/" strcat strcat nextprop curprop ! curprop @ not if "Invalid weapon number" .tell exit then begin me @ curprop @ getprop curprop @ dup "/" rinstring strcut swap pop "Weapons/" y @ intostr strcat "/" strcat swap strcat target @ swap rot setstat me @ curprop @ nextprop curprop ! curprop @ not until me @ x @ atoi delete-weapon str "You receive a " target @ "Weapons/" y @ intostr strcat "/name" strcat getstatstr " from " me @ name cat "Weapon" pretty target @ swap ansi_notify "Item Given" "Weapon" pretty tellme ; : give_armor ( d i -- ) var target var x var y var curprop intostr x ! target ! target @ ok? not if "I don't see that here." .tell exit then target @ find-aspace y ! me @ "@rp/Armors/" x @ "/" strcat strcat nextprop curprop ! curprop @ not if "Invalid armor number" .tell exit then begin me @ curprop @ getprop curprop @ dup "/" rinstring strcut swap pop "Armors/" y @ intostr strcat "/" strcat swap strcat target @ swap rot setstat me @ curprop @ nextprop curprop ! curprop @ not until me @ x @ atoi delete-weapon str "You receive a " target @ "Armors/" y @ intostr strcat "/name" strcat getstatstr " from " me @ name cat "Armor" pretty target @ swap ansi_notify "Item Given" "Armor" pretty tellme ; lvar cost : find_cost[ str:target -- ] var amount cost @ 5 + cost ! rpsys "Recipes/" target @ "/materials" strcat strcat getpropstr dup not if pop exit then ":" explode array_make foreach swap pop "/" split atoi amount ! target ! rpsys str "Materials/" target @ "/cost" cat getpropstr not if ( not a market good ) rpsys str "BMaterials/" target @ "/cost" cat getpropstr not if 1 amount @ 1 for pop target @ find_cost 0 until 1 baked? ! continue else target @ #7463 "Find-Price" call amount @ * cost @ + cost ! then else target @ #3813 "Find-Price" call amount @ * cost @ + cost ! then 0 until #0 "Cost" cost @ setstat ; PUBLIC Find_Cost : market-menu var market var item var x var cur3 var lost 1 x ! 0 array_make lost ! #0 "Synth Market" array_get_proplist market ! market @ not if "Nothing is for sale currently." .tell else "Current bounties:" .tell str "Name" 28 center "Quality" 11 center "Bounty" 8 center "#" 3 center "Time Remaining" cat .tell market @ foreach "|" explode array_make array_reverse item ! item @ 4 array_getitem atoi systime - 1 < if ( Time Out ! ) lost @ 0 array_insertitem lost ! continue else pop then str x @ intostr 2 left ")" item @ 1 array_getitem tostr 25 center item @ 2 array_getitem atoi case 1 = when "Poor" end 2 = when "Average" end 3 = when "Masterpiece" end endcase 11 center item @ 3 array_getitem tostr 8 center item @ 5 array_getitem dup not if pop "1" then tostr 2 right " " item @ 4 array_getitem atoi systime - dup 86400 / swap 3600 / 24 % intostr " hours." strcat swap intostr " days, " strcat swap strcat x @ ++ x ! cat .tell 0 until then lost @ if lost @ foreach swap pop x ! market @ x @ array_getitem "|" explode array_make array_reverse item ! item @ 0 array_getitem todbref dup player? not if pop else dup "Gil" getstatfloat item @ 3 array_getitem atoi 2 * 3 / + swap "Gil" rot setstat then market @ x @ array_delitem market ! 0 until then #0 "Synth Market" market @ array_put_proplist var choice var y str "1) Turn in a +gear item for a bounty." ", 2) Turn in a +weapon item for a bounty." ", 3) Put up a bounty yourself." ", 4) Turn in an +armor item for a bounty." ", 5) Mark one of your items(+gear) for personal vending/Set a store message." ", Q) Quit." cat .tell "To be told of bounty activity in real time, type bounty on when you're not in this program." .tell read choice ! choice @ "q" instring if "Bye." .tell exit then choice @ atoi 5 = if "Type +sell Gear Number=Amount of Gil. You can sell items for 0 gil(Giving away), but not for negative amounts." .tell "You may set your store message. Keep it short(40sh characters). Enter just a space to clear it." .tell read strip me @ "Bazaar" rot setstat "Done." .tell exit then choice @ atoi 4 = if 0 y ! "What bounty are you trying to fulfill?" .tell read atoi dup 1 < if pop 1 then dup market @ array_count > if pop market @ array_count then x ! market @ x @ 1 - array_getitem "|" explode array_make array_reverse item ! me @ "@rp/armors/" array_get_propdirs foreach tostr cur3 ! pop me @ "@rp/armors/" cur3 @ strcat "/name" strcat getpropstr item @ 1 array_getitem stringcmp not if 1 y ! then 0 until y @ not if "You don't have that armor." .tell exit then me @ "+armor" force "What item would you like to offer?" .tell read atoi y ! me @ str "armors/" y @ "/Name" cat getstatstr item @ 1 array_getitem stringcmp if "This is not what is being asked for." .tell market-menu exit then item @ 2 array_getitem atoi 1 > me @ str "armors/" y @ "/Value" cat getstatstr "Poor" stringcmp not and item @ 2 array_getitem atoi 2 > me @ str "armors/" y @ "/Value" cat getstatstr "Average" stringcmp not and or if "This item is not of sufficient quality to satisfy the order." .tell market-menu exit then item @ 3 array_getitem atoi me @ "Gil" getstatfloat + me @ "gil" rot setstat item @ 0 array_getitem todbref choice ! choice @ player? if choice @ y @ give_armor else me @ y @ delete-armor then market @ x @ 1 - array_delitem market ! #0 "Synth Market" market @ array_put_proplist item @ 5 array_getitem atoi 1 - intostr item @ 5 array_setitem item ! item @ 5 array_getitem atoi 1 < if ( Nuke it ! ) str "The synthesis bounty for ^green^" item @ 1 array_getitem "^normal^ has been fulfilled!" cat AUCT else market @ "" item @ foreach swap pop strcat "|" strcat 0 until dup strlen 1 - strcut pop swap 0 array_insertitem market ! #0 "Synth Market" market @ array_put_proplist "You have partially fulfilled the order." .tell then "You turn in the item for the bounty." .tell exit then choice @ atoi 2 = if 0 y ! "What bounty are you trying to fulfill?" .tell read atoi dup 1 < if pop 1 then dup market @ array_count > if pop market @ array_count then x ! market @ x @ 1 - array_getitem "|" explode array_make array_reverse item ! me @ "@rp/weapons/" array_get_propdirs foreach tostr cur3 ! pop me @ "@rp/weapons/" cur3 @ strcat "/name" strcat getpropstr item @ 1 array_getitem stringcmp not if 1 y ! then 0 until y @ not if "You don't have that weapon." .tell exit then me @ "+weapon" force "What item would you like to offer?" .tell read atoi y ! me @ str "Weapons/" y @ "/Name" cat getstatstr item @ 1 array_getitem stringcmp if "This is not what is being asked for." .tell market-menu exit then item @ 2 array_getitem atoi 1 > me @ str "Weapons/" y @ "/Value" cat getstatstr "Poor" stringcmp not and item @ 2 array_getitem atoi 2 > me @ str "Weapons/" y @ "/Value" cat getstatstr "Average" stringcmp not and or if "This item is not of sufficient quality to satisfy the order." .tell market-menu exit then item @ 3 array_getitem atoi me @ "Gil" getstatfloat + me @ "gil" rot setstat item @ 0 array_getitem todbref choice ! choice @ player? if choice @ y @ give_weapon else me @ y @ delete-weapon then market @ x @ 1 - array_delitem market ! #0 "Synth Market" market @ array_put_proplist item @ 5 array_getitem atoi 1 - intostr item @ 5 array_setitem item ! item @ 5 array_getitem atoi 1 < if ( Nuke it ! ) str "The synthesis bounty for ^green^" item @ 1 array_getitem "^normal^ has been fulfilled!" cat AUCT else market @ "" item @ foreach swap pop strcat "|" strcat 0 until dup strlen 1 - strcut pop swap 0 array_insertitem market ! #0 "Synth Market" market @ array_put_proplist "You have partially fulfilled the order." .tell then "You turn in the item for the bounty." .tell exit then choice @ atoi 3 = if "What item do you wish to buy?" .tell read strip dup y ! choice ! rpsys "Recipes/" choice @ strcat "/desc" strcat getpropstr not rpsys "Recipes/" choice @ strcat "/damage" strcat getpropstr or if "That is not a synthesis recipe." .tell exit then var orig str str me @ int "|" cat choice @ dup orig ! "|" cat choice ! "What quality do you wish for at the least? Enter 1 for poor, 2 for average, and 3 for masterpiece." .tell read atoi dup 1 < if pop "Aborted." .tell exit then dup 3 > if pop 3 then dup dup 2 * cost ! case 1 = when "Poor" end 2 = when "Average" end 3 = when "Masterpiece" end endcase " " strcat y @ strcat y ! intostr choice @ swap strcat "|" strcat choice ! str "How much are you willing to pay? You have " me @ "gil" getstatint intostr strcat " gil." " Suggested Price: " orig @ find_cost cost @ 2 * 3 / toint " gil." cat .tell read atoi dup 1 < if pop "Aborted." .tell exit then dup me @ "gil" getstatint > if "Insufficient funds" .tell pop exit then "How many do you wish for this price?" .tell read toint dup not if 1 then var amount dup amount ! * dup me @ "gil" getstatint > if "Insufficient funds" .tell pop exit then dup me @ "gil" getstatfloat swap - me @ "Gil" rot setstat 3 * 2 / amount @ / intostr choice @ swap strcat "|" strcat systime 3600 24 * 7 * + intostr strcat "|" strcat amount @ tostr strcat market @ 0 array_insertitem market ! #0 "Synth Market" market @ array_put_proplist str "A bounty for ^green^" amount @ 1 > if amount @ " " then y @ amount @ 1 > if "s" then "^normal^ has been issued." cat AUCT "Done." .tell exit then choice @ atoi 1 = if "What bounty are you trying to fulfill?" .tell read atoi dup 1 < if pop 1 then dup market @ array_count > if pop market @ array_count then x ! market @ x @ 1 - array_getitem "|" explode array_make array_reverse item ! me @ "gear" item @ 1 array_getitem findboxitem not if "You don't have that to turn in." .tell market-menu exit then me @ "+gear" force "What item would you like to offer?" .tell read atoi y ! me @ "gear" y @ "Name" getboxprop item @ 1 array_getitem stringcmp if "This is not what is being asked for." .tell market-menu exit then item @ 2 array_getitem atoi 1 > me @ "gear" y @ "Quality" getboxprop dup not if "Average" then "Poor" stringcmp not and item @ 2 array_getitem atoi 2 > me @ "gear" y @ "Quality" getboxprop dup not if "Average" then "Average" stringcmp not and or if "This item is not of sufficient quality to satisfy the order." .tell market-menu exit then item @ 3 array_getitem atoi me @ "Gil" getstatfloat + me @ "gil" rot setstat item @ 0 array_getitem DEBUG_LINE todbref DEBUG_LINE choice ! choice @ player? if var z me @ "gear" y @ choice @ choice @ "gear" item @ 1 array_getitem createboxitem dup z ! copyboxitem choice @ "Gear" z @ "Quantity" 1 setboxprop me @ "gear" y @ deleteOrDecrementBoxItem else random 100 % 30 me @ "Faction" getstatint 5 = if 20 + then item @ 1 array_getitem find_cost baked? @ not if 10 + then DEBUG_LINE < if "The order is fulfilled, but the customer demands more! They increase the price to encourage further production." .tell item @ 3 array_getitem atoi 135 me @ "Faction" getstatint 5 = if 15 + then * 100 / intostr item @ 3 array_setitem item ! market @ x @ 1 - array_delitem market ! market @ "" item @ foreach swap pop strcat "|" strcat 0 until dup strlen 1 - strcut pop swap array_appenditem market ! #0 "Synth Market" market @ array_put_proplist me @ "gear" y @ deleteOrDecrementBoxItem market-menu exit else me @ "gear" y @ deleteOrDecrementBoxItem then then item @ 5 array_getitem atoi 1 - intostr item @ 5 array_setitem item ! item @ 5 array_getitem atoi 1 < if ( Nuke it ! ) market @ x @ 1 - array_delitem market ! str "The synthesis bounty for ^green^" item @ 1 array_getitem "^normal^ has been fulfilled!" cat AUCT else market @ x @ 1 - array_delitem market ! market @ "" item @ foreach swap pop strcat "|" strcat 0 until dup strlen 1 - strcut pop swap 0 array_insertitem market ! #0 "Synth Market" market @ array_put_proplist "You have partially fulfilled the order." .tell then #0 "Synth Market" market @ array_put_proplist "You receive the bounty money in trade for the item.." .tell exit then ; : NPC_Bounty var target var result var x -5 cost ! 1 quiet ! #235 me ! "-1|" begin rpsys "Recipes/" array_get_propdirs dup array_count random swap % array_getitem strip capitalize dup target ! target @ find_cost strcat "|" strcat result ! rpsys str "Recipes/" target @ "/Damage" cat getpropstr not until result @ random 3 % 1 + random 3 % 1 + + 2 / dup x ! intostr strcat "|" strcat result ! 0 1 x @ 1 for pop random 10 % 1 + random 10 % 1 + + 2 / + 0 until cost @ + 0 rpsys str "Recipes/" target @ "/skills" cat getpropstr ":" explode array_make foreach swap pop "/" split swap pop atoi greater 0 until 2 * 100 + * 100 / toint result @ swap intostr strcat "|" systime 3600 3 * + intostr strcat strcat result ! #0 "Synth Market" result @ #0 "Synth Market" array_get_proplist array_appenditem array_put_proplist str "A bounty for ^green^" x @ case 1 = when "Poor" end 2 = when "Average" end 3 = when "Masterpiece" end endcase " " target @ "^normal^ has been issued." cat AUCT ; : teacher[ str:target -- ] me @ "Projecttime" getstatint systime > if "You can't teach at this time, try later." .tell exit then var skill target @ "=" explode 2 = not if pop "Type +synth #teach Bob=Grass Thread to teach Bob the Grass Thread recipe." .tell exit then match target ! skill ! me @ str "Craft Practice/" skill @ cat getstatint dup not if pop "You do not know this recipe." .tell exit then target @ player? not if pop "Invalid target, I don't see them here to teach." .tell exit then 4 / dup target @ str "Craft Practice/" skill @ cat getstatint > not if pop "They know too much for you to be of any help to them." .tell exit then me @ target @ alt? if "You may not teach an alt." .tell exit then target @ str "Craft Practice/" skill @ cat rot setstat str me @ " teaches " target @ " about a synthesis recipe!" cat "Synthesis" pretty dup "wc " swap strcat str "(" skill @ ")" cat strcat #21 swap force tellhere target @ str "You learn about " skill @ " from " me @ "." cat "Synthesis" pretty ansi_notify me @ "Projecttime" systime 1600 + setstat ; : work-order[ dbref:target -- ] 0 array_make var! haves 0 array_make var! wants rpsys { "/recipes/" target @ "/materials" }cat getprop synth2dict var! needs needs @ ; : main var target dup mufcron? if random 100 % dup intostr str swap "/100 for NPC bounty" cat debug 25 < if NPC_Bounty exit then then dup mufcron? if pop exit then me @ "finish" getstat not if "You must be approved to synth." .tell exit then strip target ! systime me @ "Synth Refresh" getstatint - 3600 24 * > if ( Synth Refresh ) "It's a brand new day and you feel refreshed!" "Synthesis" pretty tellme me @ "Synth Points" me @ "Synth Points" getstatfloat dup 12 > if pop 12 then me @ "Willpower" getstatint me @ "Special/Synthesization" getstatfloat 2 / + dup 25 > if pop 25 then me @ "Special/Mix" getstatfloat 5 / + dup 25 > if pop 25 then me @ "Jnote" "Synth, Fast Recovery" findboxitem if 1.5 * then 2.08 / me @ "Jobs/Mundane" getstatfloat 2 / + + setstat me @ "Synth Refresh" systime setstat then command @ "market" instring if market-menu exit then target @ not if "Type +synth (element):(Item 1)+(Item 2)+(Item 3)... to create things. Type +synth #list to see a list of all recipes you know from your skills." .tell "Type +synth #teach Bob=Grass Thread to teach Bob the Grass Thread recipe." .tell str systime me @ "Synth Refresh" getstatint - 3600 24 * - timex " until you regain your synth points. You have " me @ "synth points" getstatfloat 1 round dup 0 < if pop 0 then " synth points remaining." cat .tell exit then target @ "#peek" instring if target @ "#peek" split swap pop strip dup me @ mlevel 3 > and not if pop me @ else pmatch then dup player? not if "Invalid target." .tell pop exit then "" list-recipes exit then target @ "#list" instring if me @ target @ "#list" split swap pop strip 0 xchamber ! list-recipes exit then target @ "#clist" instring if me @ target @ "#clist" split swap pop strip me @ "Gear" me @ "Gear" "Synthesis Chamber" findboxitem "Quality" getboxprop tostr case "Poor" smatch when 1 xchamber ! end "Average" smatch when 2 xchamber ! end "Masterpiece" smatch when 3 xchamber ! end endcase xchamber @ not if 2 xchamber ! then list-recipes exit then target @ "#teach" instring if target @ "#teach" split swap pop strip teacher exit then target @ "#rework" instring if target @ "#rework" split swap pop strip dup not if pop "You must enter a name of the recipe to rework." .tell exit then target ! 1 rework ! then target @ "#!skillraise" instring if me @ "synth.noskillraise" 1 setstat "Skill raises are now disabled. You will be able to synth without losing XP, but you will get no skill raises." "Synth" pretty tellme exit then target @ "#skillraise" instring if me @ "synth.noskillraise" 0 setstat "Skill raises are now enabled. You will get skill raises, but those skill raises will cost XP." "Synth" pretty tellme exit then target @ make-item ; . c q