int Hero_Info_Detail::deserialize(Block_Buffer &r) {
	if( r.read_int32(hero_id)  ||  r.read_int32(hero_index)  ||  r.read_int32(hero_facade_id)  ||
			r.read_string(hero_name)  ||  r.read_int8(is_outer) ||  r.read_int8(is_fighter)  ||
			r.read_int32(level)  ||  r.read_int32(formation)  || r.read_int32(awake_lvl) ||
			r.read_double(exp)	)
			return -1;

	uint16_t __prop_value_vec_size;
	if(r.read_uint16(__prop_value_vec_size) )
			return -1;
	prop_value.reserve(__prop_value_vec_size);
	for(uint16_t i = 0; i < __prop_value_vec_size; ++i) {
			Int_Double v;
			if(v.deserialize(r))
					return -1;
			prop_value.push_back(v);
	}

	uint16_t size = 0;
	Artifact_Detail artifact_detail;
	r.read_uint16(size);
	for(uint16_t i = 0; i < size; ++i) {
		artifact_detail.reset();
		if (artifact_detail.deserialize(r)) {
			continue;
		};
		artifacts.insert(std::make_pair(artifact_detail.artifact_id, artifact_detail));
	}
	hero_fighter_detail.deserialize(r);
	return 0;
}
Exemplo n.º 2
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_);
}
Exemplo n.º 3
0
int Answer_Manager::data_channle(Block_Buffer& buf) {
	uint8_t type = 0;
	buf.read_uint8(type);
	switch(type) {
		case ANSWER_DATA_CHANNLE_TYPE_SL_GET_RANK_REWARD: {
			uint16_t size = 0;
			buf.read_uint16(size);
			for(uint16_t i = 0; i < size; ++i) {
				uint16_t nsize = 0;
				buf.read_uint16(nsize);
				for(uint16_t j = 0; j < nsize; ++j) {
					role_id_t role_id = 0;
					buf.read_int64(role_id);
					reward_to_player(role_id, i+1);
				} //end j
			}//end i
			break;
		}// end case
		case ANSWER_DATA_CHANNLE_TYPE_SL_SAVE_DATA: {
			save_data(buf);
			break;
		}
	}
	return 0;
}
int Anci_Artifact_Detail::deserialize(Block_Buffer &buffer) {
	buffer.read_int64(role_id);
//	buffer.read_int64(perfectPoint);
	uint16_t len = 0;
	buffer.read_uint16(len);
	aa_info_map.clear();
	Anci_Artifact_Cond_Info info;
	for (uint16_t i = 0; i < len; ++i) {
		info.reset();
		buffer.read_int32(info.id);
		buffer.read_int8(info.state_count);
		buffer.read_int32(info.data);
		aa_info_map.insert(std::make_pair(info.id, info));
	}
	buffer.read_uint16(len);
	complete_ids.clear();
	int32_t complete_id = 0;
	for (uint16_t i = 0; i < len; ++i) {
		buffer.read_int32(complete_id);
		complete_ids.insert(complete_id);
	}
	aa_unban_info.clear();
	Anci_Artifact_Unban_Info aa_ui;
	for (uint16_t i = 0; i < len; ++i) {
		aa_ui.reset();
		buffer.read_int32(aa_ui.id);
		buffer.read_int8(aa_ui.state);
		buffer.read_int8(aa_ui.box_state);
		aa_unban_info.insert(std::make_pair(aa_ui.id, aa_ui));
	}
	return 0;
}
Exemplo n.º 5
0
int Scene_Gang_Manager::gang_war_load_source_gangs_from_logic(Block_Buffer &buf) {
	int8_t type = 0;
	buf.read_int8(type);
	if (type == 1) {
		int64_t server_id = 0;
		std::string zone;
		uint16_t len = 0;
		int8_t stage = 0;

		buf.read_int64(server_id);
		buf.read_string(zone);
		buf.read_int8(stage);
		if (stage != stage_
				|| load_source_ < Time_Value::gettimeofday()) {
			gang_map_.clear();
			gangid_serverid_map_.clear();
			gangid_zone_map_.clear();
			server_ids_.clear();
			stage_ = stage;
			load_source_ = Time_Value::gettimeofday() + Time_Value(Time_Value::ONE_MINUTE_IN_SECS * 5);
			MSG_USER("GANG_WAR: source_gangs server_id(%d) clear data",server_id);
		}
		server_ids_.insert(server_id);
		buf.read_uint16(len);
		Gang_War_Spot spot;
		std::map<int8_t, Gang_War_Spot> gang_war_result_map;
		for (uint16_t i = 0; i < len; ++i) {
			spot.reset();
			spot.deserialize(buf);
			gang_war_result_map.insert(std::make_pair(spot.index, spot));
		}
		if (!gang_war_result_map.empty()) {
			gang_war_result_map_.clear();
			gang_war_result_map_ = gang_war_result_map;
		}
		buf.read_uint16(len);
		Gang_DB_View info;
		for (uint16_t i = 0; i < len; ++i) {
			info.reset();
			info.gang_war_deserialize(buf);
			gang_map_.insert(std::make_pair(info.gang_id, info));
			gangid_serverid_map_.insert(std::make_pair(info.gang_id, server_id));
			gangid_zone_map_.insert(std::make_pair(info.gang_id, zone));
			SCENE_GANG_GLOBAL_MANAGER->add_gang(info.gang_id, this);
		}
		MSG_USER("GANG_WAR: source_gangs server_id(%d)",server_id);
	} else {
		role_id_t gang_id = 0;
		buf.read_int64(gang_id);
		gang_map_.erase(gang_id);
		gangid_serverid_map_.erase(gang_id);
		gangid_zone_map_.erase(gang_id);
		SCENE_GANG_GLOBAL_MANAGER->erase_gang(gang_id);
	}
	return 0;
}
Exemplo n.º 6
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;
}
int Scene_Server_Request::process_20100503(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) {
	JUDGE_PLAYER_NULL(player, role_id);
	int8_t type = 0;
	uint16_t len = 0;
	buf.read_int8(type);
	buf.read_uint16(len);
	if (len <= 0) {
		return 0;
	}
//	player
	Hero *hero = SCENE_PUBLIC->find_fight_hero(role_id);
	if (!hero) {
		return 0;
	}
	if (type == 1) { // add
		for (uint16_t i = 0; i < len; ++i) {
			hero->inner_status_insert(buf);
		}
	} else {
		Int_Hash_Set is;
		int status_id = 0;
		for (uint16_t i = 0; i < len; ++i) {
			buf.read_int32(status_id);
			is.insert(status_id);
		}
		hero->erase_status_in_set(is);
	}
	return 0;
}
int Scene_Server_Request::process_20100050(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &inner_buf) {
	JUDGE_PLAYER_NULL(player, role_id);
	uint16_t change_info_size = 0;
	inner_buf.read_uint16(change_info_size);
	if (change_info_size == 0) {
		return -1;
	}

	MSG_81000066 active_msg;
	active_msg.change_info.reserve(change_info_size);
	String_Info_Change string_info_change;
	for (uint16_t i = 0; i < change_info_size; ++i) {
		string_info_change.reset();
		if (string_info_change.deserialize(inner_buf)) {
			return -1;
		}
		active_msg.change_info.push_back(string_info_change);
	}
	inner_buf.read_int64(active_msg.role_id);

	Block_Buffer active_buf;
	MAKE_MSG_BUF(active_msg, active_buf);
	player->scene_broad_around(active_buf,Mover::SCENE_MOVE);

	return 0;
}
int Scene_Server_Request::process_20100031(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) {
	JUDGE_PLAYER_NULL(player, role_id);
	uint16_t energy = 0;
	buf.read_uint16(energy);
	player->set_energy(energy);
	return 0;
}
Exemplo n.º 10
0
v8::Local<v8::Map> Msg_Struct::build_object_map(const Field_Info &field_info, Block_Buffer &buffer, Isolate* isolate) {
    EscapableHandleScope handle_scope(isolate);

    uint16_t vec_size = 0;
    buffer.read_uint16(vec_size);
    Local<Map> map = Map::New(isolate);
    if(is_struct(field_info.field_type)) {
        for(uint16_t i = 0; i < vec_size; ++i) {
            Local<Object> object = build_object_struct(field_info, buffer, isolate);
            Local<Value> key = object->Get(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, field_info.key_name.c_str(), NewStringType::kNormal).ToLocalChecked()).ToLocalChecked();
            map->Set(isolate->GetCurrentContext(), key, object).ToLocalChecked();
        }
    }
    else {
        Field_Info key_info;
        key_info.field_label = "args";
        key_info.field_type = field_info.key_type;
        key_info.field_name = field_info.key_name;
        Local<Value> key = build_object_arg(key_info, buffer, isolate);
        Local<Value> value = build_object_arg(field_info, buffer, isolate);

        map->Set(isolate->GetCurrentContext(), key, value).ToLocalChecked();
    }

    return handle_scope.Escape(map);
}
Exemplo n.º 11
0
int Scene_Server_Request::process_20100403(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) {
	JUDGE_PLAYER_NULL(player, role_id);
	int8_t type = 0;
	buf.read_int8(type);
	uint16_t vec_size = 0;
	if (buf.read_uint16(vec_size)) {
		return -1;
	}

	Int_Double_Map force_map;
	player->get_all_pre_force(force_map);
	int old_val = player->fighter_detail().force;

	Skill_Info skill_info;
	for (uint16_t i = 0; i < vec_size; ++i) {
		skill_info.reset();
		skill_info.deserialize(buf);
		if (type == NPT_ADD) {
			player->add_skill_extra(skill_info.skill_id, skill_info.skill_lv);
		} else if (type == NPT_REMOVE) {
			player->remove_skill_extra(skill_info.skill_id, skill_info.skill_lv);
		}
	}

	if (vec_size > 0) {
		player->sync_force_to_client();
	}

	int new_val = player->fighter_detail().force;
	player->print_all_part_force(100, new_val-old_val, force_map);

	return 0;
}
void Expedition_Drop_Or_Material::deserialize(Block_Buffer &r) {
	this->birth_time.deserialize(r);
	uint16_t len = 0;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		int64_t role_id = 0;
		r.read_int64(role_id);
		had_collected.insert(role_id);
	}
}
Exemplo n.º 13
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;
}
int Expedition_Global_Manager_Data::deserialize(Block_Buffer &r) {
	uint16_t len = 0;
	int64_t uuid = 0;
	Time_Value tv = Time_Value::zero;
	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int64(uuid);
		tv.deserialize(r);
		opened_uuid_opentime_map_.insert(std::make_pair(uuid, tv));
	}

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

	r.read_uint16(len);
	for (uint16_t i = 0; i < len; ++i) {
		r.read_int32(inter);
		tv.deserialize(r);
		opentime_.insert(std::make_pair(inter, tv));
	}

	mmuid_.deserialize(r);

