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)
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)