示例#1
0
	def GO(self, cmd, cmds, msg):
		if ("hole", "room", "301") in msg: setArea("room301")
		elif "ladder" in msg: setArea("hotelground")
		elif ("jump", "bush") in msg:
			raw_input("Alright, you're going to jump...")
			raw_input("You take a deep breath, and run towards the south edge...")
			say("And chicken out; what if the core gets damaged?")
示例#2
0
	def GO(self, cmd, cmds, msg):
		if "flashlighton" not in States: say("You can't see anything, but feel your way to the door.")
		if "stair" in msg:
			setArea("stairs")
		elif ("staff", "syaff") in msg:
			if "3f_manage_unlocked" in States: say("It may be unlocked, but you still can't reach it.")
			else: say("You cannot reach that door, and besides, it's locked anyway.")
		elif ("room", "301") in msg:
			setArea("room301")
示例#3
0
文件: hotel.py 项目: Nebual/rimsky
	def GO(self, cmd, cmds, msg):
		if "stair" in msg:
			if not "stairdoor" in States:
				say("The doorknob to the stairs refuses to turn. It is likely locked.")
			else:
				setArea("stairs")
		elif ("bathroom", "washroom") in msg:
			setArea("washroom")
		elif "cafe" in msg:
			setArea("cafe")
		elif "manage" in msg:
			if "managedoor" not in States:
				say("The Management door does not wish to be opened. It is likely locked.")
			else:
				say("You open the freshly unlocked Management door. Or at least, you tried, but there's too much rubble on the other side to get past. At least you still have the key, maybe there'll be another office?")
		elif "entrance" in msg:
			say("You can't leave the hotel, you don't have the Core yet.")
		elif "suppli" in msg:
			if "suppliesdoor" not in States:
				say("The Supplies door is closed, and you can't seem to make it open. It is likely locked.")
			else:
				setArea("supplies")
		elif "test" in msg: setArea("test")
示例#4
0
	def GO(self, cmd, cmds, msg):
		if ("stair") in msg:
			setArea("stairs")
		elif ("201") in msg:
			setArea("room201")
		elif ("202") in msg:
			setArea("room202")
		elif ("203") in msg:
			say("The door to Room203 won't open. Tsk tsk.")
示例#5
0
	def GO(self, cmd, cmds, msg):
		if ("lobby", "first", "1") in msg:
			setArea("lobby")
		elif ("second", "2") in msg:
			setArea("floor2")
		elif ("third", "3") in msg:
			if "stairs_mattress_cut" in States:
				del States["flashlighton"]
				setArea("floor3")
			else: say("There remains a large mattress between you and the third floor door.")
示例#6
0
	def GO(self, cmd, cmds, msg):
		if ("river", "97", "road", "highway", "black") in msg: setArea("us97")
		elif ("lobby", "hotel", "door") in msg: setArea("lobby")
