Ejemplo n.º 1
0
    def move(self, dir):

        #global hint_count
        #dir = dir.lower()
        #print("direction to go: " + dir)
        newroom = self.loc._neighbor(dir)

        if newroom is None:
            if hints['hint'] == 3:
                print(
                    "Type (help) to open your command list and (m) to open the map."
                )
                hints['hint'] = 0
            else:
                print("You can't do that.")
                hints['hint'] += 1

        else:
            # newroom = newroom.lower()
            self.loc = get_room(newroom)
            self.look()
            #update inventory
            if self.loc.equipped != '':
                player_equip["equipped"] = self.loc.equipped
            if self.loc.swords != '':
                player_equip["sword"] = self.loc.swords
            if self.loc.shields != '':
                player_equip["shield"] = self.loc.shields

            if self.loc.name == "Village - Market":
                area["merchant_visited"] = "1"

            if self.loc.name == "Forest - Entrance":
                area["forest_visited"] = "1"
Ejemplo n.º 2
0
    def __init__(self):
        cmd.Cmd.__init__(self)
        #to play the music
        winsound.PlaySound("../zelda_intro.wav",
                           winsound.SND_ASYNC | winsound.SND_LOOP)
        asciiart = []
        asciiart = [
            "       __________",
            "       \        /    T  H  E    L  E  G  E  N  D    O  F",
            "        \      /     ___________      __________    _____",
            "        /     /      \     /\   \     |    /\  |   /    /",
            "       /     /        |   |  ||\ \    |   |  | |  /    /",
            "      /     /         |   |  || \ \   |   |  | | /    /",
            "     /     /          |   |  ||  \ \  |   |  | |/    /",
            "    /     /           |   |  ||   \ \ |   |  |      <",
            "   /     /            |   |  ||    \ \|   |  | |\     \\",
            "  /     /             |   |  ||     \     |  | | \     \\",
            " /     /_____________/_____\/_|      \_____\/__|  \_____\\",
            "/____________________/    AN  INTERACTIVE  FANFICTION"
        ]

        for i in asciiart:
            print("\t" + i)
        print("")
        print("")
        print("")
        print("")

        self.loc = get_room(1)
        self.look()
Ejemplo n.º 3
0
	def move(self,direction):
		newroom = self.location._neighbor(direction)
		if newroom is None:
			print("You can't go that way")
		else:
			self.location = get_room(newroom) #buraya get_room fonksiyonu eklenecek
			self.look()
Ejemplo n.º 4
0
 def move(self, dir):
     newroom = self.loc._neighbors(dir)
     if newroom is None:
         print("you can't go that way")
     else:
         self.loc = get_room(newroom)
         self.look()
Ejemplo n.º 5
0
	def __init__(self):
		cmd.Cmd.__init__(self)
		self.location = get_room(1)
		name,building = choose_character()
		self.player = Player(name,building)
		self.my_character()
		self.look()
Ejemplo n.º 6
0
 def __init__(self):
     cmd.Cmd.__init__(self)
     self.dbfile = tempfile.mktemp()
     shutil.copyfile("game.db",self.dbfile)
     
     self.location = get_room(1,self.dbfile)
     self.look()
Ejemplo n.º 7
0
async def connect(sid, environ):
    room_id = parse_qs(
        environ.get('QUERY_STRING'))['room_id'][0]  # ToDo: エラー処理

    await sio.save_session(sid, {'room_id': room_id})
    sio.enter_room(sid, room_id)

    await sio.emit('current', room.get_room(room_id), room=sid)
Ejemplo n.º 8
0
 def move(self, dir):
     # print "moving " + dir
     newsroom = self.loc.getNeighbor(dir)
     # print "found " + str(newsroom)
     if newsroom is None:
         print("You stumble into a wall")
     else:
         self.loc = get_room(newsroom)
Ejemplo n.º 9
0
	def __init__(self):
		cmd.Cmd.__init__(self)

		self.dbfile = tempfile.mktemp()
		shutil.copyfile("game.db", self.dbfile)

		self.loc = get_room(41, self.dbfile)
		self.printroom()
Ejemplo n.º 10
0
 def move(self, dir):
     newroom = self.loc._neighbor(dir)
     if newroom is None:
         print('''You cannot go this away''')
         self.look()
     else:
         self.loc = get_room(newroom)
         self.look()
Ejemplo n.º 11
0
async def update(sid, room_id, data):
    # ToDo: パラメータチェック
    print('Update', room_id, data)
    room.update_room(room_id, data)
    await sio.emit('update',
                   room.get_room(room_id),
                   room=room_id,
                   skip_sid=sid)
Ejemplo n.º 12
0
    def move(self, dir):
        newroom = self.loc._neighbor(dir)
        if newroom is None:
            print("you can't go that way")
        else:
            self.loc = get_room(newroom, self.dbfile)
            self.look()

        if newroom == 13:
            exit()
Ejemplo n.º 13
0
 def __init__(self):
     #initialize program
     cmd.Cmd.__init__(self)
     self.dbfile = tempfile.mktemp()
     shutil.copyfile("database/quarenteendb.db", self.dbfile)
     self.loc = get_room(1, self.dbfile)
     self.gameItems = get_items(1, self.dbfile)
     self.gameRooms = get_rooms(1, self.dbfile)
     self.inventory = []
     self.PrintIntro()
Ejemplo n.º 14
0
    def move(self, dir):
        newroom = self.loc._neighbor(dir)
        if newroom is None:
            print("you can't go that way")
        else:
            self.loc = get_room(newroom, self.dbfile)
            self.look()

        if newroom == 13:
            exit()
