int Expedition_Scene_Data::serialize(Block_Buffer &w) const {
	w.write_uint16(map_data_.size());
	for (Stronghold_Map::const_iterator it = map_data_.begin();//地图的总数据; 是所有据点(大中小城堡,关卡,宝箱点,怪物点)的数据;据点里面包含所有数据(含有攻防的玩家,状态等等)
			it != map_data_.end(); ++it) {
		w.write_uint32(it->first);
		it->second.serialize(w);
	}

	w.write_uint16(point_gang_id_.size());
	for (Int_Uid::const_iterator it = point_gang_id_.begin();
			it != point_gang_id_.end(); ++it) {
		w.write_int32(it->first);
		w.write_int64(it->second);
	}
	w.write_uint32(map_base_point_num_);//地图数据中基地的总数
	w.write_uint32(cur_line_); //场景的当前线
	award_time_.serialize(w);
	w.write_int32(settle_time_);

	w.write_uint16(occupy_castle_rank_.size());
	for (Role_ExpeditionOccupyCastleData_Map::const_iterator it = occupy_castle_rank_.begin();
			it != occupy_castle_rank_.end(); ++it) {
		it->second.serialize(w);
	}

	w.write_uint16(demage_rank_.size());
	for (Role_ExpeditionSceneDemageRankData_Map::const_iterator it = demage_rank_.begin();
			it != demage_rank_.end(); ++it) {
		w.write_int64(it->first);
		it->second.serialize(w);
	}

	w.write_uint16(refreshed_drop_or_material_.size());
	for (Point_ExpeditionDropOrMaterial::const_iterator it = refreshed_drop_or_material_.begin(); it != refreshed_drop_or_material_.end(); ++it) {
		w.write_int32(it->first);
		it->second.serialize(w);
	}

	w.write_uint16(refreshed_monster_timing_.size());
	for (Int_Time_Map::const_iterator it = refreshed_monster_timing_.begin();
			it != refreshed_monster_timing_.end(); ++it) {
		w.write_int32(it->first);
		it->second.serialize(w);
	}

	w.write_uint16(refreshed_monster_kill_gap_.size());
	for (Int_Time_Map::const_iterator it = refreshed_monster_kill_gap_.begin();
			it != refreshed_monster_kill_gap_.end(); ++it) {
		w.write_int32(it->first);
		it->second.serialize(w);
	}
	return 0;
}
Ejemplo n.º 2
0
int Skill_Running_Info::serialize(Block_Buffer &buf) const {
	buf.write_int32(skill_id);

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

	buf.write_int32(use_times);

	buf.write_int32(last_step);

	return 0;
}
Ejemplo n.º 3
0
int DragonBuildingInfo::serialize(Block_Buffer &buffer) const {
	buffer.write_uint32(id);
	buffer.write_uint8(type);
	buffer.write_uint16(level);
	buffer.write_uint8(status);
	buffer.write_uint32(production);
	buffer.write_bool(is_gain);
	buffer.write_uint64((uint64_t)begin_upgrade_time.sec());
	buffer.write_uint64((uint64_t)last_output_production_time.sec());
	buffer.write_uint8(order);
	buffer.write_uint8(consume_type);
	return 0;
}
int Stronghold::serialize(Block_Buffer &w) const {
	w.write_uint32(point_id);
	w.write_int8((int8_t)type);

	info.serialize(w);
	return 0;
}
Ejemplo n.º 5
0
void Map_Team::serialize(Block_Buffer &buf) {
	buf.write_int8(type_);
	buf.write_string(words_);
	buf.write_int32(scene_id_);
	buf.write_int8(degree_);
	buf.write_uint32(team_index_);
	buf.write_int64(team_id_);
	buf.write_int64(team_id_for_scene_);
	buf.write_int64(leader_role_id_);
	uint16_t len = 0;
	len = team_member_set_.size();
	buf.write_uint16(len);
	for (Role_Hash_Set::iterator it = team_member_set_.begin(); it != team_member_set_.end(); ++it) {
		buf.write_int64(*it);
	}
	len = offline_teamer_map_.size();
	buf.write_uint16(len);
	for (RoleID_OnlineMap_TeamerInfo_Map::iterator it = offline_teamer_map_.begin(); it != offline_teamer_map_.end(); ++it) {
		buf.write_int64(it->first);
	}
	buf.write_int8(in_battle_);
	len = lineup_.size();
	buf.write_uint16(len);
	for (Int_Role_Id_Vec::iterator it = lineup_.begin(); it != lineup_.end(); ++it) {
		it->serialize(buf);
	}
	buf.write_int32(enter_level_);
	buf.write_int16(fail_times_);
	buf.write_int16(match_fail_);
	buf.write_bool(is_not_first_team_fb_);
}
Ejemplo n.º 6
0
int Operating::offline_receive_flowers(role_id_t role_id, std::string &role_name, uint32_t item_id,  uint32_t charm, uint32_t friend_num, std::string &msg, role_id_t receive_role_id) {
	if ( role_id == 0 ) return 0;
	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_RECEIVE_FLOWERS;
	buf.write_int32(type);
	buf.write_int64(role_id);
	buf.write_string(role_name);
	buf.write_uint32(item_id);
	buf.write_uint32(charm);
	buf.write_uint32(friend_num);
	buf.write_string(msg);
	buf.write_int64(receive_role_id);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Ejemplo n.º 7
0
void Logic_Public::save_access_count(const Time_Value &now) {
	if(now.sec() - access_count_record_time.sec() > Time_Value::ONE_MINUTE_IN_SECS) {
		if(access_count.size() == 0) {
			access_count_record_time = now;
		}
		Block_Buffer buf;
		buf.make_message(MONGO_SACE_ACCESS_DATA_COUNT);
		buf.write_uint8(access_count.size());
		for(UInt_UInt_Map::iterator ait = access_count.begin(); ait != access_count.end(); ++ait) {
			buf.write_uint32(ait->first);
			buf.write_uint32(ait->second);
		}
		buf.finish_message();
		DB_MANAGER->push_data_block(buf, 0);
		access_count.clear();
	}
}
Ejemplo n.º 8
0
int Operating::offline_active_content_listen_world_boss_end_info(role_id_t role_id , uint32_t damage, uint32_t rank, uint32_t damage_rate) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_ACTIVE_CONTENT_LISTEN_WORLD_BOSS_END_INFO;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.write_uint32(damage);
	buf.write_uint32(rank);
	buf.write_uint32(damage_rate);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Ejemplo n.º 9
0
void Answer_Scene::send_logic_get_integral_reward(Mover *mover, const uint32_t sorce) {
	if(!mover) return;
	Block_Buffer buf;
	buf.make_message(INNER_ANSWER_DATA_CHANNEL);
	buf.write_uint8(ANSWER_DATA_CHANNLE_TYPE_SL_GET_INTEGRAL_REWARD);
	//DATA START
	buf.write_uint32(sorce);
	//DATA END
	buf.finish_message();
	mover->send_to_logic(buf);
}
Ejemplo n.º 10
0
int Operating::offline_dargon_vale_gain_rob_production_notice(role_id_t role_id, std::string server_name, std::string player_name,
								uint32_t gold_mine, uint32_t moon_well, uint32_t totem) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_DRAGON_VALE_GAIN_ROB_PRODUCTION;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.write_string(server_name);
	buf.write_string(player_name);
	buf.write_uint32(gold_mine);
	buf.write_uint32(moon_well);
	buf.write_uint32(totem);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Ejemplo n.º 11
0
int Operating::offline_like_success(role_id_t role_id) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_LIKE_SUCCESS;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Ejemplo n.º 12
0
int Operating::offline_invite_player(role_id_t role_id, const Time_Value &time) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_INVITE_PLAYER;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.write_int64(time.sec());
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Ejemplo n.º 13
0
int Operating::offline_dragon_vale_special_notice(role_id_t role_id, bool is_special) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_DRAGON_VALE_SPECIAL;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.write_bool(is_special);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Ejemplo n.º 14
0
int Player_Monster::battle_appear_info(Block_Buffer &buf) {
    // size_t rd_idx = buf.get_read_idx();
    size_t wr_begin_idx = buf.get_write_idx();
    size_t wr_end_idx = 0;
    uint32_t len = 0;

    // fill head
    buf.make_message(ACTIVE_FIGHTER_APPEAR);

    MSG_81000008 msg;
    msg.fighter_info.role_id = role_id();
    msg.fighter_info.role_name = role_name();
    msg.fighter_info.career = career_;
    msg.fighter_info.gender = gender_;
    msg.fighter_info.position.val_1 = mover_detail().battle_position.pos;
    msg.fighter_info.position.val_2 = mover_detail().battle_position.idx;
    msg.fighter_info.hp_curr = blood_current();
    msg.fighter_info.hp_max = blood_max();
    msg.fighter_info.avatar = avatar_vec;
    boost::unordered_set<Property_Type> property_set;
    property_set.insert(PT_MORALE_CAPS);
    property_set.insert(PT_MORALE_CURRENT);

    for (boost::unordered_set<Property_Type>::iterator it = property_set.begin(); it != property_set.end(); ++it) {
        msg.fighter_info.init_props.push_back(Prop_Change(*it));
    }

    for (std::vector<Prop_Change>::iterator pc_it = msg.fighter_info.init_props.begin();
            pc_it != msg.fighter_info.init_props.end(); ++pc_it) {
        (*pc_it).current_val = fighter_detail().fetch_fight_property(Property_Type((*pc_it).prop_type));
    }

    msg.serialize(buf);

    // refill len in head
    wr_end_idx = buf.get_write_idx();
    len = wr_end_idx - wr_begin_idx - sizeof(uint32_t);
    buf.set_write_idx(wr_begin_idx);
    buf.write_uint32(len);
    buf.set_write_idx(wr_end_idx);

    return 0;
}
Ejemplo n.º 15
0
int Operating::offline_dragon_vale_rob_fight_result_notice(role_id_t role_id, uint8_t notice_type, std::string server_name,
								std::string player_name, uint8_t result) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_DRAGON_VALE_ROB_FIGHT_RESULT;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.write_uint8(notice_type);
	buf.write_string(server_name);
	buf.write_string(player_name);
	buf.write_uint8(result);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Ejemplo n.º 16
0
int Operating::offline_dragon_vale_building_notice(role_id_t role_id, uint8_t notice_type,
								uint8_t gold_mine, uint8_t moon_well, uint8_t totem) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	uint32_t op_type = OPERATING_OFFLINE_DRAGON_VALE_BUILDING;
	buf.write_uint32(op_type);
	buf.write_int64(role_id);
	buf.write_uint8(notice_type);
	buf.write_uint8(gold_mine);
	buf.write_uint8(moon_well);
	buf.write_uint8(totem);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
Ejemplo n.º 17
0
int DragonInfo::serialize(Block_Buffer &buffer) const {
	buffer.write_uint8(progress);
	buffer.write_uint8(feeling);
	buffer.write_uint32(power);
	buffer.write_uint32(armor);
	buffer.write_uint32(stamina);
	buffer.write_uint32(power_level);
	buffer.write_uint32(armor_level);
	buffer.write_uint32(stamina_level);
	buffer.write_uint32(hero_power);
	buffer.write_uint32(hero_armor);
	buffer.write_uint32(hero_stamina);
	buffer.write_uint32(hero_power_level);
	buffer.write_uint32(hero_armor_level);
	buffer.write_uint32(hero_stamina_level);
	buffer.write_bool(is_play_dragon);
	buffer.write_uint32(energy);
	buffer.write_uint32(crit);
	buffer.write_uint32(prevent_crit);
	buffer.write_uint32(crit_level);
	buffer.write_uint32(prevent_crit_level);
	buffer.write_uint32(hero_crit);
	buffer.write_uint32(hero_prevent_crit);
	buffer.write_uint32(hero_crit_level);
	buffer.write_uint32(hero_prevent_crit_level);
	return 0;
}
Ejemplo n.º 18
0
int Dragon_Vale_Detail::serialize(Block_Buffer &buffer) const {
	buffer.write_int64(role_id);
	buffer.write_int64(target_player_id);
	buffer.write_bool(is_rob_enter_dragon_vale);
	buffer.write_int64(uuid);
	buffer.write_bool(is_gold_mine_max_storage);
	buffer.write_bool(is_moon_well_max_storage);
	buffer.write_bool(is_totem_max_storage);
	buffer.write_uint8(build_gold_mine_num);
	buffer.write_uint8(build_moon_well_num);
	buffer.write_uint8(build_totem_num);
	buffer.write_uint8(build_queue_num);
	buffer.write_uint8(all_open_build_queue_num);

	uint8_t size = dragon_building_info_map.size();
	buffer.write_uint8(size);

	for(DragonBuildingInfoMap::const_iterator it = dragon_building_info_map.begin();
			it != dragon_building_info_map.end();
			++it) {
		it->second.serialize(buffer);
	}

	buffer.write_bool(is_dragon_born);
	buffer.write_uint64((uint64_t)begin_born_time.sec());

	dragon_info.serialize(buffer);

	buffer.write_uint64((uint64_t)begin_play_dragon_interval_time.sec());
	buffer.write_uint64((uint64_t)begin_down_feeling_time.sec());

	buffer.write_bool(is_vip_down_to_zero);
	buffer.write_uint32(matched_num);

	size = thief_id_quality_map.size();
	buffer.write_uint8(size);
	for(Thief_Id_Quality_Map::const_iterator it = thief_id_quality_map.begin(); it != thief_id_quality_map.end(); ++it) {
		buffer.write_int64(it->first);
		buffer.write_int64(it->second);
	}

	buffer.write_uint64((uint64_t)begin_refresh_thief_time.sec());

	buffer.write_uint8(star_num);
	buffer.write_uint8(award_foot_num);
	buffer.write_bool(is_special);

	size = foot_info_map.size();
	buffer.write_uint8(size);
	for(Foot_Info_Map::const_iterator it = foot_info_map.begin(); it != foot_info_map.end(); ++it) {
		buffer.write_int64(it->first);
		buffer.write_uint8(it->second.sex);
		buffer.write_string(it->second.name);
	}

	uint32_t size_32 = foot_id_set.size();
	buffer.write_uint32(size_32);
	for(Foot_Id_Set::const_iterator it = foot_id_set.begin(); it != foot_id_set.end(); ++it) {
		buffer.write_int64(*it);
	}

	buffer.write_bool(is_yesterday_login);
	buffer.write_uint8(dragon_heart_num);

	size = notice_board_list.size();
	buffer.write_uint8(size);
	for(Notice_Board_List::const_iterator it = notice_board_list.begin();
			it != notice_board_list.end();
			++it) {
		it->serialize(buffer);
	}

	buffer.write_bool(is_rob_protect);
	buffer.write_uint64((uint64_t)begin_rob_protect_time.sec());

	buffer.write_bool(is_first_enter_after_robbed);

	buffer.write_bool(is_in_robbed_dragon_vale);
	buffer.write_uint64((uint64_t)begin_in_robbed_dragon_vale_time.sec());

	size = cancel_create_building_set.size();
	buffer.write_uint8(size);
	for(Cancel_Create_Building_Set::const_iterator it = cancel_create_building_set.begin();
			it != cancel_create_building_set.end();
			++it) {
		buffer.write_uint8(*it);
	}

	buffer.write_bool(is_dragon_vale_open);

	buffer.write_uint64((uint64_t)begin_no_enter_time.sec());
	buffer.write_uint32(left_time);

	buffer.write_uint32(play_dragon_num);
	buffer.write_uint32(drive_thief_num);

	return 0;
}
int Expedition_Manager_Data::serialize(Block_Buffer &w) const {
	w.write_uint32(inter_);

	w.write_uint16(opened_uuid_opentime_map_.size());
	for (Role_Id_Time_Map::const_iterator it = opened_uuid_opentime_map_.begin();//服务器的开服时间
			it != opened_uuid_opentime_map_.end(); ++it) {
		w.write_int64(it->first);
		it->second.serialize(w);
	}

	w.write_uint16(gang_id_uuid_map_.size());
	for (RoleID_RoleID_Map::const_iterator it = gang_id_uuid_map_.begin();
			it != gang_id_uuid_map_.end(); ++it) {
		w.write_int64(it->first);
		w.write_int64(it->second);
	}

	last_reset_time_.serialize(w);
	w.write_uint16(first_gang_rank_.size());
	for (Role_UInt_Map::const_iterator it = first_gang_rank_.begin();
			it != first_gang_rank_.end(); ++it) {
		w.write_int64(it->first);
		w.write_uint32(it->second);
	}

	w.write_bool(has_init_);
	w.write_uint16(uuid_has_init_.size());
	for (Role_Bool_Map::const_iterator it = uuid_has_init_.begin();
			it != uuid_has_init_.end(); ++it) {
		w.write_int64(it->first);
		w.write_bool(it->second);
	}

	w.write_uint16(gang_rank_map_.size());
	for (Gang_ExpeditionGangRankInfo_Map::const_iterator it = gang_rank_map_.begin();
			it != gang_rank_map_.end(); ++it) {
		w.write_int64(it->first);
		it->second.serialize(w);
	}

	w.write_uint16(uuid_gang_rank_map_.size());
	for (Role_GangExpeditionGangRankInfoMap_Map::const_iterator it_igrm = uuid_gang_rank_map_.begin();
			it_igrm != uuid_gang_rank_map_.end(); ++it_igrm) {
		w.write_int64(it_igrm->first);
		w.write_uint16(gang_rank_map_.size());
		for (Gang_ExpeditionGangRankInfo_Map::const_iterator it = it_igrm->second.begin();
				it != it_igrm->second.end(); ++it) {
			w.write_int64(it->first);
			it->second.serialize(w);
		}
	}

	w.write_uint16(gang_rank_sync_success_.size());
	for (Role_Hash_Set::iterator it = gang_rank_sync_success_.begin();//公会排名获取成功服务器uuid列表
			it != gang_rank_sync_success_.end(); ++it) {
		w.write_int64(*it);
	}

	w.write_uint16(gang_rank_sync_new_vec_.size());
	for (Role_Vec::const_iterator it = gang_rank_sync_new_vec_.begin();
			it != gang_rank_sync_new_vec_.end(); ++it) {
		w.write_int64(*it);
	}

	w.write_uint16(gang_id_point_id_.size());
	for (Role_UInt_Map::const_iterator it = gang_id_point_id_.begin();
			it != gang_id_point_id_.end(); ++it) {
		w.write_int64(it->first);
		w.write_uint32(it->second);
	}

	w.write_uint16(gang_id_cur_line_.size());
	for (Role_Int_Map::const_iterator it = gang_id_cur_line_.begin();
			it != gang_id_cur_line_.end(); ++it) {
		w.write_int64(it->first);
		w.write_int32(it->second);
	}

	w.write_uint16(uuid_gang_id_point_id_.size());
	for (Role_RoleUIntMap_Map::const_iterator it = uuid_gang_id_point_id_.begin();
			it != uuid_gang_id_point_id_.end(); ++it) {
		w.write_int64(it->first);
		w.write_uint16(it->second.size());
		for (Role_UInt_Map::const_iterator it_t = it->second.begin();
				it_t != it->second.end(); ++it_t) {
			w.write_int64(it_t->first);
			w.write_uint32(it_t->second);
		}
	}

	w.write_uint16(uuid_gang_id_cur_line_.size());
	for (Role_RoleIntMap_Map::const_iterator it = uuid_gang_id_cur_line_.begin();
			it != uuid_gang_id_cur_line_.end(); ++it) {
		w.write_int64(it->first);
		w.write_uint16(it->second.size());
		for (Role_Int_Map::const_iterator it_t = it->second.begin();
				it_t != it->second.end(); ++it_t) {
			w.write_int64(it_t->first);
			w.write_int32(it_t->second);
		}
	}
	 ;
	// scene--
	w.write_uint16(line_scene_map_.size());
	for (Line_ExpeditionSceneData_Map::const_iterator it = line_scene_map_.begin();
			it != line_scene_map_.end(); ++it) {
		w.write_uint32(it->first);
		it->second.serialize(w);
	}

	w.write_uint16(uuid_line_scene_map_.size());
	for (UUID_LineExpeditionSceneData_Map_Map::const_iterator it_ulsm = uuid_line_scene_map_.begin();
			it_ulsm != uuid_line_scene_map_.end(); ++it_ulsm) {
		w.write_int64(it_ulsm->first);
		w.write_uint16(it_ulsm->second.size());
		for (Line_ExpeditionSceneData_Map::const_iterator it = it_ulsm->second.begin();
				it != it_ulsm->second.end(); ++it) {
			w.write_uint32(it->first);
			it->second.serialize(w);
		}
	}
	return 0;
}
Ejemplo n.º 20
0
void Player_Base<PLAYER>::make_message(Block_Buffer &buf, int msg_id) {
	buf.write_uint32(0); /// length
	buf.write_uint32(msg_id);
	buf.write_int64(role_id());
}