//	uint32_t inter_u = 0;
//	Expedition_Manager_Data emd;
//	r.read_uint16(len);
//	for (uint16_t i = 0; i < len; ++i) {
//		emd.reset();
//		r.read_uint32(inter_u);
//		emd.deserialize(r);
//		inter_manager_data_map_.insert(std::make_pair(inter_u, emd));
//	}
	return 0;
}
int Stronghold_Info::deserialize(Block_Buffer &r)  {
	occupier.deserialize(r);

	uint16_t len = 0;
	int64_t i_64 = 0;
	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);
		defend_id_map.insert(std::make_pair(i_64, i_32));
	}
	return 0;
}
Exemplo n.º 16
0
int Logic_Status_Detail::deserialize(Block_Buffer &buffer) {
//	buffer.read_int64(this->role_id);
	uint16_t len = 0;
	buffer.read_uint16(len);
	Status_Info status_info;
	status_map.clear();
	for (uint16_t i = 0; i < len; ++i) {
		status_info.reset();
		status_info.deserialize(buffer);
		status_map.insert(std::make_pair(status_info.status_id_, status_info));
	}
	running_effect.reset();
	running_effect.deserialize(buffer);
	return 0;
}
Exemplo n.º 17
0
int Talent::deserialize(Block_Buffer &buf) {
	buf.read_int32(talent_id);
	buf.read_int32(skill_point);

	skill_db_info_map.clear();
	uint16_t size = 0;
	buf.read_uint16(size);
	Skill_DB_Info skill_db_info;
	for (uint16_t i=0; i<size; ++i) {
		skill_db_info.reset();
		skill_db_info.deserialize(buf);
		skill_db_info_map[skill_db_info.skill_id] = skill_db_info;
	}
	return 0;
}
Exemplo n.º 18
0
int Scene_Server_Request::process_20100051(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &inner_buf) {
	JUDGE_PLAYER_NULL(player, role_id);
	MSG_81000067 active_msg;
	inner_buf.read_int64(active_msg.role_id);
	inner_buf.read_int8(active_msg.int_type);
	switch (active_msg.int_type) {
	case 32: {
		uint16_t change_info_size = 0;
		inner_buf.read_uint16(change_info_size);
		if (change_info_size == 0) {
			return -1;
		}
		Int32_Info_Change int32_info_change;
		bool is_hero_awake = false;
		for (uint16_t i = 0; i < change_info_size; ++i) {
			int32_info_change.reset();
			if (int32_info_change.deserialize(inner_buf)) {
				return -1;
			}
			if (int32_info_change.type == IICT_HERO_AWAKE_LVL) {
				is_hero_awake = true;
			}
			active_msg.vec_32_change_info.push_back(int32_info_change);
		}

		// 英雄觉醒等级更新
		if (is_hero_awake) {
			Hero *hero = SCENE_PUBLIC->find_mover_hero(player->role_id());
			if (hero) {
				active_msg.role_id = hero->role_id();
				Block_Buffer active_buf;
				MAKE_MSG_BUF(active_msg, active_buf);
				hero->scene_broad_around(active_buf,Mover::SCENE_MOVE);
			}
		}

		break;
	}
	case 8:
	case 16:
	case 64:
		break;
	default:
		break;
	}

	return 0;
}
Exemplo n.º 19
0
int Rune_Stone_Detail::deserialize(Block_Buffer & r) {
	r.read_int64(role_id);
	r.read_int32(points);

	uint16_t size = 0;
	r.read_uint16(size);
	Smelter_Detail smelter_detail;
	for (uint16_t i = 0; i < size; ++i) {
		smelter_detail.reset();
		smelter_detail.deserialize(r);
		if (smelter_detail.smelter_idx) {
			smelter_detail_map[smelter_detail.smelter_idx] = smelter_detail;
		}
	}

	return 0;
}
Exemplo n.º 20
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;
}
Exemplo n.º 21
0
v8::Local<v8::Array> Msg_Struct::build_object_vector(const Field_Info &field_info, Block_Buffer &buffer, Isolate* isolate) {
    EscapableHandleScope handle_scope(isolate);

    uint16_t vec_size = 0;
    buffer.read_uint16(vec_size);
    Local<Array> array = Array::New(isolate, vec_size);
    if(is_struct(field_info.field_type)) {
        for(uint16_t i = 0; i < vec_size; ++i) {
            Local<Object> object = build_object_struct(field_info, buffer, isolate);
            array->Set(isolate->GetCurrentContext(), i, object).FromJust();
        }
    }
    else {
        for(uint16_t i = 0; i < vec_size; ++i) {
            Local<Value> value = build_object_arg(field_info, buffer, isolate);
            array->Set(isolate->GetCurrentContext(), i, value).FromJust();
        }
    }

    return handle_scope.Escape(array);
}
Exemplo n.º 22
0
int Scene_Server_Request::process_20200100(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) {
	JUDGE_PLAYER_NULL(player, role_id);

	int from = 0;
	Prop_Setter_Vec setter_vec;
	Prop_Setter setter;
	buf.read_int32(from);

	uint16_t vec_size = 0;
	if(buf.read_uint16(vec_size)) {
		return -1;
	}
	setter_vec.reserve(vec_size);

	for(uint16_t i = 0; i < vec_size; ++i) {
		setter.reset();
		if(setter.deserialize(buf)) {
			return -1;
		}

		switch (setter.prop_type) {
		case PT_EXP_CURRENT: {
			player->modify_experience(setter.basic);
			break;
		}
		default : {
			setter_vec.push_back(setter);
		}
		}
	}

	if (! setter_vec.empty()) {
		//player->fight_modify_fight_prop(setter_vec, true);
		player->modify_props_normal(setter_vec, false, from);
	}

	return 0;
}
Exemplo n.º 23
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 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;
}
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;
}
Exemplo n.º 26
0
int Message_Unit::process_server_msg(uint32_t msg_id, int cid, Block_Buffer &buf) {
	switch (msg_id) {
	case SERVER_INNER_LINK_BUILD: {
		int type = 0;
		buf.read_int32(type);

		uint16_t muid_size = 0;
		if (!buf.read_uint16(muid_size)) {
			Monitor_Mark_Vec muids;
			Monitor_Unique_ID muid;
			for (int i = 0; i < muid_size; ++i) {
				muid.reset();
				muid.deserialize(buf);
				monitor()->server_muid_build(muid, cid, 2);
			}
		} else {
			LOG_USER("server link build error!");
		}
		break;
	}
	case SERVER_INNER_SELF_CLOSE: {
		DAEMON_SERVER_INSTANCE->set_server_list(Daemon_Server::MONITOR_SHUTDOWN);
		break;
	}
	case SERVER_INNER_CONFIG_UPDATE: {
		Time_Value now = Time_Value::gettimeofday();

		std::string module;
		buf.read_string(module);
		String_Vec files;
		uint16_t f_size = 0;
		buf.read_uint16(f_size);
		for (int i = 0; i < f_size; ++i) {
			std::string file_path;
			buf.read_string(file_path);
			files.push_back(file_path);
		}
		LOG_DEBUG("config update! module:%s, file size:%d, type:%d, idx:%d", module.c_str(), f_size, monitor_->type(), monitor_->monitor_idx());


		int cross_id = CONFIG_CACHE->server_maintainer_cache().game_inter_flag;
		if(module == "server_global_conf") {
			//加载主配制
			CONFIG_INSTANCE->load_global_config();
			CONFIG_CACHE->refresh_maintainer_cache();
			RECORD_CLIENT->set_switcher(CONFIG_CACHE->server_maintainer_cache().record_log_level);
			Lib_Log::instance()->set_switcher(CONFIG_CACHE->server_maintainer_cache().local_log_level);
		} else {
			CONFIG_INSTANCE->update_config(files, module);
		}

		// 重启条件:跨服id改变且还没开服
		bool restart = false;
		if (cross_id != CONFIG_CACHE->server_maintainer_cache().game_inter_flag) {
			LOG_DEBUG("inter change, new:%d old:%d, open_time:%ld", CONFIG_CACHE->server_maintainer_cache().game_inter_flag, cross_id,
					CONFIG_CACHE->server_maintainer_cache().game_open_time.sec());
			if (CONFIG_CACHE->server_maintainer_cache().game_open_time > Time_Value::gettimeofday()) {
				restart = true;
			} else {
				CONFIG_CACHE->set_cross_info(cross_id);
			}
		}

		Time_Value cost_t = Time_Value::gettimeofday() - now;
		process_config_hook(module, restart);

		break;
	}
	case SERVER_INNER_HEARTBEAT: {
		Block_Buffer inner_buf;
		inner_buf.make_message(SERVER_INNER_HEARTBEAT_BACK);
		inner_buf.copy(&buf);
		inner_buf.finish_message();
		inner_buf.make_head(inner_buf.get_msg_id(), 0);
		monitor_->send_to_server_by_cid(cid, inner_buf);
		break;
	}
	case SERVER_INNER_MSG_TEST: {
		break;
	}
	default : {
		return CALL_CONTINUE;
		break;
	}
	}

	return CALL_RETURN;
}
Exemplo n.º 27
0
// 解Tasker::serialize发过来的数据
void Scene_Tasker::load_scene_detail(Block_Buffer &buf) {
	int8_t flag = 0;
	TaskIdSet task_id_set;
//	Int_Int_Vec item_to_source; //val_1:npc_id   val_2:item_id

	Npc_Item_Chance_Map npc_item_chance_map;
	uint16_t size = 0;
	int32_t task_id = 0;

	buf.read_int8(flag);//1 flag
	buf.read_uint16(size);//2  : task_id的个数
	for (uint16_t i = 0; i < size; ++i) {
		buf.read_int32(task_id); //3...  task_id
		task_id_set.insert(task_id);
	}
	switch(flag) {
	case SYNC_TASK_SOURCE_DEL:
	case SYNC_TASK_SOURCE_ADD: {
		buf.read_uint16(size); //4  npc_id的个数
		for (uint16_t i = 0; i < size; ++i) {
			int npc_id = 0;
			Item_Chance item_chance;
			item_chance.reset();

			buf.read_int32(npc_id); //5...  npc_id
			buf.read_int32(item_chance.val_1); //6...  item_id
			buf.read_int32(item_chance.val_2); //7...  chance
//			item_to_source.push_back(i_t_s);
			npc_item_chance_map.insert(std::make_pair(npc_id, item_chance));
		}
		break;
	}
	case SYNC_TASK_SOURCE_TRANSMIT: {
		buf.read_uint16(size);//4     npc_id的个数
//		Int_Int i_t_s;

		uint16_t size2 = 0;
		for (uint16_t i = 0; i < size; ++i) {
			int npc_id = 0;
//			i_t_s.reset();
			buf.read_int32(npc_id);//5... npc_id

			buf.read_uint16(size2); //6...  item_id 的个数
			for (uint16_t j = 0; j < size2; ++j) {
				Item_Chance item_chance;
				item_chance.reset();
				buf.read_int32(item_chance.val_1); //7... item_id
				buf.read_int32(item_chance.val_2); //8... chance
				npc_item_chance_map.insert(std::make_pair(npc_id, item_chance));
			}
		}
		break;
	}
	}

	switch(flag) {
	case SYNC_TASK_SOURCE_ADD:
		for (TaskIdSet::const_iterator it = task_id_set.begin(); it != task_id_set.end(); ++it) {
			this->__task_id_set.insert(*it);
		}
		for (Npc_Item_Chance_Map::const_iterator it = npc_item_chance_map.begin(); it != npc_item_chance_map.end(); ++it ) {
			add_source_to_item(it->first, it->second);
		}
		break;
	case SYNC_TASK_SOURCE_TRANSMIT:
		__task_id_set.clear();
		__npc_ItemIdSet_map.clear();

		for (TaskIdSet::const_iterator it = task_id_set.begin(); it != task_id_set.end(); ++it) {
			this->__task_id_set.insert(*it);
		}
		for (Npc_Item_Chance_Map::const_iterator it = npc_item_chance_map.begin(); it != npc_item_chance_map.end(); ++it ) {
			add_source_to_item(it->first, it->second);
		}
		break;
	case SYNC_TASK_SOURCE_DEL:
		for (TaskIdSet::const_iterator it = task_id_set.begin(); it != task_id_set.end(); ++it) {
			this->__task_id_set.erase(*it);
		}
		for (Npc_Item_Chance_Map::const_iterator it = npc_item_chance_map.begin(); it != npc_item_chance_map.end(); ++it ) {
			erase_source_to_item(it->first, it->second);
		}
		break;
	default:
		break;
	}
}