示例#7
0
文件: fade.py 项目: Nebual/fade
def parseCMD(msg):
    msg = SearchableString(msg.lower())
    cmds = msg.split()
    cmd = SearchableString(len(cmds) > 0 and cmds[0] or "")

    curArea = Areas[States["area"]]
    if cmd == "load":
        SaveName = len(cmds) > 1 and cmds[1] or input("Save name: >")
        if SaveName:
            NewStates, NewInventory = dson.load(
                open(getSaveDir() + SaveName + ".dson", "r"))
            States.clear()
            Inventory.clear()
            States.update(NewStates)
            Inventory.update(NewInventory)
            print("== Progress loaded from '" + SaveName + ".dson' ==")
    elif cmd == "save":
        SaveName = len(cmds) > 1 and cmds[1] or input("Save name: >")
        if SaveName:
            dson.dump((States, Inventory),
                      open(getSaveDir() + SaveName + ".dson", "w"),
                      indent=2)
            print("== Progress saved to '" + SaveName + ".dson' ==")
    elif cmd in ("clear", "cls"):
        consolelib.clear()
        print(" ")
    elif cmd in ("h", "help"):
        print("You consider for a moment the verbs you've learned:\n"
              "go/enter [room]\n"
              "back/return/last goes to previous room\n"
              "look/examine/view [object]\n"
              "grab/pick/get/take [object]\n"
              "use [object] on [object]\n"
              "lockpick [object]\n"
              "time\n"
              "map\n"
              "i/inventory\n"
              "save [filename]\n"
              "load [filename]")
    elif cmd in ("i", "inventory"):
        if "backpack" in States:
            print(
                "You stop and look at the contents of your leather backpack:")
            for item in Inventory.values():
                print("\t- " + item)
            print("\t- Lockpicking pins: " + str(States["pins"]))
            print("\t- Money: $%.2f" % States["money"])
        else:
            say("There isn't anything in your pockets. You try to start missions light."
                )
    elif cmd in ("time", "watch"):
        if "watch" in States:
            say("You glance at your Booker's display of the current local time: "
                + getTime())
        else:
            say("Your booker's internal clock hasn't been configured for this locale, and is still displaying your home time: "
                + str(int(States["time"] / 1.44)))
    elif cmd in ("map", ):
        say("You review your Booker's spatial layouting program.")
        with consolelib.lineByLine(0.03):
            openMap(curArea.zone)
    elif cmd == "" or (cmd in LOOK and len(cmds) == 1):
        curArea.describe()
    elif cmd in ("back", "return", "last") or "go back" in msg:
        if "lastarea" in States: setArea(States["lastarea"])
        else: say("You just walked into the building, you can't leave yet.")
    elif cmd in GO:
        curArea.GO(cmd, cmds, msg)
    elif cmd in LOOK:
        if ("booker", "arm") in msg:
            say("The Booker on your arm is an advanced Personal Information Processor. The 2000 model premiered in the year 8AA, and is primarily built from salvaged Old world components modified to support an MF power core. Its many features include a watch, 3D scanner, 1w laser pointer (doubles as a microwelder), journal logging, and flying toasters screensaver."
                )
        elif ("keyhole") in msg:
            say("You peer through the door's keyhole, but can't see anything, since there's a lock in the way."
                )
        else:
            curArea.LOOK(cmd, cmds, msg)
    elif cmd in GET:
        curArea.GET(cmd, cmds, msg)
    elif cmd in USE:
        with consolelib.listenPrints() as printedString:
            curArea.USE(cmd, cmds, msg)
        if printedString[0]: pass
        elif "magazines" in Inventory and ("maga", "zine") in msg:
            say("Is now the best time to be doing that?")
        elif "crochetagebook" in Inventory and "crochet" in msg:
            say("You flip through the booklet, but you can't understand the language. The diagrams detail the basics of picking locks."
                )
        elif ("water", "hydra",
              "bottle") in msg and "waterbottle" in Inventory:
            say("You're not thirsty at the moment.")
    elif cmd in LOCKPICK:
        if len(cmds) == 1:
            say("What locked object do you want to pick?")
        else:
            curArea.LOCKPICK(cmd, cmds, msg)
    elif "bumbl" in cmd:
        say("Bumbling around into furniture isn't really productive."
            "Besides, you're supposed to follow 'leave no trace' when Seeking."
            )
    elif ("break", "kick", "smash") in cmd:
        say("Seekers can't just go around breaking things, especially not in old ruins."
            )
    elif ("hello", "hi", "hey") in cmd:
        say("Ello.")
    elif ("yes") in cmd:
        say("Nope.")
    elif ("no") in cmd:
        say("Yep.")
示例#8
0
	def GO(self, cmd, cmds, msg):
		if ("hall", "door") in msg:
			if "core_obtained" not in States: setArea("floor3")
			else: say("The door won't budge; the crater's collapse must have blocked it.")
		elif ("hole", "beam", "roof", "metal") in msg: setArea("rooftop")
