コード例 #1
0
ファイル: Map_Team.cpp プロジェクト: tidaybreak/game-server
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_);
}
コード例 #2
0
int Expedition_Global_Manager_Data::serialize(Block_Buffer &w) const {
	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(uuid_inter_map_.size());
	for (Role_Int_Map::const_iterator it = uuid_inter_map_.begin();
			it != uuid_inter_map_.end(); ++it) {
		w.write_int64(it->first);
		w.write_int32(it->second);
	}

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

	mmuid_.serialize(w);

//	w.write_uint16(inter_manager_data_map_.size());
//	for (Inter_ExpeditionManagerData_Map::const_iterator it = inter_manager_data_map_.begin();
//			it != inter_manager_data_map_.end(); ++it) {
//		w.write_uint32(it->first);
//		it->second.serialize(w);
//	}
	return 0;
}
コード例 #3
0
int Public_Detail::serialize(Block_Buffer &buffer) const {
	buffer.write_string(plot_id);
	buffer.write_int32(plot_step);
	buffer.write_bool(plot_switch);

	buffer.write_uint16(plot_info.size());
	for (String_Int_Map::const_iterator it = plot_info.begin(); it != plot_info.end(); ++it) {
		buffer.write_string(it->first);
		buffer.write_int32(it->second);
	}

	buffer.write_int32(awake_lvl);

	buffer.write_uint16(artifacts.size());
	for (Artifact_Map::const_iterator it = artifacts.begin(); it != artifacts.end(); ++it) {
		it->second.serialize(buffer);
	}

	buffer.write_uint16(fornotice_gifts_status.size());
	for (Fornotice_Gifts_Status_Map::const_iterator it = fornotice_gifts_status.begin();
			it != fornotice_gifts_status.end(); ++it) {
		buffer.write_int32(it->first);
		buffer.write_int8(it->second);
	}

	buffer.write_int32(exploit_val);
	buffer.write_int32(exploit_lvl);

	return 0;
}
コード例 #4
0
int Chat_Player::send_err_to_client(int error_id, int source) {
	Block_Buffer buf;
	buf.make_message(80000001);
	buf.write_int32(error_id);
	buf.write_int32(source);
	buf.write_string("");
	buf.finish_message();
	return send_to_client(buf);
}
コード例 #5
0
int Talent::serialize(Block_Buffer &buf) const {
	buf.write_int32(talent_id);
	buf.write_int32(skill_point);
	buf.write_uint16(skill_db_info_map.size());
	for (Skill_DB_Info_Map::const_iterator it = skill_db_info_map.begin(); it != skill_db_info_map.end(); ++it) {
		it->second.serialize(buf);
	}
	return 0;
}
コード例 #6
0
int Scene_Outpost_Manager::vagrant_store_trigger(Move_Scene* scene, const int point, bool is_boss, Coord point_coord){
	int scene_id = scene->scene_id();
	int monster_id = CONFIG_CACHE_NPC->vagrant_item_trigger(scene_id, point);
	if(monster_id == 0){
		return 0;
	}
	// create monster
	NPC_Addition_Info npc_add;
	npc_add.birth_coord = point_coord;
	Monster* monster = NPC_MANAGER->create_monster(monster_id, 5, scene, NULL, npc_add);
	if(!monster){
		return 0;
	}
	int64_t monster_role_id = monster->role_id();
	// 生存流浪商店物品
	Vagrant_Item_Config_Map* vic_map = CONFIG_CACHE_NPC->get_vagrant_item_config_map();
	if(!vic_map){
		return 0;
	}
	Vagrant_Item_Info_Vec vi_vec;
	Vagrant_Item_Info vi;
	for(Vagrant_Item_Config_Map::iterator it = vic_map->begin(); it != vic_map->end();
			++ it){
		if(it->second.is_valid(monster_id)){
			vi.reset();
			vi.cfg_key = it->second.key;
			vi.cfg_item_id = it->second.item_id;
			vi.cfg_cost_type = it->second.sys_sell_type;
			vi.cfg_cost = it->second.cost;
			vi.cfg_num = it->second.num;
			vi.cfg_limit_num = it->second.limit_num;
			vi_vec.push_back(vi);
		}
	}
	Vagrant_Store_Scene_Map::iterator it = vagrant_item_map_.find(scene_id);
	if(it != vagrant_item_map_.end()){
		it->second[monster_role_id] = vi_vec;
	}else{
		Vagrant_Store_Map vagrant_stroe_map;
		vagrant_stroe_map[monster_role_id] = vi_vec;
		vagrant_item_map_[scene_id] = vagrant_stroe_map;
	}
	// 飘字
	{
		int err_id = ERROR_VAGRANT_STORE_OPEN;
		Block_Buffer buf;
		buf.make_message(80000001);
		buf.write_int32(err_id);
		buf.write_int32(0);
		buf.write_string("");
		buf.finish_message();
		scene->broadcast_all(0, buf);
	}
	return 0;
}
コード例 #7
0
int Rune_Stone_Detail::serialize(Block_Buffer & w) const {
	w.write_int64(role_id);
	w.write_int32(points);
	w.write_int32(remain_double_times);

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

	return 0;
}
コード例 #8
0
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;
}
コード例 #9
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;
}
コード例 #10
0
int Team_Arena_Controler::refresh_rank_list(role_id_t role_id) {
	Scene_Player *player = 0;

	if (role_id) {
		Team_Role_Score_Map::iterator find_it = team_role_score_map.find(role_id);
		if (find_it != team_role_score_map.end()) {
			player = SCENE_MONITOR->find_scene_player_by_role_id(role_id);
			if (player) {
				Block_Buffer buf;
				buf.make_message(20100312);
				buf.write_int32(find_it->second.rank);
				buf.finish_message();
				player->send_to_logic(buf);
			}
		}
	} else {
		level_team_role_score_map.clear();
		for (Team_Role_Score_Map::iterator it = team_role_score_map.begin(); it != team_role_score_map.end(); ++it) {
			if (it->second.score > 0) {
				int level = CONFIG_CACHE_TEAM->arena_multi_level(it->second.score);
				level_team_role_score_map[level].push_back(&it->second);
				it->second.change = false;
			}
		}


		for (Level_Team_Role_Score_Map::iterator it = level_team_role_score_map.begin(); it != level_team_role_score_map.end(); ++it) {
			std::sort(it->second.begin(), it->second.end(), Team_Role_Score_Greater());

			int i = 1;
			for (Team_Role_Score_Vec::iterator r_it = it->second.begin(); r_it != it->second.end(); ++r_it, ++i) {
				if ((**r_it).rank != i) {
					player = SCENE_MONITOR->find_scene_player_by_role_id((*r_it)->role_id);
					if (player) {
						Block_Buffer buf;
						buf.make_message(20100312);
						buf.write_int32(i);
						buf.finish_message();
						player->send_to_logic(buf);
					}
				}
				(**r_it).rank = i;
			}
		}
	}

	return 0;
}
コード例 #11
0
void Prop_Setter::serialize(Block_Buffer & w) const {
	w.write_int32(prop_type);
	w.write_int32(addi_type);
	w.write_uint8(operate);
	w.write_double(basic);
	w.write_double(fixed);
	w.write_double(percent);
}
コード例 #12
0
int Scene_Outpost_Manager::req_vagrant_buy_item(Scene_Player* player, const int64_t monster_role_id, const int item_index){
	if(!player){
		return 0;
	}
	int scene_id = player->move_scene_id();
	Vagrant_Item_Info* item_info = get_vagrant_item_info(scene_id, monster_role_id, item_index);
	if(!item_info){
		return -1;
	}
	// 购买数量检测
	if(item_info->cfg_num != 0 &&
			item_info->buy_num >= item_info->cfg_num){
		//
		MSG_50211301 msg;
		msg.item_index = item_index;
		msg.result = 0;
		OBJ_SEND_TO_CLIENT(msg, (*player));
		//
		req_vagrant_item_info(player, monster_role_id);
		return ERROR_SECRET_SHOP_NUM_LIMIT;
	}
	// 限购检测
	if(item_info->cfg_limit_num != 0 &&
			item_info->player_buy_num(player->role_id()) >= item_info->cfg_limit_num){
		return ERROR_SECRET_SHOP_LIMIT_NUM_LIMIT;
	}
	{
		Block_Buffer buf;
		buf.make_message(INNER_SYNC_SCENE_OUTPOST);

		buf.write_int8(10);
		buf.write_int32(scene_id);
		buf.write_int64(monster_role_id);
		buf.write_int32(item_index);
		buf.write_int32(item_info->cfg_item_id);
		buf.write_int32(1);
		buf.write_int8(item_info->cfg_cost_type);
		buf.write_int32(item_info->cfg_cost);

		buf.finish_message();

		player->send_to_logic(buf);
	}
	return 0;
}
コード例 #13
0
ファイル: DB_Worker.cpp プロジェクト: ACEZLY/server
int DB_Worker::process_load_player(int cid, std::string &account) {
	Block_Buffer buf;
	buf.make_inner_message(SYNC_DB_GAME_LOAD_PLAYER);
	buf.write_string(account);
	DB_Manager::DB_Cache_Account_Map::iterator iter = DB_MANAGER->db_cache_account_map().find(account);
	if (iter != DB_MANAGER->db_cache_account_map().end())	{
		//角色存在,开始加载数据
		buf.write_int32(SUCCESS_LOADED);
		int64_t role_id = iter->second.role_id;
		load_player_data(role_id, buf);
	} else {
		//角色不存在,直接返回
		buf.write_int32(ROLE_NOT_EXIST);
	}
	buf.finish_message();
	DB_MANAGER->send_data_block(cid, buf);
	return 0;
}
コード例 #14
0
ファイル: Msg_Struct.cpp プロジェクト: jice1001/server
void Msg_Struct::build_buffer_arg(const Field_Info &field_info, Block_Buffer &buffer, Isolate* isolate, v8::Local<v8::Value> value) {
    if(field_info.field_type == "int8") {
        int8_t val = 0;
        if (value->IsInt32()) {
            val = value->Int32Value(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_int8(val);
    }
    else if(field_info.field_type == "int16") {
        int16_t val = 0;
        if (value->IsInt32()) {
            val = value->Int32Value(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_int16(val);
    }
    else if(field_info.field_type == "int32") {
        int32_t val = 0;
        if (value->IsInt32()) {
            val = value->Int32Value(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_int32(val);
    }
    else if(field_info.field_type == "int64") {
        int64_t val = 0;
        if (value->IsNumber()) {
            val = value->NumberValue(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_int64(val);
    }
    else if(field_info.field_type == "double") {
        double val = 0;
        if (value->IsNumber()) {
            val = value->NumberValue(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_double(val);
    }
    else if(field_info.field_type == "bool") {
        bool val = 0;
        if (value->IsBoolean()) {
            val = value->BooleanValue(isolate->GetCurrentContext()).FromJust();
        }
        buffer.write_bool(val);
    }
    else if(field_info.field_type == "string") {
        std::string val = "";
        if (value->IsString()) {
            String::Utf8Value str(value->ToString(isolate->GetCurrentContext()).ToLocalChecked());
            std::stringstream stream;
            stream << ToCString(str);
            val = stream.str();
        }
        buffer.write_string(val);
    }
    else {
        LOG_ERROR("Can not find the field_type:%s, struct_name:%s", field_info.field_type.c_str(), struct_name().c_str());
    }
}
コード例 #15
0
ファイル: Operating.cpp プロジェクト: tidaybreak/game-server
int Operating::offline_team_award(role_id_t role_id, int level_id) {

	Block_Buffer buf;
	buf.make_message(OPERATING_OFFLINE_TEAM_AWARD);
	buf.write_int64(role_id);
	buf.write_int32(level_id);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);

	return 0;
}
コード例 #16
0
ファイル: Operating.cpp プロジェクト: tidaybreak/game-server
int Operating::offline_arena_seven_day_reward(role_id_t role_id, Arena_Reward_Info &info){
	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_ARENA_SEVEN_DAY_REWARD;
	buf.write_int32(type);
	buf.write_int64(role_id);
	info.serialize(buf);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
コード例 #17
0
// for db save --
void Expedition_Scene_Demage_Rank_Data::serialize(Block_Buffer &w) const {
	w.write_string(role_name);
	w.write_int64(role_id);
	w.write_int64(gang_id);
	w.write_string(gang_name);
	w.write_int64(uuid);
	w.write_string(server_name);
	w.write_int32(force);
	w.write_int32(level);
	w.write_double(demage);
}
コード例 #18
0
int Scene_Common::req_single_dungeon_revive(int8_t type) {
    if(player_self() && player_self()->move_scene() &&
            player_self()->move_scene()->scene_type() == FuBen_Scene_Type) {
        int param1 = 0;
        int param2 = 0;
        int param3 = 0;
        player_self()->move_scene()->get_scene_param(param1, param2, param3);
        if(param1 != 1) {
            return 0;
        }
        if(type == 0) { // 免费复活
            if(param2 <= 0) { // 免费复活次数
                {
                    MSG_50200215 msg;
                    msg.result = 0;
                    THIS_SEND_TO_CLIENT(msg);
                }
                return ERROR_FB_REVIVE_NO_FREE;
            }
            param2 -= 1;
            param1 = 0;
            player_self()->move_scene()->set_scene_param(param1, param2, param3, true);
            player_self()->reset_revive_info();
            {
                MSG_81000026 msg;
                msg.role_id = player_self()->role_id();
                msg.state = 0;
                THIS_SEND_TO_CLIENT(msg);
            }
            {
                MSG_50200215 msg;
                msg.result = 1;
                THIS_SEND_TO_CLIENT(msg);
            }
        } else { // 付费复活
            if(param2 > 0) { // 免费复活次数
                {
                    MSG_50200215 msg;
                    msg.result = 0;
                    THIS_SEND_TO_CLIENT(msg);
                }
                return ERROR_FB_REVIVE_HAS_FREE;
            }
            Block_Buffer buf;
            buf.make_message(INNER_WAR_SCENE_SYNC_INFO);
            buf.write_int8(3);
            buf.write_int32(param3);
            buf.finish_message();
            this->send_to_logic(buf);
        }
    }
    return 0;
}
コード例 #19
0
ファイル: Operating.cpp プロジェクト: tidaybreak/game-server
int Operating::offline_ganger_info_update(role_id_t role_id, Ganger_Detail& detail) {
	if ( role_id == 0 ) return 0;
	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_GANGER_INFO;
	buf.write_int32(type);
	buf.write_int64(role_id);
	detail.serialize( buf );
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
コード例 #20
0
int Anci_Artifact_Detail::serialize(Block_Buffer &buffer) const {
	buffer.write_int64(role_id);
//	buffer.write_int64(perfectPoint);
	buffer.write_uint16(aa_info_map.size());
	for (AA_Info_Map::const_iterator it = aa_info_map.begin(); it != aa_info_map.end(); ++it) {
		buffer.write_int32(it->second.id);
		buffer.write_int8(it->second.state_count);
		buffer.write_int32(it->second.data);
	}
	buffer.write_uint16(complete_ids.size());
	for (Int_Hash_Set::const_iterator it = complete_ids.begin(); it != complete_ids.end(); ++it) {
		buffer.write_int32(*it);
	}
	buffer.write_uint16(aa_unban_info.size());
	for (AA_Unban_Info::const_iterator it = aa_unban_info.begin(); it != aa_unban_info.end(); ++it) {
		buffer.write_int32(it->second.id);
		buffer.write_int8(it->second.state);
		buffer.write_int8(it->second.box_state);
	}
	return 0;
}
コード例 #21
0
int Expedition_Occupy_Castle_Data::serialize(Block_Buffer &w) const {
	w.write_int64(role_id);
	w.write_int64(gang_id);
	w.write_int64(server_uuid);
	w.write_string(role_name);
	w.write_string(gang_name);
	w.write_string(server_name);
	w.write_int32(level);
	w.write_int32(force);
	w.write_int16(nums);
	w.write_int16(get_nums);
	return 0;
}
コード例 #22
0
void Hero_Info_Detail::serialize(Block_Buffer &w) const {
	w.write_int32(hero_id);
	w.write_int32(hero_index);
	w.write_int32(hero_facade_id);
	w.write_string(hero_name);
	w.write_int8(is_outer);
	w.write_int8(is_fighter);
	w.write_int32(level);
	w.write_int32(formation);
	w.write_int32(awake_lvl);
	w.write_double(exp);

	uint16_t __prop_value_vec_size = prop_value.size();
	w.write_uint16(__prop_value_vec_size);
	for(uint16_t i = 0; i < __prop_value_vec_size; ++i) {
			prop_value[i].serialize(w);
	}

	w.write_uint16(artifacts.size());
	for (Artifact_Map::const_iterator it = artifacts.begin(); it != artifacts.end(); ++it) {
		it->second.serialize(w);
	}
	hero_fighter_detail.serialize(w);
}
コード例 #23
0
int Team_Arena_Controler::get_role_score_list(role_id_t role_id, int level, Block_Buffer &buf) {
	//level = 0;
	//Team_Role_Score_Map::iterator t_find_it = team_role_score_map.begin();
	//if (t_find_it != team_role_score_map.end()) {
	//	level = t_find_it->second.rank;
	//}
	buf.write_int32(level);

	Level_Team_Role_Score_Map::iterator find_it = level_team_role_score_map.find(level);
	if (find_it != level_team_role_score_map.end()) {
		int amount = find_it->second.size() > 50 ? 50 : find_it->second.size();
		buf.write_int32(amount);
		for (Team_Role_Score_Vec::iterator it = find_it->second.begin(); it != find_it->second.end() && amount > 0; ++it, --amount) {
			buf.write_string((*it)->name);
			buf.write_string((*it)->area);
			buf.write_int32((*it)->score);
			buf.write_int32((*it)->force);
		}
	} else {
		buf.write_int32(0);
	}

	return 0;
}
コード例 #24
0
int Heroer_Detail::serialize_fighter(Block_Buffer &buffer) const{
	this->hero_base_detail_.serialize(buffer);
	buffer.write_int32(this->fighter_index);

	Hero_Map::const_iterator it = this->hero_map.find(this->fighter_index);
	if(it != this->hero_map.end()){
		int8_t has_hero = 1;
		buffer.write_int8(has_hero);
		it->second.serialize(buffer);
	}else{
		int8_t has_hero = 0;
		buffer.write_int8(has_hero);
	}
	return 0;
}
コード例 #25
0
ファイル: Operating.cpp プロジェクト: tidaybreak/game-server
int Operating::offline_mail(Mail_Send_Info &send_info) {
	if (!send_info.receiver_id) {
		MSG_USER("error receiver id");
		return -1;
	}
	MSG_DEBUG("offline_mail, role_id:%ld, mail_title:%s, mail_contents:%s", send_info.receiver_id, send_info.title.c_str(), send_info.content.c_str() );
	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_MAIL;
	buf.write_int32(type);
	send_info.serialize(buf);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);

	return 0;
}
コード例 #26
0
ファイル: Operating.cpp プロジェクト: tidaybreak/game-server
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;
}
コード例 #27
0
ファイル: Operating.cpp プロジェクト: tidaybreak/game-server
int Operating::offline_firend_handel(role_id_t role_id, role_id_t other_role_id, int8_t handel) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_APPLY_HANDEL;
	buf.write_int32(type);
	buf.write_int64(role_id);
	buf.write_int64(other_role_id);
	buf.write_int8(handel);
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);
	return 0;
}
コード例 #28
0
ファイル: DB_Worker.cpp プロジェクト: ACEZLY/server
int DB_Worker::process_create_player(int cid, Game_Player_Info &player_info) {
	Block_Buffer buf;
	buf.make_inner_message(SYNC_DB_GAME_CREATE_PLAYER);
	int32_t status = 0;
	if (DB_MANAGER->create_player(player_info) < 0) {
		status = ROLE_HAS_EXIST;
	} else {
		status = SUCCESS_CREATED;
		//创建所有玩家表
		create_player_data(player_info.role_id);
	}
	buf.write_string(player_info.account);
	buf.write_int32(status);
	load_player_data(player_info.role_id, buf);
	buf.finish_message();
	DB_MANAGER->send_data_block(cid, buf);
	return 0;
}
コード例 #29
0
ファイル: Operating.cpp プロジェクト: tidaybreak/game-server
int Operating::offline_firend_add(role_id_t role_id, role_id_t other_role_id, Time_Value time) {
	if (!role_id) {
		MSG_USER("error role id");
		return -1;
	}

	Block_Buffer buf;
	buf.make_message(MONGO_OPERATING_OFFLINE_DATA);
	int type = OPERATING_OFFLINE_FIREND_ADD;
	buf.write_int32(type);
	buf.write_int64(role_id);
	buf.write_int64(other_role_id);
	buf.write_int64(time.sec());
	buf.finish_message();
	DB_MANAGER->push_data_block(buf, 0);

	return 0;
}
コード例 #30
0
int Fighter_Detail::serialize(Block_Buffer &buffer) const {
	buffer.write_int64(role_id);

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

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

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

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

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

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

	be_cure_rate.serialize(buffer);
	effect_rate.serialize(buffer);

	pve_hurt_add.serialize(buffer);
	pve_hurt_sub.serialize(buffer);

	dizz_strengthen.serialize(buffer);
	dizz_weaken.serialize(buffer);

	buffer.write_int32(phy_power_recover_time);
	buffer.write_int32(phy_power_buy_times);
	buffer.write_int32(level);
	buffer.write_double(experience);
	buffer.write_double(elite_btl_morale);
	buffer.write_int32(force);
	buffer.write_int32(highest_force);
	buffer.write_int32(ttl_force);

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

	buffer.write_uint16(talent_map.size());
	for (Talent_Map::const_iterator it = talent_map.begin(); it != talent_map.end(); ++it) {
		it->second.serialize(buffer);
	}

	buffer.write_uint16(extra_skill_vec.size());
	for (Skill_DB_Info_Vec::const_iterator it = extra_skill_vec.begin(); it != extra_skill_vec.end(); ++it) {
		it->serialize(buffer);
	}

	buffer.write_bool(is_clear_moral_);

	return 0;
}