Exemple #1
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 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;
}
Exemple #3
0
v8::Local<v8::Value> Msg_Struct::build_object_arg(const Field_Info &field_info, Block_Buffer &buffer, Isolate* isolate) {
    EscapableHandleScope handle_scope(isolate);

    Local<Value> value;
    if(field_info.field_type == "int8") {
        int8_t val = 0;
        buffer.read_int8(val);
        value = Int32::New(isolate, val);
    }
    else if(field_info.field_type == "int16") {
        int16_t val = 0;
        buffer.read_int16(val);
        value = Int32::New(isolate, val);
    }
    else if(field_info.field_type == "int32") {
        int32_t val = 0;
        buffer.read_int32(val);
        value = Int32::New(isolate, val);
    }
    else if(field_info.field_type == "int64") {
        int64_t val = 0;
        buffer.read_int64(val);
        value = Number::New(isolate, val);
    }
    else if(field_info.field_type == "double") {
        double val = 0;
        buffer.read_double(val);
        value = Number::New(isolate, val);
    }
    else if(field_info.field_type == "bool") {
        bool val = false;
        buffer.read_bool(val);
        value = Boolean::New(isolate, val);
    }
    else if(field_info.field_type == "string") {
        std::string val = "";
        buffer.read_string(val);
        value = String::NewFromUtf8(isolate, val.c_str(), NewStringType::kNormal).ToLocalChecked();
    }
    else {
        LOG_ERROR("Can not find the field_type:%s, struct_name:%s", field_info.field_type.c_str(), struct_name().c_str());
        return handle_scope.Escape(Local<Value>());
    }
    return handle_scope.Escape(value);
}
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;
}
int Public_Detail::deserialize(Block_Buffer &buffer) {
	buffer.read_string(plot_id);
	buffer.read_int32(plot_step);
	buffer.read_bool(plot_switch);

	uint16_t size = 0;
	buffer.read_uint16(size);
	std::string str = "";
	int num = 0;
	for (uint16_t i = 0; i < size; ++i) {
		buffer.read_string(str);
		buffer.read_int32(num);
		plot_info.insert(String_Int_Map::value_type(str, num));
	}

	buffer.read_int32(awake_lvl);

	Artifact_Detail artifact_detail;
	buffer.read_uint16(size);
	for(uint16_t i = 0; i < size; ++i) {
		artifact_detail.reset();
		if (artifact_detail.deserialize(buffer)) {
			continue;
		};
		artifacts.insert(std::make_pair(artifact_detail.artifact_id, artifact_detail));
	}

	int32_t gift_lvl = 0;
	int8_t status = 0;
	buffer.read_uint16(size);
	for(uint16_t i = 0; i < size; ++i) {
		buffer.read_int32(gift_lvl);
		buffer.read_int8(status);
		fornotice_gifts_status.insert(std::make_pair(gift_lvl, status));
	}

	buffer.read_int32(exploit_val);
	buffer.read_int32(exploit_lvl);

	return 0;
}
Exemple #6
0
int DB_Worker::process_save_player(int cid, int status, Block_Buffer &buffer) {
	//先把两个额外字段读出来,再保存玩家数据,防止buffer错乱
	bool logout = false;
	std::string account = "";
	buffer.read_bool(logout);
	buffer.read_string(account);
	if (logout) {
		//离线保存
		save_player_data(buffer);

		Block_Buffer buf;
		buf.make_server_message(SYNC_DB_GAME_SAVE_PLAYER, 0);
		buf.write_string(account);
		buf.finish_message();
		DB_MANAGER->send_data_block(cid, buf);
	} else {
		//在线定时保存
		save_player_data(buffer);
	}
	return 0;
}
int Fighter_Detail::deserialize(Block_Buffer &buffer) {
	buffer.read_int64(role_id);

	power.deserialize(buffer);
	agility.deserialize(buffer);
	dexterity.deserialize(buffer);
	armor.deserialize(buffer);
	stamina.deserialize(buffer);

	physical_attack.deserialize(buffer);
	spell_attack.deserialize(buffer);
	physical_defense.deserialize(buffer);
	spell_defense.deserialize(buffer);
	hit_rate.deserialize(buffer);
	avoid.deserialize(buffer);
	ignore_def.deserialize(buffer);
	blood_max.deserialize(buffer);
	cure.deserialize(buffer);
	cure_rate.deserialize(buffer);
	sing_rate.deserialize(buffer);
	crit.deserialize(buffer);
	crit_def.deserialize(buffer);
	init_morale.deserialize(buffer);
	morale_caps.deserialize(buffer);
	crit_hurt.deserialize(buffer);
	crit_hurt_sub.deserialize(buffer);
	hit_rate_addition.deserialize(buffer);
	avoid_rate_addition.deserialize(buffer);
	crit_rate_addition.deserialize(buffer);
	crit_def_rate_addition.deserialize(buffer);
	speed.deserialize(buffer);
	blood_current.deserialize(buffer);
	morale_current.deserialize(buffer);
	strength_current.deserialize(buffer);
	strength_max.deserialize(buffer);
	blood_pool_current.deserialize(buffer);
	blood_pool_max.deserialize(buffer);

	ignore_def_rate.deserialize(buffer);
	status_hit_rate.deserialize(buffer);
	status_def_rate.deserialize(buffer);
	blood_steal.deserialize(buffer);

	phy_hurt_fix.deserialize(buffer);
	phy_hurt_rate.deserialize(buffer);
	spell_hurt_fix.deserialize(buffer);
	spell_hurt_rate.deserialize(buffer);
	hurt_fix.deserialize(buffer);
	hurt_rate.deserialize(buffer);
	be_hurt_fix.deserialize(buffer);
	be_hurt_rate.deserialize(buffer);

	pk_hurt_add.deserialize(buffer);
	pk_hurt_sub.deserialize(buffer);
	phy_hurt_rate_sub.deserialize(buffer);
	spell_hurt_rate_sub.deserialize(buffer);
	skill_hurt_rate.deserialize(buffer);

	human_add.deserialize(buffer);
	elf_add.deserialize(buffer);
	orc_add.deserialize(buffer);
	dragon_add.deserialize(buffer);
	undead_add.deserialize(buffer);
	demon_add.deserialize(buffer);
	human_sub.deserialize(buffer);
	elf_sub.deserialize(buffer);
	orc_sub.deserialize(buffer);
	dragon_sub.deserialize(buffer);
	undead_sub.deserialize(buffer);
	demon_sub.deserialize(buffer);
	summon_add.deserialize(buffer);
	summon_sub.deserialize(buffer);

	be_cure_rate.deserialize(buffer);
	effect_rate.deserialize(buffer);

	pve_hurt_add.deserialize(buffer);
	pve_hurt_sub.deserialize(buffer);

	dizz_strengthen.deserialize(buffer);
	dizz_weaken.deserialize(buffer);

	buffer.read_int32(phy_power_recover_time);
	buffer.read_int32(phy_power_buy_times);
	buffer.read_int32(level);
	buffer.read_double(experience);
	buffer.read_double(elite_btl_morale);
	buffer.read_int32(force);
	buffer.read_int32(highest_force);
	buffer.read_int32(ttl_force);

	buffer.read_int32(ttl_skill_points_);
	buffer.read_int32(default_skill);
	buffer.read_int32(cur_used_talent_);
	buffer.read_int32(reset_skill_times);

	uint16_t s = 0;
	buffer.read_uint16(s);
	Talent talent;
	talent_map.clear();
	for (uint16_t i=0; i < s; ++i) {
		talent.reset();
		talent.deserialize(buffer);
		talent_map[talent.talent_id] = talent;
	}

	s = 0;
	buffer.read_uint16(s);
	Skill_DB_Info skill_info;
	extra_skill_vec.clear();
	for (uint16_t i=0; i<s; ++i) {
		skill_info.reset();
		skill_info.deserialize(buffer);
		extra_skill_vec.push_back(skill_info);
	}

	buffer.read_bool(is_clear_moral_);

	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;
}