예제 #1
0
 def level_unlocked(self, user, level):
     ''' Callback for when a team unlocks a new level '''
     message = "%s unlocked level #%d." % (user.team.name, level.number)
     Notification.create_broadcast(user.team, "Level Unlocked", message,
                                   SUCCESS)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #2
0
 def player_swated(self, user, target):
     message = "%s called the SWAT team on %s." % (user.handle,
                                                   target.handle)
     Notification.create_broadcast(user.team, "Player Arrested!", message,
                                   INFO)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #3
0
 def bot_added(self, user, count):
     ''' Callback for when a bot is added '''
     message = "%s added a new bot; total number of bots is now %d" % (
         user.team.name, count)
     Notification.create_broadcast(user.team, "Bot added", message, INFO)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #4
0
 def flag_captured(self, player, flag):
     """ Callback for when a flag is captured """
     if isinstance(player, User):
         team = player.team
     else:
         team = player
     if isinstance(player, User) and options.teams:
         message = '%s (%s) has completed "%s" in %s' % (
             player.handle,
             team.name,
             flag.name,
             flag.box.name,
         )
     else:
         message = '%s has completed "%s" in %s' % (
             team.name,
             flag.name,
             flag.box.name,
         )
     if len(GameLevel.all()) > 1:
         message = message + " (%s)" % (
             GameLevel.by_id(flag.box.game_level_id).name,
         )
     Notification.create_broadcast(team, "Flag Capture", message, SUCCESS)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #5
0
 def level_unlocked(self, user, level):
     ''' Callback for when a team unlocks a new level '''
     message = "%s unlocked level #%d." % (
         user.team.name, level.number
     )
     Notification.create_broadcast("Level Unlocked", message)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #6
0
 def flag_captured(self, user, flag):
     ''' Callback for when a flag is captured '''
     message = "%s has captured the '%s' flag" % (
         user.team.name, flag.name
     )
     Notification.create_broadcast("Flag Capture", message)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #7
0
 def flag_captured(self, user, flag):
     ''' Callback for when a flag is captured '''
     if len(GameLevel.all()) > 1:
         message = "%s has captured the '%s' flag in %s (Lvl %s)" % (
             user.team.name, flag.name, flag.box.name,
             GameLevel.by_id(flag.box.game_level_id).number)
     else:
         message = "%s has captured the '%s' flag in %s" % (
             user.team.name, flag.name, flag.box.name)
     Notification.create_broadcast(user.team, "Flag Capture", message,
                                   SUCCESS)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #8
0
 def cracked_password(self, cracker, victim, password, value):
     '''
     This is created when a user successfully cracks another
     players password.
     '''
     user_msg = "Your password '%s' was cracked by %s" % (
         password, cracker.handle,
     )
     Notification.create_user(victim, "Security Breach", user_msg, ERROR)
     message = "%s hacked %s's bank account and stole $%d" % (
         cracker.handle, victim.team.name, value,
     )
     Notification.create_broadcast("Password Cracked", message, SUCCESS)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #9
0
 def player_swated(self, user, target):
     message = "%s called the SWAT team on %s." % (
         user.handle, target.handle
     )
     evt_id = Notification.create_broadcast("Player Arrested!", message)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #10
0
 def bot_added(self, user, count):
     """ Callback for when a bot is added """
     if options.teams:
         message = "%s (%s) added a new bot; total number of bots is now %d" % (
             user.handle,
             user.team.name,
             count,
         )
     else:
         message = "%s added a new bot; total number of bots is now %d" % (
             user.team.name,
             count,
         )
     Notification.create_broadcast(user.team, "Bot added", message, INFO)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)
예제 #11
0
 def admin_message(self, message):
     """ Callback for when admin point change is made """
     Notification.create_broadcast(None, "Admin Message", message, INFO)
     self.io_loop.add_callback(self.push_broadcast)
     self.io_loop.add_callback(self.push_scoreboard)