Beispiel #1
0
def shoot(charid):
    if charid == "inrob1" or charid == "inrob2" or charid == "inrob3":
        if find.plLoc() == "intrrest":
            gameOver.slowPrint(get.text("killrob2"), 0.03)
            gameOver.End("death")
        elif find.plLoc() == "intrsle2":
            gameOver.slowPrint(get.text("killrob3"), 0.03)
            gameOver.End("death")

    if charid == "tarhino":
        if find.plLoc() == "tanatr3":
            topicSwitch("chief1", "chief2", "Lake Monster")

    if charid == "grwolf" or charid == "grwolf2":
        if find.plLoc() == "grlair2":
            gameOver.slowPrint(get.text("killvolu"), 0.03)
            gameOver.End("death")

    if charid == "grkolbio":
        print(get.text("kolpleas"))

    if charid == "peghost":
        print(get.text("peghhaha"))

    if charid == "peskele":
        print(get.text("skelboom"))
Beispiel #2
0
def say(*args):
    inputlist = parse.checkArgs(args,"Say what?","","say")
    
    if inputlist:
        name = find.nameFromID(["player"],"people")
        print(name[0],"says \""+parse.liToStr(inputlist)+"\"")
        action.say(inputlist,find.plLoc())
Beispiel #3
0
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"))
Beispiel #4
0
def move(mdir):
    db.cur.execute("select "+mdir+" from world where fromid = \""+find.plLoc()+"\";")
    newloc = parse.tupleListToList(db.cur.fetchall())
    
    if newloc[0] == None:
        print("You can't go there.")
    else:
        vis = get.visCheck(newloc[0])
        if vis == False:
            print("You cannot go there!")
        elif vis == True:
            charid = "player"
            db.cur.execute("update people set locid = \""+newloc[0]+"\" where charid = \""+charid+"\";")
            get.allPrints(newloc[0])    # From the new location: automatically print location description, items, people, and available movement
            action.move(newloc[0])
Beispiel #5
0
def call(*args):
    if find.plLoc() in g.callLocs:
        inputlist = parse.checkArgs(args,"Call who?","","call")
    
        if inputlist:
            charid = parse.removeDuplicates(find.idFromName(inputlist,"people",[],False))
            
            while len(charid) > 1:
                charid = ask.which(charid,"people")
            
            if g.debug:
                print("[DBG] call CHARID:",charid)
            
            if charid:
                if charid[0] in g.callPeople:
                    print("Calling "+find.nameFromID(charid,"people")[0]+".")
                    action.call(charid[0])
                else:
                    print("You can't call "+find.nameFromID(charid,"people")[0]+".")
            else:
                print("You can't call that person.")
    else:
        print("There is no phone here.")
Beispiel #6
0
def drop(*args):
    inputlist = parse.checkArgs(args, "Drop what?", "", "drop")

    if inputlist:
        charid = "player"
        itemid = parse.removeDuplicates(
            find.idFromName(inputlist, "item", ["player"]))

        while len(itemid) > 1:
            itemid = ask.which(itemid, "item", ["player"])

        if itemid:
            if len(itemid) != 0:
                slot = find.invSlotByItemID(itemid)
                loc = find.plLoc()
                db.cur.execute("update inventory set item" + str(slot) +
                               " = NULL where charid = \"" + charid + "\";")
                db.cur.execute("update item set locid = \"" + loc +
                               "\" where itemid = \"" + itemid[0] + "\";")
                print(find.nameFromID(itemid, "item")[0] + " dropped.")
            else:
                print("You do not have " + " ".join(inputlist) + ".")
        else:
            print("You do not have " + parse.liToStr(inputlist) + ".")