示例#9
0
			time.sleep(0.18)
		time.sleep(0.8)
		consolelib.clear()
		time.sleep(0.3)
		
	if "time" not in States:
		#New game!
		States["time"] = 9*60
		States["pins"] = 0
		States["money"] = 3
		consolelib.clear()
		if(raw_input("""\n\n\n\n\n\n\n\n\n\n\n
                      There is much to see in this world,
                  take care to `look` at everything you find.
\n\n\n\n\n\n
                          [Press Enter to Start Game]
                   [Type 'help' at any time to list commands]
\n""") == "help"): parseCMD("help")
		setArea("lobby")
	
	WasKBInterrupt = False
	try:
		main()
	except KeyboardInterrupt:
		WasKBInterrupt = True
	finally:
		if not WasKBInterrupt:
			print("Eeek we crashed! Emergency saving to crash.dson...")
			dson.dump((States, Inventory), open("crash.dson","w"))
			print("Save successful! Printing stacktrace:\n")
示例#10
0
	def GO(self, cmd, cmds, msg):
		if "hall" in msg: say("The lock on the door to the hallway is smashed beyond use, and unlike in the tapes, this means the door is actually unopenable.")
		elif ("balcon") in msg: setArea("floor2balcony")
示例#11
0
	def GO(self, cmd, cmds, msg):
		if ("hole", "202") in msg: setArea("room202")
		elif ("door", "203") in msg:
			if "room203_balconyunlocked" in States: setArea("room203")
			else: say("The door to Room203 is most certainly, without a doubt, probably locked. Or stuck. You're leaning towards locked.")
示例#12
0
	def GO(self, cmd, cmds, msg):
		if "hall" in msg: setArea("floor2")
		elif ("hole", "balc") in msg: setArea("floor2balcony")
示例#13
0
	def GO(self, cmd, cmds, msg):
		if "hallway" in msg: setArea("floor2")
示例#14
0
文件: fade.py 项目: Nebual/fade
    if "time" not in States:
        #New game!
        States["time"] = 9 * 60
        States["pins"] = 0
        States["money"] = 3
        consolelib.clear()
        if (input("""\n\n\n\n\n\n\n\n\n\n\n
                      There is much to see in this world,
                  take care to `look` at everything you find.
\n\n\n\n\n\n
                          [Press Enter to Start Game]
                   [Type 'help' at any time to list commands]
\n""") == "help"):
            parseCMD("help")
        setArea("lobby")

    WasKBInterrupt = False
    try:
        main()
    except KeyboardInterrupt:
        WasKBInterrupt = True
    finally:
        if not WasKBInterrupt:
            print("Eeek we crashed! Emergency saving to crash.dson... ",
                  end="")
            dson.dump((States, Inventory),
                      open(getSaveDir() + "crash.dson", "w"),
                      indent=2)
            print("Save successful! Printing stacktrace:\n")
        else:
示例#15
0
	def GO(self, cmd, cmds, msg):
		if "lobby" in msg: setArea("lobby")
示例#16
0
	def GO(self, cmd, cmds, msg):
		if "lobby" in msg:
			setArea("lobby")
		elif ("food", "prep") in msg:
			say("The food preparation area is part of the Cafe; clearly the architect was a fan of open room design ethos.")
