@program #2904 1 1000 d i ( Rock-Paper-Scissors combat Size, Dexterity, Stamina, Speed, Seaworthiness Sails, Engine, Cannons, Cargo Hold, Living Quarters, Armorz Copyright David Silver, do not port or modify ) $include $lib/alynna $include $lib/rp $include #2123 $include $muf/Scrp/registry $def rpsys "$rpsystem" match : find-components ( d s -- i ) var x var target var nothing var size var component component ! target ! 1 x ! 0 size ! begin target @ "parts/" x @ intostr strcat "/Name" strcat getstatstr "0" smatch not if 0 nothing ! target @ "parts/" x @ intostr strcat "/Type" strcat getstatstr component @ smatch if target @ "parts/" x @ intostr strcat "/Rating" strcat getstatstr atoi size @ + size ! then else nothing @ 1 + nothing ! then x @ 1 + x ! nothing @ 3 > until size @ ; : getmodstat ( d s -- i ) var target var stat var mod var crew stat ! target ! 0 mod ! stat @ "Ammo" smatch if target @ "Cargo" find-components mod ! then stat @ "Ram" smatch if target @ "Ram" find-components mod ! then stat @ "Info" smatch if target @ "Library" find-components mod ! then stat @ "Stamina" smatch if target @ "Armor" find-components 2 * mod ! then stat @ "Speed" smatch if target @ "Helmsman" getstatint dbref dup player? if crew ! crew @ "Sailing/Steering" getstatint crew @ "Alertness/Reactions" getstatint + 10 / crew @ "professionlist" getstatstr "Pirate" instring if 1 + then crew @ "professionlist" getstatstr "Sailor" instring if 1 + then mod @ + mod ! else pop 0 mod @ + mod ! then target @ "Magician" getstatint dbref dup player? if crew ! crew @ "Special/Air" getstatint target @ "air?" getstatint not if 2 / then crew @ "Special/Water" getstatint target @ "air?" getstatint if pop 0 then + 10 / crew @ "professionlist" getstatstr "Pirate" instring if 1 + then crew @ "professionlist" getstatstr "Sailor" instring if 1 + then mod @ + mod ! else pop 0 mod @ + mod ! then target @ "Engine" find-components target @ "Sails" find-components + 2 / mod @ + mod ! then stat @ "Dexterity" smatch if target @ "Helmsman" getstatint dbref dup player? if crew ! crew @ "Sailing/Steering" getstatint crew @ "Alertness/Reactions" getstatint + 10 / crew @ "professionlist" getstatstr "Pirate" instring if 1 + then crew @ "professionlist" getstatstr "Sailor" instring if 1 + then else pop 0 then target @ "Engine" find-components target @ "Sails" find-components + 2 / + mod ! then target @ "Captain" getstatint dup not if pop target @ owner else dbref then "Profesionlist" getstatstr "Pirate" instring if mod @ 2 + mod ! then target @ "Captain" getstatint dup not if pop target @ owner else dbref then "Profesionlist" getstatstr "Sailor" instring if mod @ 2 + mod ! then mod @ ; lvar target lvar result lvar roll1 lvar roll2 lvar roll4 lvar roll3 lvar fumbles lvar crits lvar succs lvar repeat lvar temp lvar bonusstat lvar entered lvar dice lvar max lvar curr lvar toggle lvar private lvar message lvar ship lvar target lvar toggle : linetell (s --) (tell's a string as a list of lines.) 71 line_split begin swap 71 centre LINE " " strcat swap strcat LINE strcat dup toggle @ if .otell else pop then .tell 1 - dup not until pop ; : info-ship ( s -- ) var target var wname var count strip dup not if rpsys "ships/" nextprop target ! 0 count ! "" wname ! begin target @ dup "/" instring strcut swap pop dup strlen 1 - strcut pop ", " strcat wname @ swap strcat wname ! count @ 1 + count ! rpsys target @ nextprop target ! target @ not until wname @ dup strlen 2 - strcut pop "Ship List" pretty .tell exit then wname ! rpsys "ships/" wname @ strcat "#/" strcat dup target ! nextprop not if "That does not seem to be a registered Ship" .tell exit then str "Ship Name: " wname @ cat "Ship" pretty tellme str "Ship Size: " rpsys target @ "1" strcat getpropstr cat "Ship" pretty tellme str "Ship Value: " rpsys target @ "2" strcat getpropstr cat "Ship" pretty tellme str "Ship Stamina: " rpsys target @ "3" strcat getpropstr cat "Ship" pretty tellme str "Ship Dexterity: " rpsys target @ "4" strcat getpropstr cat "Ship" pretty tellme str "Ship Speed: " rpsys target @ "5" strcat getpropstr cat "Ship" pretty tellme str "Ship Seaworthiness: " rpsys target @ "6" strcat getpropstr cat "Ship" pretty tellme str "Ship Hit Points: " rpsys target @ "3" strcat getpropstr atoi rpsys target @ "1" strcat getpropstr atoi + cat "Ship" pretty tellme ; : enter-Ship ( -- ) var target var wname "Please enter the name of the Ship" .tell read strip wname ! wname @ not if "Aborting" .tell exit then rpsys "ships/" wname @ strcat "#/" strcat dup target ! "Ship Size: " .tell read strip rpsys target @ "1" strcat rot setprop "Ship Value: " .tell read strip rpsys target @ "2" strcat rot setprop "Ship Stamina: " .tell read strip rpsys target @ "3" strcat rot setprop "Ship Dexterity: " .tell read strip rpsys target @ "4" strcat rot setprop "Ship Speed: " .tell read strip rpsys target @ "5" strcat rot setprop "Ship Seaworthiness: " .tell read strip rpsys target @ "6" strcat rot setprop wname @ info-Ship ; lvar accmod lvar WPmod lvar weightmod lvar valuemod lvar materialtype lvar craftmod : material-handler ( s i -- i ) var toggle var materials var max var curmat var curnum var failed? toggle ! strip materials ! "This item will take " materials @ strcat " To create, are you sure you want to proceed?" strcat "Crafts" Pretty Tellme read "y" instring not if 0 exit then materials @ "metal" instring if "Metal component detected, what sort of metal do you wish to use instead?" .tell read strip materialtype ! materialtype @ not if 0 exit then rpsys "Crafts/" materialtype @ strcat getprop dup not if pop else ":" explode pop atoi accmod ! atoi wpmod ! atoi weightmod ! atoi valuemod ! then materials @ materialtype @ "metal" subst materials ! then materials @ " " explode 2 / max ! 0 failed? ! toggle @ if begin atoi curnum ! curmat ! materialtype @ not if curmat @ materialtype ! then me @ curmat @ getstatint curnum @ < if 1 failed? ! "You don't have enough " curmat @ strcat "Crafts" pretty tellme then max @ 1 - max ! max @ not until failed? @ if 0 exit then materials @ " " explode 2 / max ! begin atoi curnum ! curmat ! me @ curmat @ getstatint curnum @ - me @ curmat @ rot setstat max @ 1 - max ! max @ not until else materials @ " " explode 2 / max ! begin atoi curnum ! curmat ! me @ curmat @ getstatint curnum @ + me @ curmat @ rot setstat max @ 1 - max ! max @ not until then 1 exit ; lvar quality : quality-maker ( -- s ) quality @ 2 < if "extremely shoddy" exit then quality @ 4 < if "inferior" exit then quality @ 6 < if "average" exit then quality @ 8 < if "above average" exit then quality @ 10 < if "exceptionally well built" exit then quality @ 12 < if "masterpeice of a" exit then "godlike example of a " exit ; : find-size ( d -- i ) var x var target var nothing var size target ! 1 x ! target @ "Size" getstatint size ! begin target @ "parts/" x @ intostr strcat "/Name" strcat getstatstr "0" smatch not if 0 nothing ! target @ "parts/" x @ intostr strcat "/Size" strcat getstatstr atoi size @ swap - size ! else nothing @ 1 + nothing ! then x @ 1 + x ! nothing @ 3 > until size @ ; : scanship ( d -- ) var x var target var nothing target ! 1 x ! "Parts: " target @ name strcat DIVIDER .tell .tell begin target @ "parts/" x @ intostr strcat "/Name" strcat getstatstr "0" smatch not if 0 nothing ! str "Part " x @ intostr 2 right ":" target @ "parts/" x @ intostr strcat "/Name" strcat getstatstr 20 center "|" target @ "parts/" x @ intostr strcat "/Type" strcat getstatstr 1 strcut swap TOUPPER swap strcat " Weight: " strcat target @ "parts/" x @ intostr strcat "/Size" strcat getstatstr dup "." instring if 2 fchop then "" strcat strcat target @ "parts/" x @ intostr strcat "/Subskill" strcat getstatstr pop 30 center "|" target @ "parts/" x @ intostr strcat "/Rating" strcat getstatstr 2 right "|" cat linetell else nothing @ 1 + nothing ! then x @ 1 + x ! nothing @ 3 > until FOOTER .tell ; : view-ship ( s -- ) var target var crew target ! target @ strip not if me @ location target ! else me @ mlevel 3 > not if me @ location target ! else target @ match dup thing? not if pop me @ location then target ! then then target @ "Ship" getstatint dbref "Ship?" getstatint not if "No ship to view" .tell exit then target @ "Ship" getstatint dbref target ! HEADER .tell target @ name DIVIDER pop .tell str "Size " OPENITEM target @ find-size "/" target @ "Size" getstatint CLOSEITEM " Stamina " OPENITEM target @ "Stamina" getstatint target @ "Stamina" getmodstat over + "(" swap ")" CLOSEITEM " Dexterity " OPENITEM target @ "Dexterity" getstatint target @ "Dexterity" getmodstat over + "(" swap ")" CLOSEITEM cat linetell str "Speed " OPENITEM target @ "Speed" getstatint target @ "Speed" getmodstat over + "(" swap ")" CLOSEITEM " Seaworthiness " OPENITEM target @ "Seaworthiness" getstatint CLOSEITEM " Hit Points " OPENITEM target @ "HP" getstatint "/" target @ "Stamina" getstatint target @ "Stamina" getmodstat + target @ "Size" getstatint + CLOSEITEM cat linetell target @ scanship "Owned by " target @ owner name strcat ", out in persuit of " target @ "Seeking" getstatstr dup "0" smatch if pop "Gil" then strcat strcat target @ "Air?" getstatint if ", and capable of taking flight" strcat then linetell "Crew" DIVIDER .tell .tell str "Title " "Name" 15 center "Skill" cat linetell str "Captain " target @ "Captain" getstatint dbref dup player? not if pop target @ owner then dup crew ! name 15 center "Null " cat linetell str "Helmsman " target @ "Helmsman" getstatint dbref dup player? not if pop "None" 15 center "Null " else dup crew ! name 15 center crew @ "Sailing/Steering" getstatint crew @ "Alertness/Reactions" getstatint + "/50" then cat linetell str "Gunner " target @ "Gunner" getstatint dbref dup player? not if pop "None" 15 center "Null " else dup crew ! name 15 center crew @ "Sailing/Gunning" getstatint 0.2 * crew @ "Sailing/Offensive" getstatint crew @ "Sailing/Evasive" getstatint + crew @ "Sailing/Defensive" getstatint + 3 / 0.8 * + int "/50" then cat linetell str "Magician " target @ "Magician" getstatint dbref dup player? not if pop "None" 15 center "Null " else dup crew ! name 15 center crew @ "Special/Air" getstatint crew @ "Special/Water" getstatint + "/50" then cat linetell str "Delegate " target @ "Delegate" getstatint dbref dup player? not if pop "None" 15 center "Null " else dup crew ! name 15 center crew @ "Streetwise" getstatint crew @ "Subterfuge" getstatint + crew @ "Empathy" getstatint + crew @ "Politics" getstatint 2 / + 1.74 / int "/50" then cat linetell FOOTER .tell ; : buy-ship ( s -- ) var target var wname var cost var shipname var deck strip wname ! wname @ not if "Listing.." .tell "" info-ship exit then rpsys "ships/" wname @ strcat "#/" strcat dup target ! rpsys target @ "2" strcat getpropstr atoi dup not if "That doesn't seem to be for sale" .tell pop exit then 1.1 * int cost ! cost @ me @ "Subterfuge" getstatint me @ "Streetwise" getstatint + 0.005 * over * - cost ! str "After haggling with the merchant over the " wname @ " you arrive at the price of " cost @ " Do you want to buy?" cat "Shop" pretty tellme read "y" instring not if "You decide to take your business elsewhere" .tell exit then me @ "Gil" getstatint cost @ < if "You can't afford it" .tell exit then me @ "Gil" getstatint cost @ - me @ "Gil" rot setstat me @ location owner "gil" getstatint cost @ 2 / + me @ location owner "Gil" rot setstat "Please give us a name, make it short" .tell read strip shipname ! shipname @ not if wname @ shipname ! then me @ location shipname @ newobject cost ! cost @ "Looks like a basic " wname @ strcat ". You could probably board it(board " strcat wname @ strcat ")" strcat setdesc cost @ "Size" rpsys target @ "1" strcat getprop setstat cost @ "Value" rpsys target @ "2" strcat getprop setstat cost @ "Stamina" rpsys target @ "3" strcat getprop setstat cost @ "Dexterity" rpsys target @ "4" strcat getprop atoi setstat cost @ "Speed" rpsys target @ "5" strcat getprop setstat cost @ "Seaworthiness" rpsys target @ "6" strcat getprop setstat rpsys target @ "3" strcat getprop atoi rpsys target @ "1" strcat getprop atoi + cost @ "HP" rot setstat cost @ "Ship?" "1" setstat #2824 str "[" shipname @ "]: Deck" cat newroom deck ! cost @ "Deck" deck @ int setstat deck @ "Ship" cost @ int setstat cost @ "board;board " shipname @ strcat newexit deck @ setlink cost @ "_alisten" "2621" setprop cost @ "me" setlockstr pop cost @ me @ location setlink deck @ "@$obvexits" setsucc "The merchant takes your money and you're shown to your " wname @ strcat "Shop" pretty tellme ; : roll-ship ( s -- ) var target var ship var success var x target ! me @ location "ship" getstatint dup not if "This is not the inside of a ship" .tell pop exit then dbref ship ! ship @ "ship?" getstatint not if "Not a valid ship" .tell exit then ship @ me ! ship @ target @ roller success ! str ship @ name " rolls " target @ " and scores " success @ " succs" cat "Ship" pretty success ! ship @ location #-1 1 success @ ANSI_NOTIFY_EXCLUDE 0 x ! begin x @ dbref room? if x @ dbref "Ship" getstatint ship @ int = if x @ dbref #-1 1 success @ ANSI_NOTIFY_EXCLUDE then then x @ 1 + x ! x @ dbref dbtop dbcmp until ; : steer-ship ( s -- ) var ship var target strip target ! target @ not if "Type +ship/steer (command for the ship to perform)" .tell exit then me @ location "ship" getstatint dbref ship ! ship @ thing? not if "You are not in a ship to steer" .tell exit then me @ ship @ controls ship @ "Captain" getstatint dbref me @ dbcmp or ship @ "Helmsman" getstatint dbref me @ dbcmp or if ship @ target @ force "You control the ship" .tell exit then "You don't control this ship" .tell ; : cannon-buy ( -- ) var target var ship var x var nothing var cur var new var cost var weight var rating 1 x ! me @ location "ship" getstatint dbref ship ! ship @ owner me @ dbcmp not if "You don't own this ship" .tell exit then ship @ thing? not if "Invalid ship, or you're not in a ship" .tell exit then begin ship @ "parts/" x @ intostr strcat "/Name" strcat getstatstr "0" smatch if break then x @ 1 + x ! 0 until "Would you like a small, medium, or large cannon?" .tell read strip new ! new @ "{small|medium|large}" smatch not if "Medium" new ! then new @ "Small" smatch if 6 weight ! 12 cost ! 15 rating ! then new @ "Medium" smatch if 12 weight ! 24 cost ! 30 rating ! then new @ "Large" smatch if 18 weight ! 48 cost ! 50 rating ! then ship @ "parts/" x @ intostr strcat "/Size" strcat getstatstr atoi weight @ swap - ship @ find-size > if "There's not enough space on your ship for this" .tell exit then str "It will cost you " cost @ intostr " gil, you have " me @ "gil" getstatint ", are you sure?" cat .tell read "y" instring not if "You decide against upgrading" .tell exit then me @ "gil" getstatint cost @ < if "You can't afford it" .tell exit then me @ "Gil" getstatint cost @ - me @ "Gil" rot setstat ship @ "parts/" x @ intostr strcat "/Rating" strcat rating @ setstat ship @ "parts/" x @ intostr strcat "/Size" strcat weight @ setstat ship @ "parts/" x @ intostr strcat "/Type" strcat "Cannon" setstat "What would you like this part to be called?" .tell read ship @ "parts/" x @ intostr strcat "/Name" strcat rot setstat "The cannon is installed, De Loco industries thank you." .tell ; : upgrade-ship ( s -- ) var target var ship var x var nothing var cur var new var cost var weight strip target ! target @ not if "Type +ship/upgrade (Ram, sails, library, cannons, engine, armor, cargo, residential, luxury(Fancy Residential))." .tell exit then target @ "{Ram|Library|sails|luxury|Cannon|engine|armor|cargo|residential|cannons}" smatch not if "Invalid part type" .tell exit then target @ "*Cannon*" smatch if cannon-buy exit then 1 x ! begin me @ location "ship" getstatint dbref ship ! ship @ owner me @ dbcmp not if "You don't own this ship" .tell exit then ship @ thing? not if "Invalid ship, or you're not in a ship" .tell exit then ship @ "parts/" x @ intostr strcat "/Name" strcat getstatstr "0" smatch not if 0 nothing ! ship @ "parts/" x @ intostr strcat "/Type" strcat getstatstr target @ smatch if break then else nothing @ 1 + nothing ! then x @ 1 + x ! nothing @ 3 > until nothing @ 3 > if x @ nothing @ - x ! then ship @ "parts/" x @ intostr strcat "/Rating" strcat getstatstr atoi cur ! "We have detected you have a current rating in this type of " cur @ intostr strcat .tell "What new rating would you like?" .tell read strip atoi new ! new @ 25 > if 25 new ! then new @ cur @ > not if "You decide against upgrading" .tell exit then target @ "residential" smatch if new @ cur @ - 5 * cost ! new @ 1 - 3 * 5 + weight ! else target @ "Luxury" smatch if new @ cur @ - 20 * cost ! new @ 1 - 5 * 8 + weight ! else new @ cur @ - nothing ! new @ cur @ - 0 swap - begin cur @ nothing @ 1 + + + nothing @ 1 - nothing ! nothing @ not until cost ! new @ 0.5 * 4 + weight ! target @ "Engine" smatch if "Do you wish this engine to be air capable?" .tell read "y" instring if ship @ "Airtemp" 1 setstat cost @ 3 * cost ! weight @ 1.5 * weight ! else ship @ "Airtemp" 0 setstat then then then then target @ "Armor" smatch if cost @ 1.5 * cost ! weight @ 0.8 * weight ! then target @ "{Engine|luxury}" smatch not if "We could reduce the size by 30% for double the price, would you like that?" .tell read "y" instring if cost @ 2 * cost ! weight @ 2 * 3.0 / weight ! then then ship @ "parts/" x @ intostr strcat "/Size" strcat getstatstr atoi weight @ swap - ship @ find-size > if "There's not enough space on your ship for this" .tell exit then str "It will cost you " cost @ intostr " gil, you have " me @ "gil" getstatint ", are you sure?" cat .tell read "y" instring not if "You decide against upgrading" .tell exit then me @ "gil" getstatint cost @ < if "You can't afford it" .tell exit then me @ "Gil" getstatint cost @ - me @ "Gil" rot setstat ship @ "parts/" x @ intostr strcat "/Rating" strcat new @ setstat ship @ "parts/" x @ intostr strcat "/Size" strcat weight @ setstat ship @ "parts/" x @ intostr strcat "/Type" strcat target @ setstat "What would you like this part to be called?" .tell read ship @ "parts/" x @ intostr strcat "/Name" strcat rot setstat target @ "Cargo" smatch if ship @ "Cargo" getstatint not if #2824 str "[" ship @ name "]: Cargo Hold" cat newroom new ! new @ "Ship" ship @ int setstat ship @ "deck" getstatint dbref "[CH] Cargo Hold;cargo;ch" newexit new @ setlink new @ "[O] Out;o;exit;leave;flee" newexit ship @ "deck" getstatint dbref setlink ship @ "Cargo" new @ int setstat new @ "@$obvexits" setsucc new @ "Looks like a simple cargo hold" setdesc then then target @ "Library" smatch if ship @ "Library" getstatint not if #2824 str "[" ship @ name "]: Library Room" cat newroom new ! new @ "Ship" ship @ int setstat ship @ "deck" getstatint dbref "[Li] Library;Library;li" newexit new @ setlink new @ "[O] Out;o;exit;leave;flee" newexit ship @ "deck" getstatint dbref setlink ship @ "Library" new @ int setstat new @ "@$obvexits" setsucc new @ "Looks like a simple Library hold" setdesc then then new @ nothing ! target @ "Residential" smatch if ship @ "Residential" getstatint not if #2824 str "[" ship @ name "]: Living Quarters" cat newroom new ! new @ "Ship" ship @ int setstat ship @ "deck" getstatint dbref "[LQ] Living Quarters;LQ" newexit new @ setlink new @ "[O] Out;o;exit;leave;flee" newexit ship @ "deck" getstatint dbref setlink ship @ "Residential" new @ int setstat new @ "@$obvexits" setsucc new @ "A hallway with doors to either side, the crew lives here probably." setdesc then begin cur @ 1 + cur ! #2824 str "[" ship @ name "]: Crew room" cur @ cat newroom new ! new @ "Ship" ship @ int setstat ship @ "Residential" getstatint dbref str "[" cur @ "] Room " cur @ ";" cur @ cat newexit new @ setlink new @ "[O] Out;o;exit;leave;flee" newexit ship @ "Residential" getstatint dbref setlink new @ "@$obvexits" setsucc new @ "Looks like a simple room for a sailor of some kind." setdesc cur @ nothing @ = until then target @ "Luxury" smatch if ship @ "Luxury" getstatint not if #2824 str "[" ship @ name "]: Luxury Quarters" cat newroom new ! new @ "Ship" ship @ int setstat ship @ "deck" getstatint dbref "[LLQ] Luxury Living Quarters;LLQ" newexit new @ setlink new @ "[O] Out;o;exit;leave;flee" newexit ship @ "deck" getstatint dbref setlink ship @ "Luxury" new @ int setstat new @ "@$obvexits" setsucc new @ "A" set new @ "A hallway with doors to either side, the crew lives here probably. The hallway itself seems very fancy and decorated." setdesc then begin cur @ 1 + cur ! #2824 str "[" ship @ name "]: Luxury room" cur @ cat newroom new ! new @ "Ship" ship @ int setstat ship @ "Luxury" getstatint dbref str "[" cur @ "] Room " cur @ ";" cur @ cat newexit new @ setlink new @ "[O] Out;o;exit;leave;flee" newexit ship @ "Luxury" getstatint dbref setlink new @ "@$obvexits" setsucc new @ "A" set new @ "Looks like a extravagent room for a sailor of some kind." setdesc cur @ nothing @ = until then target @ "Engine" smatch if ship @ "Air?" ship @ "Airtemp" getstatint setstat then "The part is installed" .tell ; : repair-ship ( -- ) var ship var target var mod var damage var cost me @ location name "Dock" instring not if "Go to a dock first, and you must be outside the ship" .tell exit then "What boat would you like to fix?" .tell read strip target ! target @ match dup thing? not if pop "I don't see that ship here" .tell exit then ship ! ship @ "ship?" getstatint not if "That's not a ship" .tell exit then me @ "Leadership/Parties" getstatint me @ "Crafts/Boats" getstatint + "Your Crafts/Boats+Leadership/Parties score is " over intostr strcat .tell mod ! ship @ "Stamina" getstatint ship @ "Stamina" getmodstat + ship @ "Size" getstatint + ship @ "HP" getstatint - dup not if pop "There is no damage to repair" .tell exit then damage ! str "There is " damage @ " damage done to the ship, how many points to you wish to repair?" cat .tell read atoi target ! target @ 1 < if 1 target ! then target @ damage @ > if damage @ target ! then target @ 1.0 mod @ 0.01 * + * int cost ! "Considering for a moment, you realise it will cost " cost @ intostr strcat ", are you sure you want to proceed?" strcat .tell read "y" instring not if "You decide against it" .tell exit then me @ "Gil" getstatint cost @ < if "You can't afford it" .tell exit then me @ "Gil" getstatint cost @ - me @ "Gil" rot setstat ship @ "HP" getstatint target @ + dup 0 > if ship @ "dead?" 0 setstat else ship @ "dead?" 1 setstat then ship @ "HP" rot setstat str me @ name " repairs their ship" cat "Ship" pretty tellhere ; : shipsearch ( -- ) var cur var db var crew var booty var amount var prize 0 cur ! HEADER .tell "Ship Scan" DIVIDER pop .tell str "^Cyan^|^white^" 6 left "Name" 20 left "|" "Owner" 15 center "|" "Sze" 3 right "|" "Air?" "Location" 19 center " ^cyan^|^ ^" cat .tell begin cur @ dbref db ! db @ thing? if db @ "Ship?" getstatint if systime db @ "cashcycle" getstatint - 60 60 * 24 * 7 * 2.5 / int > if db @ "Captain" getstatint dbref db @ owner dbcmp not db @ "Captain" getstatint and if #235 "Money was given to someone" notify db @ "Ammo" getmodstat 2 / db @ owner "Gil" getstatfloat + db @ owner "Gil" rot setstat then db @ "Info" getmodstat booty ! db @ "Magician" getstatint dbref dup player? not if pop db @ owner then crew ! crew @ "studypoints" getstatint booty @ 2 / + crew @ "Studypoints" rot setstat db @ "Cashcycle" systime setstat db @ "seeking" getstatstr "Materials/" swap strcat "/cost" strcat rpsys swap getpropstr not if db @ "Ammo" getmodstat db @ "Delegate" getstatint if db @ "Delegate" getstatint dbref dup player? if crew ! crew @ "Subterfuge" getstatint crew @ "Empathy" getstatint crew @ "Streetwise" getstatint crew @ "Politics" getstatint 2 / + + + crew @ "Professionlist" getstatstr "Sailor" instring if 5 + then crew @ "Professionlist" getstatstr "Pirate" instring if 5 + then 100.0 / 1 + * else pop then then dup if dup float? if int then random swap % 1 + db @ "captain" getstatint dbref dup player? if crew ! else pop db @ owner crew ! then crew @ "gil" getstatfloat + crew @ "Gil" rot setstat #21 str "p #mail " crew @ name "=You received some money due to ship trading" cat force else pop then else ( We don't want money ) db @ "Seeking" getstatstr booty ! db @ "Ammo" getmodstat db @ "Delegate" getstatint if db @ "Delegate" getstatint dbref dup player? if crew ! crew @ "Subterfuge" getstatint crew @ "Empathy" getstatint crew @ "Streetwise" getstatint crew @ "Politics" getstatint 2 / + + + crew @ "Professionlist" getstatstr "Sailor" instring if 5 + then crew @ "Professionlist" getstatstr "Pirate" instring if 5 + then 100.0 / 1 + * else pop then then 50 * db @ "seekingprogress" getstatint + db @ "seekingprogress" rot setstat rpsys "Materials/" booty @ "/cost" strcat strcat getprop atoi amount ! db @ "seekingprogress" getstatint amount @ < not if db @ "seekingprogress" getstatint amount @ / prize ! prize @ amount @ * db @ "seekingprogress" getstatint - db @ "seekingprogress" rot setstat db @ "Captain" getstatint dbref dup player? not if pop db @ owner then crew ! crew @ booty @ getstatint prize @ + str crew @ " gained " prize @ " " booty @ cat .tell crew @ booty @ rot setstat crew @ str "You gained " prize @ " " booty @ " from the " db @ name "." cat notify then then then str db @ name 20 left "|" db @ owner name 15 center "|" db @ "Size" getstatstr 3 right "|" db @ "Air?" getstatint if "Y|" else "N|" then db @ location name dup ":" instring 1 + strcut swap pop 20 right cat linetell then then cur @ 1 + cur ! cur @ dbref dbtop dbcmp until FOOTER .tell ; : crew-ship ( -- ) var target var crew var param me @ location "Ship" getstatint not if "This is not a ship" .tell exit then me @ location "Ship" getstatint dbref target ! target @ thing? not if "You're not in a ship" .tell exit then target @ "ship?" getstatint not if "This is not a ship" .tell exit then target @ owner me @ dbcmp target @ "Captain" getstatint dbref me @ dbcmp or not if "You don't own this ship, nor are you the captain" .tell exit then begin "Crew" DIVIDER .tell .tell str "Title " "Name" 15 center "Skill" cat linetell str "Captain " target @ "Captain" getstatint dbref dup player? not if pop target @ owner then dup crew ! name 15 center "Null " cat linetell str "Helmsman " target @ "Helmsman" getstatint dbref dup player? not if pop "None" 15 center "Null " else dup crew ! name 15 center crew @ "Sailing/Steering" getstatint crew @ "Alertness/Reactions" getstatint + "/50" then cat linetell str "Gunner " target @ "Gunner" getstatint dbref dup player? not if pop "None" 15 center "Null " else dup crew ! name 15 center crew @ "Sailing/Gunning" getstatint 0.2 * crew @ "Sailing/Offensive" getstatint crew @ "Sailing/Evasive" getstatint + crew @ "Sailing/Defensive" getstatint + 3 / 0.8 * + int "/50" then cat linetell str "Magician " target @ "Magician" getstatint dbref dup player? not if pop "None" 15 center "Null " else dup crew ! name 15 center crew @ "Special/Air" getstatint crew @ "Special/Water" getstatint + "/50" then cat linetell str "Delegate " target @ "Delegate" getstatint dbref dup player? not if pop "None" 15 center "Null " else dup crew ! name 15 center crew @ "Streetwise" getstatint crew @ "Subterfuge" getstatint + crew @ "Empathy" getstatint + crew @ "Politics" getstatint 2 / + 1.74 / int "/50" then cat linetell FOOTER .tell "What position are you re-assigning? type q to quit" .tell read strip param ! param @ "{Delegate|Gunner|Captain|Magician|Helmsman}" smatch if "Who will be taking this position?" .tell read strip match crew ! target @ param @ getstatint dbref "ship" 0 setstat crew @ player? not if "I don't see them here" .tell #0 crew ! else crew @ "Ship" getstatint if "They already hold a position on a ship(maybe yours)" .tell #0 crew ! then then target @ param @ crew @ int setstat crew @ "Ship" target @ int setstat then param @ "q" instring until "All done" .tell ; : trash-ship ( -- ) var cur var target me @ mlevel 4 < if exit then "What ship are we recycling today?" .tell read strip match target ! target @ thing? not if "No" .tell exit then target @ "ship?" getstatint not if "No" .tell exit then target @ int target ! 1 cur ! begin cur @ dbref room? if cur @ dbref "@rp/ship" getpropval target @ = if "Booya!" .tell cur @ dbref recycle then then cur @ 1 + cur ! cur @ dbref dbtop dbcmp until target @ dbref recycle "Done" .tell ; : seek-ship ( s -- ) var target var db strip target ! me @ location "ship" getstatint dbref dup thing? not if pop "You are not on a ship" .tell exit then db ! me @ db @ owner dbcmp me @ db @ "Delegate" getstatint dbref dbcmp or me @ db @ "Captain" getstatint dbref dbcmp or not if "You are not the Captain, Owner, or Delegate of this ship." .tell exit then "You order the crew of the ship to set sail in search of " target @ strcat .tell db @ "Seeking" target @ setstat ; : remove-ship ( s -- ) var target var ship me @ location "ship" getstatint dup not if pop "This is not a ship" .tell exit then dbref ship ! strip target ! target @ not if "Please enter the number of the part to remove" .tell read strip target ! then target @ not if "Aborting" .tell exit then "Removing.." .tell ship @ str "parts/" target @ "/name" cat "" setstat ship @ str "parts/" target @ "/desc" cat "" setstat ship @ str "parts/" target @ "/size" cat getstatint me @ "Gil" getstatint + me @ "Gil" rot setstat ship @ str "parts/" target @ "/size" cat "" setstat ship @ str "parts/" target @ "/type" cat "" setstat ship @ str "parts/" target @ "/rating" cat "" setstat "Done, some gil given" .tell ; : main ( ) var x var success var ship 0 toggle ! command @ "+Ship/enter" smatch if enter-Ship exit then command @ "+Ship/Upgrade" smatch if upgrade-ship exit then command @ "+Ship/info" smatch if info-Ship exit then command @ "+Ship/view" smatch if view-ship exit then command @ "+Ship/buy" smatch if buy-ship exit then command @ "+Ship/Roll" smatch if roll-ship exit then Command @ "+Ship/Crew" smatch if crew-ship exit then command @ "+Ship/Repair" smatch if repair-ship exit then command @ "+Ship/Steer" smatch if steer-ship exit then command @ "+Ship/Seek" smatch if seek-ship exit then command @ "+Ship/Remove" smatch if remove-ship exit then command @ "+Ship/Trash" smatch if trash-ship exit then command @ "{disembark|leave|exit|out|o}" smatch if me @ location "Ship" getstatint dbref me @ swap location moveto exit then shipsearch ; . c q