Esempio n. 1
0
int Skill_Running_Info::deserialize(Block_Buffer &buf) {
	uint32_t sec = 0, usec = 0;

	buf.read_int32(skill_id);

	buf.read_uint32(sec);
	buf.read_uint32(usec);
	last_use_timestamp.sec(sec);
	last_use_timestamp.usec(usec);

	buf.read_int32(use_times);
	uint16_t size;
	buf.read_uint16(size);

	buf.read_int32(last_step);
	buf.read_uint32(sec);
	buf.read_uint32(usec);

	config_cache = CONFIG_CACHE_FIGHTER->skill_config_cache(skill_id);
	if (NULL == config_cache) {
		return -1;
	}

	return 0;
}
Esempio n. 2
0
int Message_Unit::process_client_buffer(Block_Buffer &buf) {
	msg_tick_ = Time_Value::gettimeofday();

	int cid = 0;
	uint32_t len = 0;
	uint32_t msg_id = 0;
	uint32_t serial_cipher = 0;
	uint32_t msg_time_cipher = 0;

	if (buf.read_int32(cid) ||
		buf.read_uint32(len) ||
		buf.read_uint32(msg_id) ||
		buf.read_uint32(serial_cipher) ||
		buf.read_uint32(msg_time_cipher)) {

		LOG_USER("deserialize error, cid:%d len:%d msg_id:%d", cid, len, msg_id);
		monitor()->close_client_by_cid(cid, Time_Value(2), 10000101);
		return -1;
	}

	process_client_msg(msg_id, cid, buf, serial_cipher, msg_time_cipher);

	count_process_time(msg_id);

	return 0;
}
Esempio n. 3
0
void Map_Team::deserialize(Block_Buffer &buf) {
	buf.read_int8(type_);
	buf.read_string(words_);
	buf.read_int32(scene_id_);
	buf.read_int8(degree_);
	buf.read_uint32(team_index_);
	buf.read_int64(team_id_);
	buf.read_int64(team_id_for_scene_);
	buf.read_int64(leader_role_id_);
	uint16_t len = 0;
	buf.read_uint16(len);
	int64_t role_id = 0;
	for (uint16_t i = 0; i < len; ++i) {
		buf.read_int64(role_id);
		team_member_set_.insert(role_id);
	}
	buf.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		buf.read_int64(role_id);
		offline_teamer_map_.insert(std::make_pair(role_id, Online_Teamer_Info()));
	}
	buf.read_int8(in_battle_);
	buf.read_uint16(len);
	Int_Role_Id int_role_id;
	Int_Role_Id_Vec lineup;
	for (uint16_t i = 0; i < len; ++i) {
		int_role_id.deserialize(buf);
		lineup.push_back(int_role_id);
	}
	this->lineup_replace(lineup);
	buf.read_int32(enter_level_);
	buf.read_int16(fail_times_);
	buf.read_int16(match_fail_);
	buf.read_bool(is_not_first_team_fb_);
}
int Stronghold::deserialize(Block_Buffer &r) {
	r.read_uint32(point_id);
	int8_t tp = 0;
	r.read_int8(tp);
	type = (Expedition_Build_Type)tp;

	info.deserialize(r);
	return 0;
}
Esempio n. 5
0
int Message_Unit::process_timer_buffer(Block_Buffer &buf) {
	msg_tick_ = Time_Value::gettimeofday();

	uint32_t len = 0;
	uint32_t msg_id = 0;

	if (buf.read_uint32(len) ||
		buf.read_uint32(msg_id)) {

		LOG_USER("deserialize error, cid:%d len:%d msg_id:%d", len, msg_id);
		return -1;
	}

	process_timer_msg(msg_id, buf, msg_tick_);

	count_process_time(msg_id);

	return 0;
}
int DragonBuildingInfo::deserialize(Block_Buffer &buffer) {
	buffer.read_uint32(id);
	buffer.read_uint8(type);
	buffer.read_uint16(level);
	buffer.read_uint8(status);
	buffer.read_uint32(production);
	buffer.read_bool(is_gain);

	uint64_t  temp_begin_upgrade_time_sec = 0;
	uint64_t temp_last_output_production_time_sec = 0;
	buffer.read_uint64(temp_begin_upgrade_time_sec);
	buffer.read_uint64(temp_last_output_production_time_sec);

	begin_upgrade_time.sec((long)temp_begin_upgrade_time_sec);
	last_output_production_time.sec((long)temp_last_output_production_time_sec);

	buffer.read_uint8(order);
	buffer.read_uint8(consume_type);
	return 0;
}
Esempio n. 7
0
int Message_Unit::process_async_data(int data_type, void *ptr_data) {
	switch (data_type) {
	case Unit_Message::TYPE_DATA_BUFFER: {
		Block_Buffer *buf = (Block_Buffer *)ptr_data;
		uint32_t len = 0;
		uint32_t msg_id = 0;

		if (buf->read_uint32(len) ||
			buf->read_uint32(msg_id)) {
			LOG_USER("deserialize error, cid:%d len:%d msg_id:%d", len, msg_id);
			return -1;
		}

		process_async_buff(msg_id, *buf);
		break;
	}
	default: {
		return CALL_CONTINUE;
		break;
	}
	}

	return CALL_RETURN;
}
int DragonInfo::deserialize(Block_Buffer &buffer) {
	buffer.read_uint8(progress);
	buffer.read_uint8(feeling);
	buffer.read_uint32(power);
	buffer.read_uint32(armor);
	buffer.read_uint32(stamina);
	buffer.read_uint32(power_level);
	buffer.read_uint32(armor_level);
	buffer.read_uint32(stamina_level);
	buffer.read_uint32(hero_power);
	buffer.read_uint32(hero_armor);
	buffer.read_uint32(hero_stamina);
	buffer.read_uint32(hero_power_level);
	buffer.read_uint32(hero_armor_level);
	buffer.read_uint32(hero_stamina_level);
	buffer.read_bool(is_play_dragon);
	buffer.read_uint32(energy);
	buffer.read_uint32(crit);
	buffer.read_uint32(prevent_crit);
	buffer.read_uint32(crit_level);
	buffer.read_uint32(prevent_crit_level);
	buffer.read_uint32(hero_crit);
	buffer.read_uint32(hero_prevent_crit);
	buffer.read_uint32(hero_crit_level);
	buffer.read_uint32(hero_prevent_crit_level);
	return 0;
}
int Dragon_Vale_Detail::deserialize(Block_Buffer &buffer) {
	buffer.read_int64(role_id);
	buffer.read_int64(target_player_id);
	buffer.read_bool(is_rob_enter_dragon_vale);
	buffer.read_int64(uuid);
	buffer.read_bool(is_gold_mine_max_storage);
	buffer.read_bool(is_moon_well_max_storage);
	buffer.read_bool(is_totem_max_storage);
	buffer.read_uint8(build_gold_mine_num);
	buffer.read_uint8(build_moon_well_num);
	buffer.read_uint8(build_totem_num);
	buffer.read_uint8(build_queue_num);
	buffer.read_uint8(all_open_build_queue_num);

	uint8_t size = 0;
	buffer.read_uint8(size);

	dragon_building_info_map.clear();
	uint64_t key = 0;

	DragonBuildingInfo building_info;
	for(uint8_t i = 0; i < size; ++i) {
		building_info.reset();
		building_info.deserialize(buffer);
		key = create_key_of_Dragon_Building_Info(building_info.id, building_info.type);
		dragon_building_info_map.insert(std::make_pair(key, building_info));
	}

	buffer.read_bool(is_dragon_born);

	uint64_t temp_begin_born_time_sec = 0;
	buffer.read_uint64(temp_begin_born_time_sec);
	begin_born_time.sec((long)temp_begin_born_time_sec);

	dragon_info.deserialize(buffer);

	uint64_t temp_begin_play_dragon_interval_time_sec = 0;
	buffer.read_uint64(temp_begin_play_dragon_interval_time_sec);
	begin_play_dragon_interval_time.sec((long)temp_begin_play_dragon_interval_time_sec);

	uint64_t temp_begin_down_feeling_time_sec = 0;
	buffer.read_uint64(temp_begin_down_feeling_time_sec);
	begin_down_feeling_time.sec((long)temp_begin_down_feeling_time_sec);

	buffer.read_bool(is_vip_down_to_zero);
	buffer.read_uint32(matched_num);

	buffer.read_uint8(size);
	for(uint8_t i = 0; i < size; ++i) {
		int64_t key = 0;
		int64_t value = 0;
		buffer.read_int64(key);
		buffer.read_int64(value);
		thief_id_quality_map.insert(std::make_pair(key, value));
	}

	uint64_t temp_begin_refresh_thief_time = 0;
	buffer.read_uint64(temp_begin_refresh_thief_time);
	begin_refresh_thief_time.sec((long)temp_begin_refresh_thief_time);

	buffer.read_uint8(star_num);
	buffer.read_uint8(award_foot_num);
	buffer.read_bool(is_special);

	buffer.read_uint8(size);
	for(uint8_t i = 0; i < size; ++i) {
		int64_t key = 0;
		buffer.read_int64(key);
		Foot_Info foot_info;
		foot_info.reset();
		buffer.read_uint8(foot_info.sex);
		buffer.read_string(foot_info.name);
		foot_info_map.insert(std::make_pair(key, foot_info));
	}

	uint32_t size_32 = 0;
	buffer.read_uint32(size_32);
	for(uint32_t i = 0; i < size_32; ++i) {
		int64_t role_id = 0;
		buffer.read_int64(role_id);
		foot_id_set.insert(role_id);
	}

	buffer.read_bool(is_yesterday_login);
	buffer.read_uint8(dragon_heart_num);

	buffer.read_uint8(size);
	Notice_Board notice_board;
	for(uint8_t i = 0; i < size; ++i) {
		notice_board.reset();
		notice_board.deserialize(buffer);
		notice_board_list.push_back(notice_board);
	}

	buffer.read_bool(is_rob_protect);

	uint64_t temp_begin_rob_protect_time = 0;
	buffer.read_uint64(temp_begin_rob_protect_time);
	begin_rob_protect_time.sec((long)temp_begin_rob_protect_time);

	buffer.read_bool(is_first_enter_after_robbed);

	buffer.read_bool(is_in_robbed_dragon_vale);
	uint64_t temp_begin_in_robbed_dragon_vale_time = 0;
	buffer.read_uint64(temp_begin_in_robbed_dragon_vale_time);
	begin_in_robbed_dragon_vale_time.sec((long)temp_begin_in_robbed_dragon_vale_time);

	buffer.read_uint8(size);
	for(uint8_t i = 0; i < size; ++i) {
		uint8_t order = 0;
		buffer.read_uint8(order);
		cancel_create_building_set.insert(order);
	}

	buffer.read_bool(is_dragon_vale_open);

	uint64_t temp_begin_no_enter_time = 0;
	buffer.read_uint64(temp_begin_no_enter_time);
	begin_no_enter_time.sec((long)temp_begin_no_enter_time);

	buffer.read_uint32(left_time);
	buffer.read_uint32(play_dragon_num);
	buffer.read_uint32(drive_thief_num);

	return 0;
}
int Expedition_Manager_Data::deserialize(Block_Buffer &r) {
	r.read_uint32(inter_);

	uint16_t len = 0;
	int64_t i_64 = 0;
	Time_Value tv = Time_Value::zero;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64);
		tv.deserialize(r);
		opened_uuid_opentime_map_.insert(std::make_pair(i_64, tv));
	}

	int64_t i_64_2 = 0;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64);
		r.read_int64(i_64_2);
		gang_id_uuid_map_.insert(std::make_pair(i_64, i_64_2));
	}

	last_reset_time_.deserialize(r);

	uint32_t ui_32 = 0;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64);
		r.read_uint32(ui_32);
		first_gang_rank_.insert(std::make_pair(i_64, ui_32));
	}

	r.read_bool(has_init_);
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		bool hi = false;
		r.read_int64(i_64);
		r.read_bool(hi);
		uuid_has_init_[i_64] = hi;
	}

	r.read_uint16(len);
	Expedition_Gang_Rank_Info egri;
	for (uint16_t i = 0; i < len; ++i) {
		egri.reset();
		r.read_int64(i_64);
		egri.deserialize(r);
		gang_rank_map_.insert(std::make_pair(i_64, egri));
	}

	int64_t i_64_t = 0;
	r.read_uint16(len);
	uint16_t len_t = 0;
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64_t);
		r.read_uint16(len_t);
		for (uint16_t j = 0; j < len_t; ++j) {
			r.read_int64(i_64);
			egri.deserialize(r);
			uuid_gang_rank_map_[i_64_t].insert(std::make_pair(i_64, egri));
		}
	}

	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64);
		gang_rank_sync_success_.insert(i_64);
	}

	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64);
		gang_rank_sync_new_vec_.push_back(i_64);
	}

	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64);
		r.read_uint32(ui_32);
		gang_id_point_id_.insert(std::make_pair(i_64, ui_32));
	}

	int i_32 = 0;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64);
		r.read_int32(i_32);
		gang_id_cur_line_.insert(std::make_pair(i_64, i_32));
	}

	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64_t);
		r.read_uint16(len_t);
		for (uint16_t j = 0; j < len_t; ++j) {
			r.read_int64(i_64);
			r.read_uint32(ui_32);
			uuid_gang_id_point_id_[i_64_t].insert(std::make_pair(i_64, ui_32));
		}
	}

	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64_t);
		r.read_uint16(len_t);
		for (uint16_t j = 0; j < len_t; ++j) {
			r.read_int64(i_64);
			r.read_int32(i_32);
			uuid_gang_id_cur_line_[i_64_t].insert(std::make_pair(i_64, i_32));
		}
	}

	Expedition_Scene_Data esd;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		esd.reset();
		r.read_uint32(ui_32);
		esd.deserialize(r);
		line_scene_map_.insert(std::make_pair(ui_32, esd));
	}

	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(i_64);
		r.read_uint16(len_t);
		for (uint16_t j = 0; j < len_t; ++j) {
			esd.reset();
			r.read_uint32(ui_32);
			esd.deserialize(r);
			uuid_line_scene_map_[i_64].insert(std::make_pair(ui_32, esd));
		}
	}
	return 0;
}
int Expedition_Scene_Data::deserialize(Block_Buffer &r) {
	uint16_t len = 0;
	Stronghold sh;
	uint32_t ui_32 = 0;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_uint32(ui_32);
		sh.deserialize(r);
		map_data_.insert(std::make_pair(ui_32, sh));
	}

	int i_32 = 0;
	int64_t i_64 = 0;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int32(i_32);
		r.read_int64(i_64);
		point_gang_id_.insert(std::make_pair(i_32, i_64));
	}
	r.read_uint32(map_base_point_num_);
	r.read_uint32(cur_line_);
	award_time_.deserialize(r);
	r.read_int32(settle_time_);

	r.read_uint16(len);
	Expedition_Occupy_Castle_Data eocd;
	for (uint16_t i = 0; i < len; ++i) {
		eocd.reset();
		eocd.deserialize(r);
		occupy_castle_rank_.insert(std::make_pair(eocd.role_id, eocd));
	}

	Expedition_Scene_Demage_Rank_Data esdrd;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		esdrd.reset();
		r.read_int64(i_64);
		esdrd.deserialize(r);
		demage_rank_.insert(std::make_pair(i_64, esdrd));
	}

	Expedition_Drop_Or_Material edom;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int32(i_32);
		edom.reset();
		edom.deserialize(r);
		refreshed_drop_or_material_.insert(std::make_pair(i_32, edom));
	}

	Time_Value tv(Time_Value::zero);
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int32(i_32);
		tv.deserialize(r);
		refreshed_monster_timing_[i_32] = tv;
	}

	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int32(i_32);
		tv.deserialize(r);
		refreshed_monster_kill_gap_[i_32] = tv;
	}

	return 0;
}