def greet(charid): db.cur.execute( "select txt from dialogue where topic = \"Greet\" and charid = \"" + charid + "\";") try: result = parse.tupleListToList(db.cur.fetchall()) print(result[0]) except IndexError: print(find.nameFromID([charid], "people")[0] + " ignores you.") if charid == "grdead": if g.grkolbOut == "0": db.cur.execute( "update save set val = 1 where var = \"grkolbOut\";") g.update() db.cur.execute( "update people set locid = \"grship\" where charid = \"grkolbio\";" ) topicSwitch("grdedgre") if charid == "pewayna": if checkTopic("waygreet"): print(get.dlg("waymyth")) topicSwitch("waygreet", "waygre2", "Greet") setVis("pevillag", 1)
def examine(loc): if g.debug: print("[DBG] action.examine:", loc) if loc == "bueleusa": if g.buMartFind == "0": db.cur.execute( "update save set val = 1 where var = \"buMartFind\";") g.update() print(get.text("exaeleus")) db.cur.execute( "update item set locid = \"bueleusa\" where itemid = \"martenit\";" ) elif loc == "timount": print(get.text("examount")) db.cur.execute( "update location set vis = 1 where locid = \"tioutmon\";") elif loc == "grfors": if g.grforSkin == "0": db.cur.execute( "update save set val = 1 where var = \"grforSkin\";") g.update() print(get.text("exafores")) db.cur.execute( "update item set locid = \"grfors\" where itemid = \"linskin\";" ) elif loc == "grbay": print(get.text("shipunde")) else: print(get.text("exanone"))
def use(obj1, obj2=""): if obj1 == "budagger" and obj2 == "archtool" or obj1 == "archtool" and obj2 == "budagger": print(get.text("archdagg")) elif obj1 == "budagger": if g.spletterDropped == "0": db.cur.execute( "update save set val = 1 where var = \"spletterDropped\";") g.update() print(get.text("usedagg")) db.cur.execute("update item set locid = \"" + find.plLoc() + "\" where itemid = \"zlatlett\";") topicSwitch("gorhelp") elif obj1 == "zlatlett" and obj2 == "dicnorse" or obj2 == "zlatlett" and obj1 == "dicnorse": db.cur.execute("update save set val = 1 where var = \"spletterRead\";") g.update() print(get.text("letter")) setVis("buairpor", 1) elif obj1 == "zlatlett": print(get.text("uselett")) elif obj1 == "dicnorse": print(get.text("dictonor")) elif obj1 == "archtool": print(get.text("usearch")) elif obj1 == "vikbok1" or obj1 == "vikbok2": print(get.text("vikbook")) setVis("grport", 1) elif obj1 == "viksword" and obj2 == "archtool" or obj1 == "archtool" and obj2 == "viksword": # Somehow the game became a test in the player's attention span and reading comprehension. print(get.text("archfake")) elif obj1 == "viksword" and obj2 == "altar" or obj1 == "altar" and obj2 == "viksword": # This idea was a bit more obvious in the original story. print(get.text("innuendo")) db.cur.execute( "update item set locid = \"pecave\" where itemid = \"guthjorr\";") slot = find.invSlotByItemID(["viksword"]) db.cur.execute("update inventory set item" + str(slot) + " = NULL where charid = \"player\";" ) # Making another global variable is such a drag. elif obj1 == "viksword": print( "This artifact is most certainly very interesting but looks like an ordinary sword on the surface." ) elif obj1 == "guthjorr" and obj2 == "fjorstei" or obj1 == "fjorstei" and obj2 == "guthjorr": # ENDING 1 print( "\n ---- Chapter X: Engiandlátæv ----\n") gameOver.End("immortality") else: print(get.text("archbleh"))
def save(*args): if len(args) == 0: print("Would you like to save your game? (Y/N)") if ask.yn(): db.cur.execute( "update save set val = 1 where var = \"gameSaved\";") g.update() db.db.commit() print("\nGame saved.") else: print("Game not saved.") else: # Force save print("\nGame saved.") db.cur.execute("update save set val = 1 where var = \"gameSaved\";") g.update() db.db.commit()
def call(charid): if charid == "spgorka" and g.spgorCalled == "0": print(get.dlg("gorcall")) db.cur.execute("update save set val = 1 where var = \"spgorCalled\";") g.update() elif charid == "pewayna" and g.spgorCalled == "1": if g.pewayCalled == "0": print(get.dlg("waycall1")) db.cur.execute( "update save set val = 1 where var = \"pewayCalled\";") g.update() db.cur.execute( "update people set locid = \"pecusco\" where charid = \"pewayna\";" ) else: print(get.text("nophone"))
def runGame(): # Because functions. g.update() # Initialize global variables. g.initCmdList() # Initialize command list. print(get.text("gtitle2")) # Print title screen. #menu() if g.gameSaved == "0": # No saved game. askPlayerName() # Ask player name. print("\n"+get.text("devtips")) if parse.sanitize(str(input("Press Enter to continue."))) != None: # Input anything. print("\n"+get.text("intro")) # Print intro. if parse.sanitize(str(input("Press Enter to continue."))) != None: # Input anything. if g.Chapters == "1": # Print chapters? print("\n ---- Chapter I: The Hidden Letter ----") cmd.look() # Look around the first room. gameLoop() # Game else: cmd.look() # Look around the first room. gameLoop() # Game
def travel(fromid, toid): if g.debug: print("[DBG] action.travel", fromid, toid) if toid == "nejaratr": if fromid == "intrro7": setVis("intrains", 1) if toid == "grport": if g.grFisherCrater == "0": print(get.text("grwelcom")) db.cur.execute( "update save set val = 1 where var = \"grFisherCrater\";") g.update() if toid == "pecave" or toid == "pecave2": if fromid == "pevillag": db.cur.execute( "update people set locid = NULL where charid = \"pecook\";" ) # Aaaand woosh he goes!
def travel(*args): inputlist = parse.checkArgs(args, "Travel where?", "", "to") if inputlist: charid = "player" toid = find.idFromName(inputlist, "location", [], True) while len(toid) > 1: toid = ask.which(toid, "location") if toid: if get.visCheck(toid[0]): if toid[0] in g.worldTravel and find.plLoc() in g.worldTravel: if item.valTrans( 200, ["player"], [], " to travel to " + find.nameFromID(toid, "location")[0]): print("You pay the standard fare of 200.") db.cur.execute( "update people set val = val - 200 where charid = \"player\";" ) print("Traveling to " + find.nameFromID(toid, "location")[0] + ".") if toid[0] == "buairpor" and g.firstBulgaria == "1" and g.Chapters == "1": print( "\n ---- Chapter II: Tracking Zlatin Panayotov ----" ) db.cur.execute( "update save set val = 0 where var = \"firstBulgaria\";" ) g.update() elif toid[0] == "taport" or toid[ 0] == "taairpor" and g.firstTanz == "1" and g.Chapters == "1": print( "\n ---- Chapter III: Retrieving Beast ----" ) db.cur.execute( "update save set val = 0 where var = \"firstTanz\";" ) g.update() elif toid[ 0] == "inairpor" and g.backToIndia == "1" and g.Chapters == "1": print( "\n ---- Chapter IV: The Fjǫrsteinn ----" ) db.cur.execute( "update save set val = 0 where var = \"backToIndia\";" ) g.update() elif toid[ 0] == "grport" and g.grFisherCrater == "0" and g.Chapters == "1": print( "\n ---- Chapter V: The Fabled Guðhjǫrr ----\n" ) # Variable update handled in action. elif toid[ 0] == "peport" and g.firstPeru == "1" and g.Chapters == "1": print( "\n ---- Chapter VIII: The Guðhjǫrr ----" ) db.cur.execute( "update save set val = 0 where var = \"firstPeru\";" ) g.update() action.travel(find.plLoc(), toid[0]) db.cur.execute("update people set locid = \"" + toid[0] + "\" where charid = \"" + charid + "\";") cmd.look() elif toid[0] == "netoti" or toid[0] == "inbussta": # Bus fare. if item.valTrans(20, ["player"], ["inbusdri"], " to take the bus"): print("You pay the bus fare of 20 money.") db.cur.execute( "update people set val = val - 20 where charid = \"player\";" ) action.travel(find.plLoc(), toid[0]) db.cur.execute("update people set locid = \"" + toid[0] + "\" where charid = \"" + charid + "\";") cmd.look() elif toid[0] == "pecave2" or toid[ 0] == "pecave": # INTO THE PIT WITH YOU! if "flalight" in find.listInvItemIDs( ): # Flashlight check AKA. FU PL dundundun = True else: dundundun = False if g.debug: print("[DBG] travel FLASHLIGHT CHECK:", dundundun, toid[0]) if dundundun: # Why would you pick it up? action.setVis("pecave2", 0) action.setVis("pecave", 1) print("Traveling to the " + find.nameFromID(["pecave"], "location")[0] + ".") action.travel(find.plLoc(), "pecave") db.cur.execute( "update people set locid = \"pecave\" where charid = \"" + charid + "\";") cmd.look() else: action.setVis("pecave", 0) action.setVis("pecave2", 1) print("Traveling to the " + find.nameFromID(["pecave2"], "location")[0] + ".") action.travel(find.plLoc(), "pecave2") db.cur.execute( "update people set locid = \"pecave2\" where charid = \"" + charid + "\";") cmd.look() else: print("Traveling to " + find.nameFromID(toid, "location")[0] + ".") action.travel(find.plLoc(), toid[0]) db.cur.execute("update people set locid = \"" + toid[0] + "\" where charid = \"" + charid + "\";") cmd.look() else: print("You can't travel there.") else: print("You can't travel there.")
def talk(charid, dlgid): if g.debug: print("[DBG] action.talk:", charid, dlgid) if charid == "spgorka": if dlgid == "gorhelp": if ask.yn(): if "budagger" in find.listInvItemIDs(): print(get.dlg("gorhhold")) if ask.yn(): print(get.dlg("gorhh2")) print(get.text("gordagg")) topicSwitch("gorhelp") if g.spletterDropped == "0": db.cur.execute( "update save set val = 1 where var = \"spletterDropped\";" ) g.update() db.cur.execute("update item set locid = \"" + find.plLoc() + "\" where itemid = \"zlatlett\";") else: print(get.dlg("gorhh3")) print(get.text("gordagg")) topicSwitch("gorhelp") if g.spletterDropped == "0": db.cur.execute( "update save set val = 1 where var = \"spletterDropped\";" ) g.update() db.cur.execute("update item set locid = \"" + find.plLoc() + "\" where itemid = \"zlatlett\";") else: print(get.dlg("gornodag")) else: print(get.dlg("gorsigh")) if dlgid == "gorlet2": db.cur.execute( "update people set val = val + 4125 where charid = \"player\";" ) topicSwitch("gorlet2") topicSwitch("gorgreet", "gorgre2", "Greet") setVis("buairpor", 1) if dlgid == "gordone": if ask.yn(): print(get.dlg("gormore")) else: gameOver.End("artifacts") if charid == "bugeorgi": if dlgid == "georgi1": # Traveling if item.valTrans(10, ["player"], ["bugeorgi"], " to take the cab"): db.cur.execute( "update people set locid = \"bueleusa\" where charid = \"player\";" ) db.cur.execute( "update people set locid = \"bueleusa\" where charid = \"bugeorgi\";" ) topicSwitch("georgi1", "georgi2", "Airport") cmd.look() if dlgid == "georgi2": if item.valTrans(10, ["player"], ["bugeorgi"], " to take the cab"): db.cur.execute( "update people set locid = \"buairpor\" where charid = \"player\";" ) db.cur.execute( "update people set locid = \"buairpor\" where charid = \"bugeorgi\";" ) topicSwitch("georgi2", "georgi1", "Eleusa Monastery") cmd.look() if charid == "bumonica": if dlgid == "monica2": setVis("inairpor", 1) if charid == "timonk2": if dlgid == "monk2": setVis("timonyar", 1) if charid == "tizlatin": if dlgid == "zlagem": if ask.yn(): print(get.dlg("zlamyth")) else: print(get.dlg("zlanmyth")) item.transfer(["vikbok2"], ["player"], ["tizlatin"], "give") topicSwitch("zlagem", "zlapet", "Fjörsteinn") if dlgid == "zlapet": setVis("taairpor", 1) setVis("taport", 1) if charid == "taneema": if dlgid == "neema": db.cur.execute( "update people set locid = \"taarusha\" where charid = \"player\";" ) db.cur.execute( "update people set locid = \"taarusha\" where charid = \"taneema\";" ) topicSwitch("neema", "neema1", "Airport") cmd.look() if dlgid == "neema1": db.cur.execute( "update people set locid = \"taoutair\" where charid = \"player\";" ) db.cur.execute( "update people set locid = \"taoutair\" where charid = \"taneema\";" ) topicSwitch("neema1", "neema", "Lake Natron") cmd.look() if charid == "tachief": if dlgid == "chief2": item.transfer(["pet"], ["player"], ["tachief"], "give") topicSwitch("chief2") db.cur.execute( "update save set val = 1 where var = \"backToIndia\";") g.update() if charid == "grjens": if dlgid == "jensword": if ask.yn(): if item.valTrans(1200, ["player"], ["grjens"], " to buy the sword"): item.transfer(["kolbswor"], ["player"], ["grjens"], "buy", 1200) print(get.dlg("jensty")) topicSwitch("jensword") if g.Chapters == "1": print( "\n ---- Chapter VII: Call of the Inca ----\n" ) # Oh my goodness I didn't even realize the pun when I came up with this title. else: print(get.dlg("jensalt")) if g.Chapters == "1": print( "\n ---- Chapter VI: Necklace of a Shaman ----\n" ) if charid == "grsailor": if dlgid == "grsail2": # Traveling if item.valTrans(70, ["player"], ["grsailor"], " to sail"): db.cur.execute( "update people set locid = \"grbay\" where charid = \"player\";" ) db.cur.execute( "update people set locid = \"grbay\" where charid = \"grsailor\";" ) topicSwitch("grsail2", "grsail3", "Back to Port") cmd.look() print(get.text("shiphere")) if dlgid == "grsail3": db.cur.execute( "update people set locid = \"grport\" where charid = \"player\";" ) db.cur.execute( "update people set locid = \"grport\" where charid = \"grsailor\";" ) topicSwitch("grsail3", "grsail2", "Melville Bay") cmd.look() if charid == "grkolbio": if dlgid == "kolrule": # Tell about stolen sword. db.cur.execute( "update people set locid = NULL where charid = \"grlone\";") topicSwitch("", "innlone", "Lone Patron") if dlgid == "kolexch": # Player asks about stuff. db.cur.execute( "update people set locid = NULL where charid = \"grkolbio\";") topicSwitch("kolexch") setVis("peport", 1) if charid == "grinnkee": if dlgid == "innlone": # Tell about Jens. topicSwitch("", "innroom1", "Room") if charid == "pecook": if dlgid == "deusexma": # LET THERE BE TREASURE! topicSwitch("deusexma") setVis("pecave2", 1) # Why would you pick it up?
def say(inputlist, loc): if loc == "grfornw": words = ["mother", "father", "master", "leader", "chief"] if inputlist[0] in words: if g.wolvesGuided == "0": print( "\nYou say the words \"" + parse.liToStr(inputlist) + "\". The ears of both wolves perk up and they freeze. They slowly walk towards you and the other one lets out a slight howl. They brush your knees as they walk past you towards the edge of the crater. You turn around and see the wolves staring at you, waiting.\n" ) db.cur.execute( "update save set val = 1 where var = \"wolvesGuided\";") g.update() db.cur.execute( "update people set locid = \"gredgecr\" where name = \"Tribal Wolf\";" ) setVis("grlair1", 1) if inputlist[0] == "cheat": if len(inputlist) > 1: if inputlist[1] == "loadsamoney": print("MONEY MONEY MONEY") db.cur.execute( "update people set val = val + 1000000 where charid = \"player\";" ) #g.cheatsUsed += 1 if inputlist[0] == "dev": #if inputlist[0] == "eval": # eval(input("EVAL: ")) #if inputlist[0] == "exec": # exec(input("EXEC: ")) if inputlist[1] == "debug": g.toggleDebug() print("[DEV] Debug messages toggled.") if inputlist[1] == "win": gameOver.End("immortality") if inputlist[1] == "tele": db.cur.execute("select locid from location;") ids = parse.multiTupleListToList(db.cur.fetchall()) if inputlist[2] in ids: print("WOOPWOOPWOOP") db.cur.execute("update people set locid = \"" + inputlist[2] + "\" where charid = \"player\";") cmd.look() #g.cheatsUsed += 1 else: print("[DEV] locid \"" + inputlist[2] + "\" not found.") if inputlist[1] == "get": print("GET OVER HERE") empty = find.invSlotByItemID(None) db.cur.execute("select itemid from item;") ids = parse.multiTupleListToList(db.cur.fetchall()) if inputlist[2] in ids: if empty != 0: db.cur.execute("update inventory set item" + str(empty) + " = \"" + inputlist[2] + "\";") #g.cheatsUsed += 1 else: print("[DEV] INVENTORY FULL") else: print("[DEV] itemid \"" + inputlist[2] + "\" not found.") if inputlist[1] == "vis": print("ICANSEEDEADPEOPLE") db.cur.execute("update location set vis = 1;") print("[DEV] All locations visible.")
def move(locid): if locid in g.buylocs: get.storeItems(locid) if locid == "intrrest": if g.inTrainRobbed == "0": db.cur.execute( "update save set val = 1 where var = \"inTrainRobbed\";") g.update() print(get.text("robresta")) db.cur.execute( "update people set locid = \"intrrest\" where name = \"Robber\";" ) if locid == "intrsle1": if g.inTrainRobbed == "1" and g.inTrainRobDone == "0": print(get.text("robescap")) setVis("intrrest", 0) # I don't want to make another global variable for this. if locid == "intrro2": if g.inTrainRobbed == "1" and g.inTrainRobDone == "0": print(get.text("robhide")) db.cur.execute( "update save set val = 1 where var = \"inTrainRobDone\";") g.update() db.cur.execute( "update people set locid = NULL where name = \"Robber\";") setVis("nejaratr", 1) setVis("intrsle2", 1) setVis("intrrest", 1) if locid == "intrsle2": if g.inTrainRobbed == "1" and g.inTrainRobDone == "0": print(get.text("robburst")) db.cur.execute( "update people set locid = \"intrsle2\" where charid = \"inrob1\";" ) setVis("intrsle2", 0) # I don't want to make another global variable for this. if locid == "intrro7": if g.inTrainRobbed == "1" and g.inTrainRobDone == "0": gameOver.slowPrint(get.text("killrob1"), 0.03) gameOver.End("death") if locid == "tipumqu1" or locid == "tipumqu2" or locid == "tipumqu3": print(get.text("tifiboat")) if locid == "titserom" and g.zlaGreet == "0": print(get.dlg("zlagreet")) db.cur.execute("update save set val = 1 where var = \"zlaGreet\";") g.update() if locid == "gredgecr": if g.wolvesGuided == "1": if g.grShamanMeet == "0": print(get.text("wolftrai")) db.cur.execute( "update people set locid = \"grlair2\" where name = \"Tribal Wolf\";" ) if locid == "grlair2": if g.grShamanMeet == "0": db.cur.execute( "update save set val = 1 where var = \"grShamanMeet\";") g.update() if locid == "pepost": print(get.text("phonthin"))
def give(itemid, charid): if g.debug: print("[DBG] action.give:", itemid, charid) if itemid == "budagger": if charid == "spgorka": print(get.dlg("gornotme")) item.transfer(["budagger"], ["player"], ["spgorka"], "give") if itemid == "zlatlett": if charid == "spgorka": print(get.dlg("gorsupr")) topicSwitch("gorhelp", "gorlet2", "Letter") if g.spletterRead == "0": print(get.dlg("gorwoah")) print(get.text("letter")) db.cur.execute( "update save set val = 1 where var = \"spletterRead\";") g.update() setVis("grport", 1) if itemid == "martenit": if charid == "bumonica": print(get.dlg("moniretu")) topicSwitch("monica3") topicSwitch("mongreet", "monica2", "Zlatin Panayotov") if itemid == "fishnet": if charid == "tifisher": print(get.dlg("tifithan")) topicSwitch("fisher1") setVis("tipumqu1", 1) if itemid == "pet": if charid == "tizlatin": print(get.dlg("zlapet2")) topicSwitch("zlapet") item.transfer(["fjorstei"], ["player"], ["tizlatin"], "give") if itemid == "kolbswor": if charid == "grkolbio": print(get.dlg("kolthank")) topicSwitch("kolrule", "kolexch", "Hrosskell") if itemid == "mead": if charid == "grlone": print(get.dlg("lonesea1")) print(get.dlg("lonep1")) print(get.dlg("lonemor1")) if itemid == "mead2": if charid == "grlone": print(get.dlg("lonesea2")) print(get.dlg("lonep2")) print(get.dlg("lonemor2")) if itemid == "mead3": if charid == "grlone": print(get.dlg("lonesea3")) print(get.dlg("lonep3")) topicSwitch("", "grsail2", "Melville Bay") setVis("grbay", 1) if g.debug: print("[DBG] GRBAY VIS:", getVis("grbay")) if itemid == "linskin": if charid == "grvolur": item.transfer(["necklace"], ["player"], ["grvolur"], "give") topicSwitch("volneck") if itemid == "necklace": if charid == "grjens": if "kolbswor" in find.listInvItemIDs(["grjens"]): print(get.dlg("jensgive")) item.transfer(["kolbswor"], ["player"], ["grjens"], "give") topicSwitch("jensword") if g.Chapters == "1": print( "\n ---- Chapter VII: Call of the Inca ----\n" ) if itemid == "divesuit": if charid == "grportma": print(get.dlg("grmawork")) db.cur.execute( "update people set val = val - 500 where charid = \"grportma\";" ) db.cur.execute( "update people set val = val + 500 where charid = \"player\";") if itemid == "fjorstei": if charid == "spgorka": print(get.dlg("gorfjo")) if ask.yn(): print(get.dlg("gormore")) topicSwitch("", "gordone", "Artifacts") else: print( "\n ---- Chapter IX: Fame & Glory ----\n" ) gameOver.End("artifacts") if itemid == "guthjorr": if charid == "spgorka": print(get.dlg("gorgut")) if ask.yn(): print(get.dlg("gormore")) topicSwitch("", "gordone", "Artifacts") else: print( "\n ---- Chapter IX: Fame & Glory ----\n" ) gameOver.End("artifacts") if itemid == "viksword": if charid == "spgorka": print(get.dlg("gorrep")) if ask.yn(): print(get.dlg("gormore")) topicSwitch("", "gordone", "Artifacts") else: print( "\n ---- Chapter IX: Fame & Glory ----\n" ) gameOver.End("artifacts") if itemid == "necklace": if charid == "spgorka": print(get.dlg("gornec")) if ask.yn(): print(get.dlg("gormore")) topicSwitch("", "gordone", "Artifacts") else: print( "\n ---- Chapter IX: Fame & Glory ----\n" ) gameOver.End("artifacts")