Exemplo n.º 1
0
def shoot(*args):
    if "revolver" in find.listInvItemIDs() and "bullets" in find.listInvItemIDs():
        
        objectid = parse.checkArgs(args,"Shoot what?","","shoot")
    
        if objectid:   
            person = find.idFromName(objectid,"people")
                
            while len(person) > 1:
                print(person)
                person = ask.which(person,"people")
            
            if len(person) != 0 and person[0] in g.immortals:
                print("You shot "+find.nameFromID(person, "people")[0]+".")
                action.shoot(person[0])
            elif person:
                if g.debug:
                    print("[DBG] shoot KILL",person)
                
                db.cur.execute("update people set hp = 0 where charid = \""+person[0]+"\";")
                name = find.nameFromID(person, "people")
                print("You shot",name[0], "dead!")
                death.death(person)
                action.shoot(person[0])
                
            else:
                print("Stop shooting like a maniac.")
            
    elif "revolver" and not "bullets" in find.listInvItemIDs():
        print("You don't have any bullets.")
    elif "bullets" and not "revolver" in find.listInvItemIDs():
        print("You don't have your revolver.")
    else:
        print("You cannot shoot without a loaded revolver.")
Exemplo n.º 2
0
def inventory(*args):
    itemlistIDs = find.listInvItemIDs()
    itemnamelist = find.nameFromID(itemlistIDs,"item")
    db.cur.execute("select val from people where charid = \"player\";")
    val = db.cur.fetchall()[0][0]
    
    print("You have",val,"money and you are carrying:")
    for i in itemnamelist:
        if i != None:
            print("-", i)
    if g.debug:
        print("[DBG] inventory FULL:",itemlistIDs)
    print()
Exemplo n.º 3
0
def storeItems(locid):
    """String -> Print"""

    seller = g.buyppl[g.buylocs.index(locid)]
    itemidlist = find.listInvItemIDs([seller])
    itemnamelist = find.nameFromID(itemidlist, "item")
    itemvallist = find.listValueByID(itemidlist, "item")

    if len(seller) == 0:
        print("The store keeper is not here!")
    else:
        print("The storekeeper is " + find.nameFromID([seller], "people")[0] +
              " and has " + str(find.listValueByID([seller], "people")[0]) +
              " money. They sell the following items:")
        for i in range(0, len(itemidlist)):
            print("- " + itemnamelist[i] + " (" + str(itemvallist[i]) + ")")
Exemplo n.º 4
0
def death(charid):
    if g.debug:
        print("[DBG] death", charid[0])

    db.cur.execute("update people set locid = NULL where charid = \"" +
                   charid[0] + "\";")
    deadinv = parse.noneStrip(find.listInvItemIDs(charid, True))

    db.cur.execute("select val from people where charid = \"" + charid[0] +
                   "\";")
    deadval = parse.tupleListToList(db.cur.fetchall())

    plloc = find.plLoc()

    if g.debug:
        print("DEBUG death DEADINV", deadinv)
        print("DEBUG death DEADVAL", deadval)

    if len(deadinv) > 0:
        for i in range(1, len(deadinv)):
            db.cur.execute("update inventory set item" + str(i) +
                           " = NULL where charid = \"" + charid[0] + "\";")

    if len(deadinv) > 0:
        for a in deadinv:
            db.cur.execute("update item set locid = \"" + plloc +
                           "\" where itemid = \"" + a + "\";")

    print("You found " + str(deadval[0]) + " money on " +
          find.nameFromID(charid, "people")[0] + "\'s body.")
    db.cur.execute("update people set val = val + \"" + str(deadval[0]) +
                   "\" where charid = \"player\";")

    if charid[
            0] in g.essentialPeople:  # This must be at the bottom to prevent errors.
        gameOver.End("essential")
Exemplo n.º 5
0
def End(endType):
    """Takes a string as an argument and ends the game."""

    if endType == "essential":
        print(get.text("essentia"))
        cmd.quitgame(True)
        print("\n                          ----    GAME OVER    ----")

    elif endType == "death":
        print(get.text("death"))
        cmd.quitgame(True)
        print("\n                          ----    GAME OVER    ----")

    elif endType == "win":
        print("\nA WINNER IS YOU!\n")
        cmd.quitgame(True)

    elif endType == "artifacts":
        gorkainv = find.listInvItemIDs(["spgorka"])
        plinv = find.listInvItemIDs()

        if g.debug:
            print("[DBG] gameOver GORKA INV", gorkainv)
            print("[DBG] gameOver PL INV", plinv)

        if "necklace" in gorkainv:
            print(get.text("endneckl"))

        if "viksword" in gorkainv:
            print(get.text("endrepli"))

        if "fjorstei" in gorkainv:
            print(get.text("endfjors"))

        if "guthjorr" in gorkainv:
            print(get.text("endguthh"))

        if "guthjorr" in plinv:
            print(get.text("endkguth"))

        if "fjorstei" in plinv:
            print(get.text("endkfjor"))

        cmd.quitgame(True)
        print("\n                           ----    YOU WIN    ----")

    elif endType == "immortality":
        print(get.text("immortal"))
        time.sleep(22)

        ending = get.text("ending")

        for char in ending:
            if char == "@":
                print("\n\n", end="")
                time.sleep(2)
            elif char == ">":
                time.sleep(0.75)
            elif char == "|":
                print(",", end="")
                time.sleep(1)
            elif char == ":":
                time.sleep(0.04)
            elif char == "-":
                time.sleep(0.06)
            elif char == "1":
                print("\n\n", end="")
                time.sleep(2.25)
            elif char == "2":
                print("\n\n", end="")
                time.sleep(2.5)
            elif char == "3":
                print("\n\n", end="")
                time.sleep(2.75)
            elif char == "4":
                time.sleep(2)
                print(".", end="")
            elif char == "5":
                time.sleep(4)
                print("\n")
                time.sleep(4)
            else:
                print(char, end="")
                time.sleep(0.04)

        cmd.quitgame(True)
Exemplo n.º 6
0
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.")
Exemplo n.º 7
0
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?
Exemplo n.º 8
0
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")