Example #1
0
 def on_kill(self, event):
     # event is not called if an entity with a friendly display is killed
     if self.parent.gain_xp:
         kill_action = KillAction()
         kill_action.entity_id = self.connection.entity.entity_id
         kill_action.target_id = event.target.entity_id
         kill_action.xp_gained = self.calculate_xp(self.connection.entity.level, event.target.level)
     
         self.server.update_packet.kill_actions.append(kill_action)
     
     if self.parent.notify_on_kill:
         self.server.send_chat('%s killed %s!' % (self.connection.name, event.target.name))
 def give_xp(self, player, amount):
     if not self.event_dummy:
         return
     # don't give XP to max levels
     if self.max_level != 0 and player.entity.level >= self.max_level:
         return
     update_packet = self.server.update_packet
     action = KillAction()
     action.entity_id = player.entity_id
     action.target_id = self.event_dummy.entity_id
     action.xp_gained = amount
     update_packet.kill_actions.append(action)
Example #3
0
 def give_kill_xp(self, player, is_assist=False):
     if not self.connection:
         return
     if self.connection.entity.level >= self.max_level:
         return
     xp_action = KillAction()
     xp_action.entity_id = self.connection.entity_id
     xp_action.target_id = player.connection.entity_id
     level = player.connection.entity.level
     xp_action.xp_gained = max(get_max_xp(level) * 0.03, 5)
     if is_assist:
         xp_action.xp_gained *= 0.5
     self.server.update_packet.kill_actions.append(xp_action)
Example #4
0
 def on_kill(self, event):
     """Handles cuwo's on_kill event.
     
     Keyword arguments:
     event -- Further information about what happened
     
     """
     target_id = event.target.entity_id
     if self.parent.xp_on_kill and target_id in self.server.players:
         entity_id = self.connection.entity_id
         kill_action = KillAction()
         kill_action.entity_id = entity_id
         kill_action.target_id = target_id
         xp = self.__calculate_xp(self.entity.level, event.target.level)
         kill_action.xp_gained = xp
         self.server.update_packet.kill_actions.append(kill_action)