<commit_before><?php

class CharacterActivity extends Base_Model
{
	public static $softDelete = false;
	public static $timestamps = false;
	public static $table = 'character_activities';
	public static $key = 'id';

	public function get_data()
	{
		return unserialize($this->get_attribute('data'));
	}

	public function set_data($data)
	{
		$this->set_attribute('data', serialize($data));
	}

	public function character()
	{
		return $this->belongs_to('Character', 'character_id');
	}

	public function update_time()
	{
		//$character = Session::get('character');
		$character = $this->character()->select(array('id', 'zone_id', 'is_traveling', 'is_exploring', 'xp', 'zone_id'))->first();

		if ( ! $character )
		{
			return;
		}

		if ( $this->end_time <= time() )
		{
			switch ( $this->name ) 
			{
				case 'travel':
					/*
					 *	Obtenemos la información
					 *	de la zona a donde viajó
					 */
					$zone = $this->data['zone'];

					/*
					 *	Actualizamos la zona en
					 *	donde el personaje se encuentra
					 */
					$character->zone_id = $zone->id;
					$character->is_traveling = false;
					$character->save();

					break;
				
				case 'battlerest':
					break;

				case 'explore':
					$data = $this->data;

					$character->is_exploring = false;
					$character->xp += $data['time'] / 60 / 25 * Config::get('game.xp_rate');
					$character->add_exploring_time($character->zone()->select(array('id'))->first(), $data['time']);
					$character->give_explore_reward($data['reward']);
					$character->save();

					/*
					 *	Enviamos informe de que terminó de explorar
					 */
					Message::completed_exploration($character, $data['time'] / 60 / 25 * Config::get('game.xp_rate'), $data['reward']);

					/*
					 *	Nuevo mounstruo para pelear
					 */
					$monster = Npc::select(array('id'))->where('zone_id', '=', $character->zone_id)->where('type', '=', 'monster')->order_by(DB::raw('RAND()'))->first();

					if ( $monster )
					{
						Session::put('monster_id', $monster->id);
					}<commit_msg>arreglos los puntos para los atributos que no se estaban dando al finalizar las exploraciones<commit_after><?php

class CharacterActivity extends Base_Model
{
	public static $softDelete = false;
	public static $timestamps = false;
	public static $table = 'character_activities';
	public static $key = 'id';

	public function get_data()
	{
		return unserialize($this->get_attribute('data'));
	}

	public function set_data($data)
	{
		$this->set_attribute('data', serialize($data));
	}

	public function character()
	{
		return $this->belongs_to('Character', 'character_id');
	}

	public function update_time()
	{
		//$character = Session::get('character');
		$character = $this->character()->select(array('id', 'zone_id', 'is_traveling', 'is_exploring', 'xp', 'zone_id', 'points_to_change'))->first();

		if ( ! $character )
		{
			return;
		}

		if ( $this->end_time <= time() )
		{
			switch ( $this->name ) 
			{
				case 'travel':
					/*
					 *	Obtenemos la información
					 *	de la zona a donde viajó
					 */
					$zone = $this->data['zone'];

					/*
					 *	Actualizamos la zona en
					 *	donde el personaje se encuentra
					 */
					$character->zone_id = $zone->id;
					$character->is_traveling = false;
					$character->save();

					break;
				
				case 'battlerest':
					break;

				case 'explore':
					$data = $this->data;

					$xpGained = $data['time'] / 60 / 25 * Config::get('game.xp_rate');

					$character->is_exploring = false;

					if ( $xpGained > 0 )
					{
						$character->xp += $xpGained;
						$character->points_to_change += $xpGained;
					}
					
					$character->add_exploring_time($character->zone()->select(array('id'))->first(), $data['time']);
					$character->give_explore_reward($data['reward']);

					$character->save();

					/*
					 *	Enviamos informe de que terminó de explorar
					 */
					Message::completed_exploration($character, $data['time'] / 60 / 25 * Config::get('game.xp_rate'), $data['reward']);

					/*
					 *	Nuevo mounstruo para pelear
					 */
					$monster = Npc::select(array('id'))->where('zone_id', '=', $character->zone_id)->where('type', '=', 'monster')->order_by(DB::raw('RAND()'))->first();

					if ( $monster )
					{
						Session::put('monster_id', $monster->id);
					}
{'fraction_non_alphanumeric': 0.18135078289319934, 'fraction_numerical': 0.003972890862351017, 'mean_word_length': 3.1919686581782565, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 61, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4028536', 'n_tokens_mistral': 1825, 'n_tokens_neox': 1411, 'n_words': 278}