示例#1
0
 def main_menu_get_option(self, inp):
     inp = inp.lower()
     if inp == '1':
         self.interp = self.character_login
         self.interp()
     elif inp == '2':
         self.sock.dispatch(helpsys.get_help('motd', server=True))
         self.sock.dispatch('')
         self.main_menu()
     elif inp == 'l':
         self.sock.dispatch(
             'Thanks for playing.  We hope to see you again soon.')
         comm.wiznet(f"{self.sock.host} disconnecting from Akrios.")
         self.sock.handle_close()
         self.clear()
         del self
     elif inp == 'd':
         self.sock.dispatch('Sorry to see you go.  Come again soon!')
         comm.wiznet(f"Character {self.name} deleted by {self.sock.host}")
         os.remove(f"{world.playerDir}/{self.name}.json")
         self.sock.handle_close()
         self.clear()
         del self
     else:
         self.main_menu()
示例#2
0
 def get_roll_stats(self, inp):
     inp = inp.lower()
     if inp == 'y' or inp == 'yes':
         self.sock.dispatch(helpsys.get_help('motd', server=True))
         self.sock.dispatch('')
         newplayer = player.Player()
         newplayer.filename = f"{world.playerDir}/{self.name}.json"
         testsock = self.sock
         newplayer.name = self.name
         newplayer.password = self.password
         newplayer.lasttime = time.ctime()
         newplayer.lasthost = self.sock.host
         newplayer.race = self.newchar['race']
         newplayer.aid = str(uuid.uuid4())
         newplayer.equipped = {
             k: None
             for k in newplayer.race.wearlocations
         }
         newplayer.gender = self.newchar['gender']
         newplayer.discipline = self.newchar['discipline']
         newplayer.position = 'standing'
         newplayer.maximum_stat = self.newstats
         newplayer.current_stat = self.newstats
         self.clear()
         newplayer.sock = testsock
         newplayer.sock.owner = newplayer
         newplayer.prompt = '{pAkriosMUD{g:{x '
         newplayer.sock.promptable = True
         newplayer.write = newplayer.sock.dispatch
         player.playerlist.append(newplayer)
         player.playerlist_by_name[newplayer.name] = newplayer
         player.playerlist_by_aid[newplayer.aid] = newplayer
         newplayer.sock.state['logged in'] = True
         newroom = area.room_by_vnum_global(1001)
         newplayer.move(newroom)
         newplayer.alias['s'] = 'south'
         newplayer.alias['n'] = 'north'
         newplayer.alias['e'] = 'east'
         newplayer.alias['w'] = 'west'
         newplayer.alias['ne'] = 'northeast'
         newplayer.alias['nw'] = 'northwest'
         newplayer.alias['sw'] = 'southwest'
         newplayer.alias['se'] = 'southeast'
         newplayer.alias['l'] = 'look'
         newplayer.alias['page'] = 'beep'
         newplayer.alias['u'] = 'up'
         newplayer.alias['d'] = 'down'
         newplayer.interp('look')
         newplayer.save()
         event.init_events_player(newplayer)
         comm.wiznet(
             f"{newplayer.name} @ {newplayer.sock.host} is a new character entering Akrios."
         )
         del self
     else:
         self.roll_stats()
         self.show_stats()
         self.sock.dispatch('Are these statistics acceptable? ',
                            trail=False)
示例#3
0
 def character_login(self):
     path = f"{world.playerDir}/{self.name}.json"
     if os.path.exists(path):
         newobject = player.Player(path)
         testsock = self.sock
         self.clear()
         newobject.sock = testsock
         newobject.sock.owner = newobject
         newobject.sock.promptable = True
         newobject.sock.state['logged in'] = True
         newobject.write = newobject.sock.dispatch
         if not self.softboot:
             newobject.write("")
             newobject.write(helpsys.get_help("motd", server=True))
             newobject.write("")
         comm.wiznet(
             f"{newobject.name.capitalize()} logging in from {newobject.sock.host}."
         )
         player.playerlist.append(newobject)
         player.playerlist_by_name[newobject.name] = newobject
         player.playerlist_by_aid[newobject.aid] = newobject
         event.init_events_player(newobject)
         newobject.logpath = os.path.join(world.logDir,
                                          f"{newobject.name}.log")
         if newobject.position == "sleeping":
             newobject.write("You are sleeping.")
         else:
             newobject.interp("look")
         if self.softboot:
             newobject.write('')
             newobject.write('Something feels different.')
         if grapevine.LIVE:
             log.debug(
                 f"Sending player login to Grapevine : {newobject.name}")
             asyncio.create_task(
                 grapevine.msg_gen_player_login(newobject.name))
             asyncio.create_task(
                 frontend.msg_gen_player_login(newobject.name,
                                               newobject.sock.session))
         newobject.lasttime = time.ctime()
         newobject.lasthost = newobject.sock.host
     else:
         self.sock.dispatch(
             "There seems to be a problem loading your file!  Notify Jubelo."
         )
         log.error(f"{path} does not exist!")
         self.main_menu()
         self.interp = self.main_menu_get_option
