Esempio n. 1
0
def talk(*args):
    inputlist, i = parse.checkArgs(args, "Talk to who about what?", "about",
                                   "to", "talk")
    valid = True

    if inputlist:
        charid = parse.removeDuplicates(
            find.idFromName(inputlist[:i], "people"))

        while len(charid) > 1:
            charid = ask.which(charid, "people")

        if len(charid) == 0:
            print("That person is not here.")
            valid = False
        elif valid:
            dialogid = parse.removeDuplicates(
                find.idFromName(inputlist[i + 1:], "topic", charid, False))

            while len(dialogid) > 1:
                dialogid = ask.which(dialogid, "topic", charid)

            if len(dialogid) == 0:
                print(
                    find.nameFromID(charid, "people")[0] +
                    " doesn't seem to know anything about that.")
                valid = False
            elif valid:
                print(get.dlg(dialogid[0]))
                action.talk(charid[0], dialogid[0])
Esempio n. 2
0
def take(*args):
    inputlist = parse.checkArgs(args, "Take what?", "", "take")

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

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

        if len(itemid) != 0 and itemid[0] == "altar":
            print("\"That is way too heavy to carry, let alone move.\"")

        elif itemid:
            slot = find.invSlotByItemID(None)

            if g.debug:
                print("[DBG] take TO SLOT:", slot)

            if slot != 0:
                db.cur.execute(
                    "update item set locid = \"INV\" where itemid = \"" +
                    itemid[0] + "\";")
                db.cur.execute("update inventory set item" + str(slot) +
                               " = \"" + itemid[0] + "\" where charid = \"" +
                               charid + "\";")
                print(find.nameFromID(itemid, "item")[0] + " taken.")
                action.take(itemid[0])
            else:
                print("Your inventory is full.")
        else:
            print(parse.liToStr(inputlist) + " is not here.")
Esempio n. 3
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.")
Esempio n. 4
0
def greet(*args):
    inputlist = parse.checkArgs(args, "Greet who?", "", "greet")

    if inputlist:
        charid = find.idFromName(inputlist, "people")

        while len(charid) > 1:
            charid = ask.which(charid, "people")

        if charid:
            if len(charid) > 1:
                greet(ask.which(charid), "people")
            else:
                action.greet(charid[0])
                get.topics(charid)
        else:
            print("That person is not here.")
Esempio n. 5
0
def give(*args):
    inputlist, i = parse.checkArgs(args, "Give what to who?", "to")
    valid = True

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

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

        if len(itemid) == 0:
            print("You do not have that item.")
            valid = False
        elif valid:
            charid = parse.removeDuplicates(
                find.idFromName(inputlist[i + 1:], "people"))

            while len(charid) > 1:
                charid = ask.which(charid, "people")

            if len(charid) == 0:
                print("That person is not here.")
                valid = False
            elif valid:
                rightPerson = g.criticalItemPeople[g.criticalItem.index(
                    itemid[0])]

                if g.debug:
                    print("[DBG] give CRITICAL ITEM", itemid, charid,
                          rightPerson)

                if itemid[0] in g.criticalItem and charid[0] == rightPerson:
                    item.transfer(itemid, charid)
                    action.give(itemid[0], charid[0])
                elif itemid[0] == "necklace" and charid[0] == "spgorka":
                    item.transfer(itemid, charid)
                    action.give(itemid[0], charid[0])
                else:
                    print(get.text("dontgive"))
Esempio n. 6
0
def attack(*args):
    objectid = parse.checkArgs(args,"Who do you want to attack?","","attack")
    
    if objectid:
        person = find.idFromName(objectid,"people")
            
        while len(person) > 1:
            print(person)
            person = ask.which(person,"people")
        
        if person:
            db.cur.execute("update people set hp = hp-10 where charid = \""+person[0]+"\";")
            name = find.nameFromID(person,"people")
            print("You gave",name[0], "a black eye.")
            
        else:
            print("Stop waving your hands around pointlessly!")
Esempio n. 7
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.")
Esempio n. 8
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) + ".")
Esempio n. 9
0
def use(*args):
    two = True
    valid = True
    
    if len(args) == 0:
        inputlist = parse.checkArgs(args,"Use what?","","use")
    else:
        inputlist = args[0]
    
    if g.debug:
        print("[DBG] use INPUTLIST:",inputlist)
        
    try:
        i = inputlist.index("on")
        two = True
    except ValueError:
        try:
            i = inputlist.index("with")
            two = True
        except ValueError:
            two = False
    
    if g.debug and two:
        print("[DBG] use INDEX:",i)
    
    if not two:
        item1 = parse.removeDuplicates(find.idFromName(inputlist,"item",["player"]))
        
        while len(item1) > 1:
            item1 = ask.which(item1,"item",["player"])

        if len(item1) == 0:
            print("You have no such item.")
        else:
            action.use(item1[0])
    else:
        item1 = parse.removeDuplicates(find.idFromName(inputlist[:i],"item",["player"]))
        
        while len(item1) > 1:
            item1 = ask.which(item1,"item",["player"])
            
        if len(item1) == 0:
            print("You do not have that item.")
            valid = False
        
        if g.debug:
            print("[DBG] use ITEM1:",item1,valid)
        
        if valid:
            
            item2 = parse.removeDuplicates(find.idFromName(inputlist[i+1:],"item"))
            
            if not item2:
                item2 = parse.removeDuplicates(find.idFromName(inputlist[i+1:],"item",["player"]))
            
            if g.debug:
                print("[DBG] use ITEM2:",item2)
            
            while len(item2) > 1:
                item2 = ask.which(item2,"item")
            
            if len(item2) == 0:
                print("That item is not here.")
                valid = False
            elif valid:
                action.use(item1[0],item2[0])
Esempio n. 10
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.")
Esempio n. 11
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")
Esempio n. 12
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.")