示例#17
0
def parseCMD(msg):
	cmds = msg.split(); cmd = SearchableString(len(cmds) > 0 and cmds[0] or "")
	curArea = Areas[States["area"]]
	if cmd == "load":
		SaveName = len(cmds) > 1 and cmds[1] or raw_input("Save name: >")
		if SaveName:
			NewStates, NewInventory = dson.load(open(SaveName+".dson","r"))
			States.clear(); Inventory.clear()
			States.update(NewStates); Inventory.update(NewInventory)
			print("== Progress loaded from '"+SaveName+".dson' ==")
	elif cmd == "save":
		SaveName = len(cmds) > 1 and cmds[1] or raw_input("Save name: >")
		if SaveName:
			dson.dump((States, Inventory), open(SaveName+".dson","w"), indent=2)
			print("== Progress saved to '"+SaveName+".dson' ==")
	elif cmd in ("clear", "cls"):
		consolelib.clear()
		print(" ")
	elif cmd in ("h", "help"):
		print ("You consider for a moment the verbs you've learned:\n"
			"go/enter [room]\n"
			"back/return/last goes to previous room\n"
			"look/examine/view [object]\n"
			"grab/pick/get/take [object]\n"
			"use [object] on [object]\n"
			"lockpick [object]\n"
			"time\n"
			"map\n"
			"i/inventory\n"
			"save [filename]\n"
			"load [filename]")
	elif cmd in ("i", "inventory"):
		if "backpack" in States:
			print("You stop and look at the contents of your leather backpack:")
			for item in Inventory.values():
				print("\t- "+item)
			print("\t- Lockpicking pins: "+str(States["pins"]))
			print("\t- Money: $%.2f" % States["money"])
		else:
			say("There isn't anything in your pockets. You try to start missions light.")
	elif cmd in ("time", "watch"):
		if "watch" in States: say("You glance at your Booker's display of the current local time: "+getTime())
		else: say("Your booker's internal clock hasn't been configured for this locale, and is still displaying your home time: " + str(int(States["time"]/1.44)))
	elif cmd in ("map",):
		say("You review your Booker's spatial layouting program.")
		with consolelib.lineByLine(0.03):
			openMap(curArea.zone)
	elif cmd == "" or (cmd in LOOK and len(cmds) == 1):
		curArea.describe()
	elif cmd in ("back", "return", "last") or "go back" in msg:
		if "lastarea" in States: setArea(States["lastarea"])
		else: say("You just walked into the building, you can't leave yet.")
	elif cmd in GO:
		curArea.GO(cmd, cmds, msg)
	elif cmd in LOOK:
		if ("booker", "arm") in msg:
			say("The Booker on your arm is an advanced Personal Information Processor. The 2000 model premiered in the year 8AA, and is primarily built from salvaged Old world components modified to support an MF power core. Its many features include a watch, 3D scanner, 1w laser pointer (doubles as a microwelder), journal logging, and flying toasters screensaver.")
		elif ("keyhole") in msg: say("You peer through the door's keyhole, but can't see anything, since there's a lock in the way.")
		else:
			curArea.LOOK(cmd, cmds, msg)
	elif cmd in GET:
		curArea.GET(cmd, cmds, msg)
	elif cmd in USE:
		with consolelib.listenPrints() as printedString:
			curArea.USE(cmd, cmds, msg)
		if printedString[0]: pass
		elif "magazines" in Inventory and ("maga", "zine") in msg:
			say("Is now the best time to be doing that?")
		elif "crochetagebook" in Inventory and "crochet" in msg:
			say("You flip through the booklet, but you can't understand the language. The diagrams detail the basics of picking locks.")
		elif ("water", "hydra", "bottle") in msg and "waterbottle" in Inventory:
			say("You're not thirsty at the moment.")
	elif cmd in LOCKPICK:
		if len(cmds) == 1:
			say("What locked object do you want to pick?")
		else:
			curArea.LOCKPICK(cmd, cmds, msg)
	elif "bumbl" in cmd:
		say("Bumbling around into furniture isn't really productive."
			"Besides, you're supposed to follow 'leave no trace' when Seeking.")
	elif ("break", "kick", "smash") in cmd:
		say("Seekers can't just go around breaking things, especially not in old ruins.")
	elif ("hello", "hi", "hey") in cmd: say("Ello.")
	elif ("yes") in cmd: say("Nope.")
	elif ("no") in cmd: say("Yep.")