示例#4
0
文件: login.py 项目: DaneBettis/apm
 def get_roll_stats(self, inp):
     inp = inp.lower()
     if inp == 'y' or inp == 'yes':
         self.sock.dispatch(helpsys.get_help('motd', server=True))
         self.sock.dispatch('')
         newplayer = player.Player()
         newplayer.filename = "{0}/{1}".format(world.playerDir, self.name)
         testsock = self.sock
         newplayer.name = self.name
         newplayer.password = self.password
         newplayer.capability.append('player')
         newplayer.lasttime = time.ctime()
         newplayer.lasthost = self.sock.host
         newplayer.race = self.newchar['race']
         newplayer.aid = self.newchar['aid']
         newplayer.gender = self.newchar['gender']
         newplayer.discipline = self.newchar['discipline']
         newplayer.aesthetic = self.newchar['aesthetic']
         newplayer.position = 'standing'
         newplayer.maximum_stat = self.newstats
         newplayer.current_stat = self.newstats
         self.clear()
         newplayer.sock = testsock
         newplayer.sock.owner = newplayer
         newplayer.prompt = '{papmMUD{g:{x '
         newplayer.sock.promptable = True
         newplayer.write = newplayer.sock.dispatch
         player.playerlist.append(newplayer)
         newroom = area.roomByVnum(101)
         newplayer.move(newroom)
         newplayer.alias['s'] = 'south'
         newplayer.alias['n'] = 'north'
         newplayer.alias['e'] = 'east'
         newplayer.alias['w'] = 'west'
         newplayer.alias['ne'] = 'northeast'
         newplayer.alias['nw'] = 'northwest'
         newplayer.alias['sw'] = 'southwest'
         newplayer.alias['se'] = 'southeast'
         newplayer.alias['l'] = 'look'
         newplayer.alias['page'] = 'beep'
         newplayer.interp('look')
         newplayer.save()
         comm.wiznet("{0} is a new character entering APM.".format(newplayer.name))
         del(self)
     else:
         self.roll_stats()
         self.show_stats()
         self.sock.dispatch('Are these statistics acceptable? ', trail=False)
示例#5
0
 async def character_login(self):
     path = f"{world.playerDir}/{self.name}.json"
     if os.path.exists(path):
         log.info(f'Player path exists: {path}')
         newobject = player.Player(path)
         await newobject.load()
         log.info('loaded newobject player')
         testsock = self.sock
         await self.clear()
         newobject.sock = testsock
         newobject.sock.owner = newobject
         log.info(f'newobj.sock = {newobject.sock}')
         log.info(f'newobj.sock.owner = {newobject.sock.owner}')
         newobject.sock.promptable = True
         newobject.sock.state['logged in'] = True
         log.info(f'newobject.sock.state is : {newobject.sock.state}')
         newobject.write = newobject.sock.dispatch
         if not self.softboot:
             await newobject.write("")
             await newobject.sock.dispatch(
                 helpsys.get_help('motd', server=True))
             await newobject.write("")
         log.info(
             f"{newobject.name.capitalize()} logging in from {newobject.sock.host}."
         )
         player.playerlist.append(newobject)
         player.playerlist_by_name[newobject.name] = newobject
         player.playerlist_by_aid[newobject.aid] = newobject
         newobject.logpath = os.path.join(world.logDir,
                                          f"{newobject.name}.log")
         if newobject.position == "sleeping":
             await newobject.write("You are sleeping.")
         elif not self.softboot:
             await newobject.interp("look")
         if self.softboot:
             await newobject.write('\n\rSomething feels different.')
         await newobject.sock.grapevine_login()
         await newobject.sock.fe_login_successful()
         newobject.lasttime = time.ctime()
         newobject.lasthost = newobject.sock.host
     else:
         self.sock.dispatch(
             "There seems to be a problem loading your file!  Notify Jubelo."
         )
         log.error(f"{path} does not exist!")
         await self.main_menu()
         self.interp = self.main_menu_get_option
