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 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 Prop_Setter::deserialize(Block_Buffer & r) { int prop_type_ =0, addition_type_ = 0; uint8_t operate_ = 0; if( r.read_int32(prop_type_) || r.read_int32(addition_type_) || r.read_uint8(operate_) || r.read_double(basic) || r.read_double(fixed) || r.read_double(percent) ) return -1; prop_type = Property_Type(prop_type_); addi_type = Addition_Type(addition_type_); operate = Operate_Type(operate_); 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; }
int Scene_Server_Request::process_20100029(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) { JUDGE_PLAYER_NULL(player, role_id); uint8_t gender = 0; buf.read_uint8(gender); player->modify_gender(gender); MSG_81000060 msg; msg.role_id = player->role_id(); Prop_Change change_info; change_info.prop_type = PT_GENDER; change_info.current_val = gender; msg.change_info.push_back(change_info); Block_Buffer active_buf; MAKE_MSG_BUF(msg, active_buf); // 广播给周围玩家 player->scene_broad_around(active_buf,Mover::SCENE_MOVE); return 0; }
void Team_Arena_Controler::update_role_score(Block_Buffer &buf) { uint8_t type = 0; buf.read_uint8(type); if (type) { int role_size = 0; std::string server_name; buf.read_string(server_name); buf.read_int32(role_size); for (int i = 0; i < role_size; ++i) { role_id_t role_id = 0; int score = 0; int force = 0; std::string name; buf.read_int64(role_id); buf.read_int32(score); buf.read_int32(force); buf.read_string(name); Team_Role_Score_Map::iterator find_it = team_role_score_map.find(role_id); if (find_it != team_role_score_map.end()) { find_it->second.score = score; find_it->second.change = true; } else { Team_Role_Score role_score; role_score.role_id = role_id; role_score.score = score; role_score.force = force; role_score.name = name; role_score.area = server_name; team_role_score_map.insert(std::make_pair(role_id, role_score)); } } if (level_team_role_score_map.empty()) refresh_rank_list(); } else { team_role_score_map.clear(); level_team_role_score_map.clear(); } }
int Honor_Arena_Manager::inner_sync_info(Scene_Player* player, Block_Buffer& buf){ int8_t sync_type = 0; buf.read_int8(sync_type); switch(sync_type){ case 99:{ role_id_t role_id = 0; std::string role_name = ""; uint8_t gender = 0; buf.read_int64(role_id); buf.read_string(role_name); buf.read_uint8(gender); Honor_Arena_Player_Info_Map::iterator it = player_info_map_.find(role_id); if(it != player_info_map_.end()){ it->second.rank_info.role_name = role_name; } break; } default:{ break; } } return 0; }
int Scene_Knight_Trials_Manager::scene_knight_trials_match_player(Block_Buffer& buf) { uint8_t type = 0; buf.read_uint8(type); role_id_t role_id = 0; buf.read_int64(role_id); if(!type || !role_id) { return 0; } int64_t from_uuid = 0; buf.read_int64(from_uuid); switch(type) { case KNIGHT_TRIALS_SIX_MATCH: { int ttl_force = 0; buf.read_int32(ttl_force); std::vector<int64_t> uuid_vector; SCENE_MONITOR->logic_server_uuid_to_vector(uuid_vector); //为了排除自己服; for(std::vector<int64_t>::iterator it = uuid_vector.begin(); it != uuid_vector.end(); ++it) { if(*it == from_uuid) { uuid_vector.erase(it); break; } } if(uuid_vector.empty()) { return 0; } std::map<int64_t, std::vector<uint8_t>> uuid_num_map; const Knight_Trials_Points_Conf_Map &conf = CONFIG_CACHE_KNIGHT_TRIALS->get_points_conf(); for(uint8_t i=1; i<=conf.size(); i++){ srandom(Time_Value::gettimeofday().sec() + Time_Value::gettimeofday().usec()); uint32_t index = random() % uuid_vector.size(); std::map<int64_t, std::vector<uint8_t>>::iterator it = uuid_num_map.find(uuid_vector[index]); if(it == uuid_num_map.end()) { std::vector<uint8_t> rank_vec; rank_vec.clear(); rank_vec.push_back(i); uuid_num_map.insert(std::make_pair(uuid_vector[index], rank_vec)); } else { it->second.push_back(i); } } for(std::map<int64_t, std::vector<uint8_t>>::iterator it = uuid_num_map.begin(); it != uuid_num_map.end(); ++it) { Block_Buffer block_buf; block_buf.make_message(INNER_KNIGHT_TRIALS_MATCH_PLAYER); block_buf.write_uint8(KNIGHT_TRIALS_SIX_MATCH); block_buf.write_int64(role_id); block_buf.write_int64(from_uuid); block_buf.write_int32(ttl_force); block_buf.write_uint8(it->second.size()); for(std::vector<uint8_t>::iterator rit = it->second.begin(); rit != it->second.end(); ++rit) { block_buf.write_uint8(*rit); } block_buf.finish_message(); SCENE_MONITOR->send_to_logic(it->first, block_buf); } break; } case KNIGHT_TRIALS_ONE_MATCH: { break; } case KNIGHT_TRIALS_SIX_MATCH_BACK: { Block_Buffer block_buf; block_buf.make_message(INNER_KNIGHT_TRIALS_MATCH_PLAYER); block_buf.write_uint8(KNIGHT_TRIALS_SIX_MATCH_BACK); block_buf.write_int64(role_id); block_buf.write_int64(from_uuid); block_buf.copy(&buf); SCENE_MONITOR->send_to_logic(from_uuid, block_buf); break; } case KNIGHT_TRIALS_ONE_MATCH_BACK: { break; } } 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; }