Ejemplo n.º 15
0
async def update(sid, data):
    session = await sio.get_session(sid)
    room_id = session['room_id']

    room.update_room(room_id, data)

    await sio.emit('update',
                   room.get_room(room_id),
                   room=room_id,
                   skip_sid=sid)
Ejemplo n.º 16
0
    def move(self,dir):
        newroom = self.location._neighbor(dir)
        if newroom is None:
            print('You cannot go that way')
        else:
            self.location = get_room(newroom,self.dbfile)
            self.look()

        if newroom == 13:
            exit()
Ejemplo n.º 17
0
    def __init__(self):
#-----------------------------------------------------------------------
#Here the game is initialized asking for commands via the Cmd module,
#the variables given are the first room you start in and prints out the
#location

        cmd.Cmd.__init__(self)
        self.loc = get_room('intro')
        self.look()
        self.inventory = Inventory()
        self.player = Player()
Ejemplo n.º 18
0
	def move(self, dir):
		newroom = self.loc._neighbor(dir)
		if newroom is None:
			print ("sorry, can't go that way.")
		else:
			self.loc = get_room(newroom, self.dbfile)
			self.printroom()

		if newroom == 82 or 83 or 84:
			print ("sorry, have nothing made for this location yet, so you died from a random flying boulder with a splat!")
			self.dead
Ejemplo n.º 19
0
    def move(self, dir):
        newroom = self.loc._neighbor(dir)
        if newroom is None or newroom == 0:
            print("You can't go that way.")
            self.PrintSpace()
        else:
            self.loc = get_room(newroom, self.dbfile)
            self.look()

        if newroom == 13:
            exit()
Ejemplo n.º 20
0
    def __init__(self):
        self.dbfile = tempfile.mktemp()
        self.copyAttempts = 0
        self.copyDatabaseFile()
        print("-" * 40)

        self.loc = get_room(1, self.dbfile)
        self.input = ""
        self.validCommands = []
        self.getValidCommands()
        self.printStartMessage()
        self.look()
Ejemplo n.º 21
0
def do_peer(peer, args):
    import room
    if len(args) < 1:
        peer.account.player.send("Peer in which direction?")
        return
    direction = _.get_dir_constant(args.split()[0])
    
    temp_room = peer.account.player.get_room()
    temp_new_room_vnum = temp_room.exits[direction]
    if temp_new_room_vnum is None:
        peer.account.player.send("There's nothing in that direction.")
        return
    elif temp_new_room_vnum not in [x.vnum for x in _.rooms]:
        peer.account.player.send("Illegal room. Contact an immortal.\n\r")
        return
    peer.account.player.send("You peer intensely and see...\n\r\n\r" + room.get_room(temp_new_room_vnum).display(peer));
Ejemplo n.º 22
0
def modify_room():
    name = request.args.get('name', '')

    _tmp_name = room.get_room(name)
    _name = ''
    _error = ''
    _addr = ''
    _iprange = ''
    if _tmp_name is None:
        _error = '用户信息不存在'
    else:
        _name = _tmp_name.get('name')
        _addr = _tmp_name.get('addr')
        _iprange = _tmp_name.get('iprange')

    return render_template('room_modify.html', error=_error, addr=_addr, iprange=_iprange, name=_name)
Ejemplo n.º 23
0
 def move(self, dir):  #Allows you to move
     newroom = self.loc._neighbors(dir)
     if newroom is None:  #If there isn't a room
         print("you can't go that way")
     else:  #conditions that automatically end the story
         self.loc = get_room(newroom)
         self.look()
         if (newroom == 11) or (newroom == 7) or (newroom == 15):
             print("Congrats, you made it!")
             time.sleep(5)
             exit()
         if (newroom == 16) or (newroom == 17) or (newroom == 18) or (
                 newroom == 19) or (newroom == 20) or (newroom == 21) or (
                     newroom == 22) or (newroom == 23) or (newroom == 24):
             print("You suffer a horrible death")
             print("Game Over")
             time.sleep(5)
             exit()
Ejemplo n.º 24
0
    def __init__(self):
        cmd.Cmd.__init__(self)
        cmd.Cmd.prompt = ':'
        """cmd.Cmd.doc_header = "" <- change this later """
        """ If no save exists print out motd """
        """ Else we print a return message to continue game"""
        print("""
                    .---..    .       .  .   .  .           .
                    |    |    |        \  \ /  /            |
                    |--- | .-.| .-. .--.\  \  /.-.  .-.  .-.|
                    |    |(   |(.-' |  | \/ \/(   )(   )(   |
                    '---'`-`-'`-`--''  `- ' '  `-'  `-'  `-'`-

================================================================================
""")
        print("Welcome adventurer, to the world of EldenWood!")

        self.loc = get_room(0)
        self.look()
Ejemplo n.º 25
0
async def enter(sid, room_id):
    # ToDo: 入力条件
    print('Enter', sid, room_id)
    sio.enter_room(sid, room_id)
    await sio.emit('current', room.get_room(room_id), room=sid)
Ejemplo n.º 26
0
    def __init__(self):
        cmd.Cmd.__init__(self)

        self.loc = get_room(1)  #Gets the first room
        self.look()
Ejemplo n.º 27
0
    def __init__(self):
        cmd.Cmd.__init__(self)

        self.loc = get_room(1)
        self.look()
        self.pp = pprint.PrettyPrinter(indent=4,depth=6)
Ejemplo n.º 28
0
 def move(self, dir):
     newroom = self.loc._neighbors(dir)
     if newroom is None:
         print ("you can't go that way")
     else:
         self.loc = get_room(newroom)
Ejemplo n.º 29
0
 def __init__(self):
     cmd.Cmd.__init__(self)
     self.loc = get_room(1)