示例#6
0
 def get_race(self, inp):
     inp = inp.lower()
     if inp in races.racesdict:
         self.newchar['race'] = races.racebyname(inp)
         self.sock.dispatch('')
         self.sock.dispatch("Available genders are: {BFemale Male{x")
         self.sock.dispatch('Please choose a gender: ', trail=False)
         self.interp = self.get_gender
     elif len(inp.split()) > 1:
         if inp.split()[0] == 'help' and inp.split()[1] in races.racesdict:
             self.sock.dispatch(
                 helpsys.get_help(inp.split()[1], server=True))
             self.show_races()
             self.sock.dispatch('Please choose a race: ', trail=False)
     else:
         self.sock.dispatch('That is not a valid race.')
         self.show_races()
         self.sock.dispatch('Please choose a race: ', trail=False)
示例#7
0
文件: login.py 项目: DaneBettis/apm
 def main_menu_get_option(self, inp):
     inp = inp.lower()
     if inp == '1':
         self.interp = self.character_login
         self.interp('')
     elif inp == '2':
         self.sock.dispatch(helpsys.get_help('motd', server=True))
         self.sock.dispatch('')
         self.main_menu()
     elif inp == 'l':
         self.sock.dispatch('Thanks for playing.  We hope to see you again soon.')
         comm.wiznet("{0} disconnecting from APM.".format(self.sock.host))
         self.sock.handle_close()
     elif inp == 'd':
         self.sock.dispatch('Sorry to see you go.  Come again soon!')
         os.remove('{0}/{1}'.format(world.playerDir, self.name))
         self.sock.close()
     else:
         self.main_menu()
示例#8
0
 def get_discipline(self, inp):
     inp = inp.lower()
     if inp in livingthing.disciplines:
         self.newchar['discipline'] = inp
         self.roll_stats()
         self.show_stats()
         self.sock.dispatch('Are these statistics acceptable? ',
                            trail=False)
         self.interp = self.get_roll_stats
     elif len(inp.split()) > 1:
         if inp.split()[0] == 'help' and inp.split(
         )[1] in livingthing.disciplines:
             self.sock.dispatch(
                 helpsys.get_help(inp.split()[1], server=True))
             self.show_disciplines()
             self.sock.dispatch('Please choose a base discipline: ',
                                trail=False)
     else:
         self.sock.dispatch(
             'That is not a valid discipline.  Choose a discipline: ',
             trail=False)
         self.show_disciplines()
示例#9
0
 async def main_menu_get_option(self, inp):
     inp = inp.lower()
     if inp == '1':
         self.interp = self.character_login
         await self.interp()
     elif inp == '2':
         await self.sock.dispatch(helpsys.get_help('motd', server=True))
         await self.sock.dispatch('')
         await self.main_menu()
     elif inp == 'l':
         await self.sock.dispatch(
             'Thanks for playing.  We hope to see you again soon.')
         log.info(f"{self.sock.host} disconnecting from Akrios.")
         asyncio.create_task(self.sock.handle_close())
     elif inp == 'l no_notify':
         asyncio.create_task(self.sock.handle_close('softboot'))
     elif inp == 'd':
         await self.sock.dispatch('Sorry to see you go.  Come again soon!')
         log.info(f"Character {self.name} deleted by {self.sock.host}")
         os.remove(f"{world.playerDir}/{self.name}.json")
         asyncio.create_task(self.sock.handle_close())
     else:
         await self.main_menu()
示例#10
0
文件: login.py 项目: DaneBettis/apm
 def character_login(self, inp):
     path = '{0}\{1}'.format(world.playerDir, self.name)
     if os.path.exists(path):
         newobject = player.Player(path)
         testsock = self.sock
         self.clear()
         newobject.sock = testsock
         newobject.sock.owner = newobject
         newobject.sock.promptable = True
         newobject.write = newobject.sock.dispatch
         newobject.write('')
         newobject.write(helpsys.get_help('motd', server=True))
         newobject.write('')
         comm.wiznet('{0} logging into APM.'.format(newobject.name.capitalize()))
         player.playerlist.append(newobject)
         newobject.logpath = '{0}\{1}'.format(world.logDir, newobject.name)
         comm.log(newobject.logpath, 'Logging in from: {0}'.format(newobject.sock.host))
         newobject.interp('look')
         newobject.lasttime = time.ctime()
         newobject.lasthost = newobject.sock.host
     else:
         self.sock.dispatch('There seems to be a problem loading your file!  Notify an admin.')
         self.main_menu()
         self.interp = self.main_menu_get_option
示例#11
0
 def greeting(self):
     self.sock.dispatch(helpsys.get_help('greet', server=True))
     self.sock.dispatch('\n\rPlease choose a character name: ', trail=False)
示例#12
0
文件: login.py 项目: DaneBettis/apm
 def greeting(self):
     self.sock.dispatch(helpsys.get_help('greet', server=True ))
     self.sock.dispatch('\n\rPlease choose a character name: ', trail=False)