コード例 #1
0
 def on_join_users(self, users):
     main_scr = App.get_running_app().get_main_screen()
     user = App.get_running_app().get_user()
     users = users.split()
     for u in users:
         if u == "@" + user.username:
             continue
         if u != user.username:
             main_scr.users[u] = User(u)
             main_scr.ooc_window.add_user(main_scr.users[u])
コード例 #2
0
 def create_user(self, username, character_name, location_name,
                 sublocation_name, position):
     user = User(username)
     self.created_users[username] = user
     self.add_character_to_user(user, character_name)
     self.add_location_to_user(user, location_name)
     self.add_sublocation_to_user(user, sublocation_name)
     self.add_position_to_user(user, position)
     main_screen = App.get_running_app().get_main_screen()
     main_screen.users[username] = user
     main_screen.ooc_window.add_user(user)
コード例 #3
0
ファイル: irc_mo.py プロジェクト: Zumorica/MysteryOnline
 def execute(self, connection_manager, main_screen, user_handler: CurrentUserHandler):
     username = self.sender
     loc = self.location
     if username not in main_screen.users:
         try:
             main_screen.ooc_window.delete_user('@'+username)
         except AttributeError:
             pass
         main_screen.users[username] = User(username)
         main_screen.ooc_window.add_user(main_screen.users[username])
     user = main_screen.users.get(username, None)
     if user.get_loc() is not None and user.get_loc().get_name() != loc:
         main_screen.log_window.add_entry("{} moved to {}. \n".format(user.username, loc))
         main_screen.ooc_window.update_subloc(user.username, user.get_loc().get_real_first_sub())
     else:
         main_screen.ooc_window.update_subloc(user.username, "Missingno")
     user.set_loc(loc, True)
     main_screen.ooc_window.update_loc(user.username, loc)
     main_screen.sprite_window.refresh_sub()
コード例 #4
0
ファイル: irc_mo.py プロジェクト: Zumorica/MysteryOnline
 def on_join(self, username):
     main_scr: MainScreen = App.get_running_app().get_main_screen()
     user_handler: CurrentUserHandler = App.get_running_app().get_user_handler()
     user = user_handler.get_user()
     if user.username == username:
         return
     if username not in main_scr.users:
         main_scr.users[username] = User(username)
         main_scr.ooc_window.add_user(main_scr.users[username])
     main_scr.log_window.add_entry("{} has joined.\n".format(username))
     loc = user_handler.get_current_loc().name
     message_factory = App.get_running_app().get_message_factory()
     loc_message = message_factory.build_location_message(loc)
     self.send_msg(loc_message)
     char = user.get_char()
     if char is not None:
         message_factory = App.get_running_app().get_message_factory()
         char_msg = message_factory.build_character_message(char.name, char.link, char.version)
         self.send_msg(char_msg)
         App.get_running_app().send_current_nullpost()
コード例 #5
0
 def set_current_user(self):
     config = ConfigParser()
     config.read('mysteryonline.ini')
     user = User(self.username)
     user_handler = CurrentUserHandler(user)
     if self.picked_char is not None:
         user.set_char(self.picked_char)
         user.get_char().load()
     else:
         try:
             user.set_char(characters[str(
                 config.get('other', 'last_character'))])
             user.get_char().load()
         except KeyError:
             red_herring = characters['RedHerring']
             user.set_char(red_herring)
             user.get_char().load()
         except configparser.NoSectionError:
             App.get_running_app().build_config(config)
             config.write()
     App.get_running_app().set_user(user)
     App.get_running_app().set_user_handler(user_handler)