Beispiel #7
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")
Beispiel #8
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.")
Beispiel #9
0
def examine(*args):
    place = False

    if len(args) == 0:
        place = True
    elif len(args) != 0 and args[0][0] == "here" or args[0][0] == "area":
        place = True
    else:
        inputlist = args[0]

    if not place:
        invitem = find.idFromName(inputlist, "item", ["player"])
        if g.debug:
            print("[DBG] examine ITEM INV:", invitem)

        #if not invitem:
        locitem = find.idFromName(inputlist, "item")
        if g.debug:
            print("[DBG] examine ITEM LOCAL:", locitem)

        person = find.idFromName(inputlist, "people")
        if g.debug:
            print("[DBG] examine PERSON:", person)

        while len(invitem) > 1:
            invitem = ask.which(invitem, "item", ["player"])
            if g.debug:
                print("[DBG] examine ITEM INV LOOP:", invitem)

        while len(locitem) > 1:
            locitem = ask.which(locitem, "item")
            if g.debug:
                print("[DBG] examine ITEM LOCAL LOOP:", locitem)

        while len(person) > 1:
            person = ask.which(person, "people")
            if g.debug:
                print("[DBG] examine PERSON LOOP:", person)

        if g.debug:
            print("[DBG] examine FOUND:", locitem, invitem, person)

        if invitem:
            db.cur.execute(
                "select dsc from itemtype, item where item.itemid = \"" +
                invitem[0] + "\" and item.typeid = itemtype.typeid;")
            result = parse.tupleListToList(db.cur.fetchall())
            if result:
                print(result[0])

        elif locitem:
            db.cur.execute(
                "select dsc from itemtype, item where item.itemid = \"" +
                locitem[0] + "\" and item.typeid = itemtype.typeid;")
            result = parse.tupleListToList(db.cur.fetchall())
            if result:
                print(result[0])

        elif person:
            db.cur.execute("select dsc from people where people.charid = \"" +
                           person[0] + "\";")
            result = parse.tupleListToList(db.cur.fetchall())
            if result:
                print(result[0])
            get.topics(person)
        else:
            print("You cannot examine that.")
    elif place:
        action.examine(find.plLoc())
    else:
        print("ERROR")
Beispiel #10
0
def rent(*args):
    if find.plLoc() in g.rentlocs:
        inputlist = parse.checkArgs(args, "Rent what?", "", "rent")

        if g.debug:
            print("[DBG] rent INPUTLIST:", inputlist)

        if inputlist:
            count = 0
            seller = [g.rentppl[g.rentlocs.index(find.plLoc())]]

            if g.debug:
                print("[DBG] rent ARGS:", seller, find.plLoc())

            if find.plLoc() == "grinn1":
                if inputlist[0] == "room":
                    if action.checkTopic("kolrule") and item.valTrans(
                            100, ["player"], ["grinnkee"], " to rent a room"
                    ):  # Player has spoken to Kolbiorn and has enough money.
                        db.cur.execute(
                            "update people set val = val - 100 where charid = \"player\";"
                        )
                        db.cur.execute(
                            "update people set val = val + 100 where charid = \""
                            + seller[0] + "\";")

                        action.rent("", seller[0], True)
                        count += 1
                else:
                    if count < 1:  # Not an elegant solution but it works. (When found many items.)
                        print("There is no", parse.liToStr(inputlist),
                              "to rent here.")
                    count += 1

            elif seller[0] == "grportma":
                if action.getVis("grbay"):  # Player knows about ship.
                    itemid = parse.removeDuplicates(
                        find.idFromName(inputlist, "item", seller, False))

                    if g.debug:
                        print("[DBG] rent SELLER HAS:", itemid)

                    while len(itemid) > 1:
                        itemid = ask.which(itemid, "item", seller)

                    if g.debug:
                        print("[DBG] rent BUYING:", itemid)

                    if len(itemid) == 1:
                        fromSlot = find.invSlotByItemID(itemid, seller)

                        if fromSlot != 0:  # Found item in inventory.
                            val = find.listValueByID(itemid, "item")[0]
                            string = " to rent " + find.nameFromID(
                                itemid, "item")[0]

                            if item.valTrans(
                                    val, ["player"], seller,
                                    string):  # Player has enough money.
                                item.transfer(itemid, ["player"], seller,
                                              "rent", val)
                                action.rent(itemid[0], seller[0])
                                count += 1
                else:
                    if count < 1:  # Not an elegant solution but it works. (When found many items.)
                        print(
                            "\"What would I need that for?\" you think to yourself."
                        )
                    count += 1

                    if g.debug:
                        print("[DBG] rent BAY VIS:", action.getVis("grbay"))
        else:
            if count < 1:  # Not an elegant solution but it works. (When found many items.)
                print("There is no", parse.liToStr(inputlist), "to rent here.")
            count += 1
    else:
        print("There's nothing to rent here.")
Beispiel #11
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?