int Expedition_Force::deserialize(Block_Buffer &r) { r.read_int64(server_uuid); r.read_string(server_name); r.read_int64(gang_id); r.read_string(gang_name); return 0; }
void Expedition_Scene_Demage_Rank_Data::deserialize(Block_Buffer &r) { r.read_string(role_name); r.read_int64(role_id); r.read_int64(gang_id); r.read_string(gang_name); r.read_int64(uuid); r.read_string(server_name); r.read_int32(force); r.read_int32(level); r.read_double(demage); }
int Expedition_Occupy_Castle_Data::deserialize(Block_Buffer &r) { r.read_int64(role_id); r.read_int64(gang_id); r.read_int64(server_uuid); r.read_string(role_name); r.read_string(gang_name); r.read_string(server_name); r.read_int32(level); r.read_int32(force); r.read_int16(nums); r.read_int16(get_nums); return 0; }
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; }
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 Scene_Server_Request::process_20300100(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) { Monitor_Unique_ID logic_muid; role_id_t player_role_id = 0; int level = 0; int force = 0; role_id_t gang_id = 0; int8_t remain_income_num = 0; int16_t income_rate = 0; int total_merit = 0; int remain_time = 0; int act_time = 0; std::string server_name; logic_muid.deserialize(buf); buf.read_int64(player_role_id); buf.read_int32(level); buf.read_int32(force); buf.read_int64(gang_id); buf.read_int8(remain_income_num); buf.read_int16(income_rate); buf.read_int32(total_merit); buf.read_int32(remain_time); buf.read_int32(act_time); buf.read_string(server_name); SCENE_WAR_MANAGER->req_enter_war_scene(logic_muid, player_role_id, level, force, gang_id, remain_income_num, income_rate, total_merit, remain_time, act_time, server_name); 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 Scene_Server_Request::process_20100028(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) { JUDGE_PLAYER_NULL(player, role_id); std::string new_name = ""; if (0 != buf.read_string(new_name) || new_name.empty()) { return -1; } player->set_role_name(new_name); return 0; }
v8::Local<v8::Object> Msg_Struct::build_msg_object(Isolate* isolate, int cid, int player_cid, int msg_id, int status, Block_Buffer &buffer) { EscapableHandleScope handle_scope(isolate); Local<ObjectTemplate> localTemplate = ObjectTemplate::New(isolate); Local<Object> buf_obj = localTemplate->NewInstance(isolate->GetCurrentContext()).ToLocalChecked(); buf_obj->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "cid", NewStringType::kNormal).ToLocalChecked(), Int32::New(isolate, cid)).FromJust(); buf_obj->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "player_cid", NewStringType::kNormal).ToLocalChecked(), Int32::New(isolate, player_cid)).FromJust(); buf_obj->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "msg_id", NewStringType::kNormal).ToLocalChecked(), Int32::New(isolate, msg_id)).FromJust(); buf_obj->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "status", NewStringType::kNormal).ToLocalChecked(), Int32::New(isolate, status)).FromJust(); if (msg_id == SYNC_DB_GAME_LOAD_PLAYER || msg_id == SYNC_DB_GAME_CREATE_PLAYER) { std::string account = ""; buffer.read_string(account); buf_obj->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, "account", NewStringType::kNormal).ToLocalChecked(), String::NewFromUtf8(isolate, account.c_str(), NewStringType::kNormal).ToLocalChecked()).FromJust(); } //消息返回成功加载数据 if (status == 0) { for(std::vector<Field_Info>::const_iterator iter = field_vec().begin(); iter != field_vec().end(); iter++) { if(iter->field_label == "arg") { Local<Value> value = build_object_arg(*iter, buffer, isolate); buf_obj->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, iter->field_name.c_str(), NewStringType::kNormal).ToLocalChecked(), value).FromJust(); } else if(iter->field_label == "vector") { Local<Array> array = build_object_vector(*iter, buffer, isolate); buf_obj->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, iter->field_name.c_str(), NewStringType::kNormal).ToLocalChecked(), array).FromJust(); } else if(iter->field_label == "map") { Local<Map> map = build_object_map(*iter, buffer, isolate); buf_obj->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, iter->field_name.c_str(), NewStringType::kNormal).ToLocalChecked(), map).FromJust(); } else if(iter->field_label == "struct") { Local<Object> object = build_object_struct(*iter, buffer, isolate); buf_obj->Set(isolate->GetCurrentContext(), String::NewFromUtf8(isolate, iter->field_name.c_str(), NewStringType::kNormal).ToLocalChecked(), object).FromJust(); } } } return handle_scope.Escape(buf_obj); }
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; }
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 Honor_Arena_Manager::inner_player_enter(const role_id_t gang_id, Block_Buffer& buf){ role_id_t role_id = 0; std::string role_name = ""; int vip_lv = 0; int career = 0; int force = 0; std::string gang_name; buf.read_int64(role_id); buf.read_string(role_name); buf.read_int32(vip_lv); buf.read_int32(career); buf.read_int32(force); buf.read_string(gang_name); bool is_new = false; Honor_Arena_Player_Info_Map::iterator it = player_info_map_.find(role_id); if(it == player_info_map_.end()){ Honor_Arena_Player_Info player_info; player_info.rank_info.role_id = role_id; player_info.rank_info.score = CONFIG_CACHE_HONOR_ARENA->get_base_score(); player_info.streak_win_state = CONFIG_CACHE_HONOR_ARENA->get_streak_show(); std::pair<Honor_Arena_Player_Info_Map::iterator, bool> result_pair = player_info_map_.insert(std::make_pair(role_id, player_info)); if(result_pair.second == true){ rank_info_.push_back(&(result_pair.first->second)); } is_new = true; } it = player_info_map_.find(role_id); if(it != player_info_map_.end()){ it->second.rank_info.role_name = role_name; it->second.rank_info.guild_name = gang_name; //it->second.rank_info.career = career; it->second.rank_info.force = force; it->second.state = 0; // idle } if(is_new){ refresh_rank(); } return 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 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 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 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; }
int Scene_Knight_Trials_Manager::scene_knight_trials_enter_fighter(Scene_Player *player, Block_Buffer& buf) { if(player == NULL){ return -1; } if(player->battle_scene()) { //正在战斗中 MSG_DEBUG("knight trials enter fighter is on fighter role_id:%ld, battle_status_:%d, battle_type_:%d", player->role_id(), player->battle_scene()->battle_status() , player->battle_scene()->get_battle_type()); //MSG_DEBUG("knight trials enter fighter is on fighter role_id:%ld", player->role_id()); return -1; } Battle_Scene *scene = GLOBAL_SCENE_MANAGER->create_battle_scene(player->move_scene()); if(!scene){ return -1; } scene->set_battle_type(Battle_Scene::BATTLE_TYPE_KNIGHT_TRIALS); scene->set_map_id(KNIGHT_TRIALS_FIGHTER_SCENE_MAP_ID); std::string role_name; role_name.clear(); int8_t career = 0; int8_t gender = 0; buf.read_int8(career); buf.read_int8(gender); buf.read_string(role_name); int8_t size = 0; buf.read_int8(size); Int_Vec avatar_vec; for (int8_t i=0; i<size; ++i) { int avatar_id = 0; buf.read_int32(avatar_id); avatar_vec.push_back(avatar_id); } NPC_Addition_Info add_info; add_info.birth_coord.x = 1; add_info.birth_coord.y = 5; add_info.ex_val1 = career; add_info.ex_val2 = gender; add_info.name = role_name; int monster_type = 63800108; Player_Monster* player_monster; player_monster = NPC_MANAGER->create_player_monster(monster_type, NULL, add_info, scene, buf); if(player_monster == NULL){ return -1; } player_monster->set_player_monster_avatar(avatar_vec); player_monster->hero_battle_birth(buf, scene); player_monster->battle_enter_appaer(scene); double morale_init = player_monster->fighter_detail().fetch_fight_property(Property_Type::PT_INIT_MORALE, Prop_Value::ELEM_NORMAL); Hero* hero = player_monster->find_hero(); if(0 != hero) { morale_init += hero->fighter_detail().fetch_fight_property(Property_Type::PT_INIT_MORALE, Prop_Value::ELEM_NORMAL); } player_monster->reset_morale_and_hp(morale_init, player_monster->blood_max(), false); if(player->set_battle_position(0, Position_Key::LINE_TWO_FRONT, scene) == 0){ player->enter_battle_scene(scene); } 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 Scene_Server_Request::process_20300030(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf){ JUDGE_PLAYER_NULL(player, role_id); if (player->is_in_battle()) { MSG_DEBUG("creat arena fail player in battle"); return ERROR_PLAYER_IN_BATTLE; } if (player->dead_status()) { MSG_DEBUG("creat arena fail player dead"); return ERROR_PLAYER_DIE; } Battle_Scene *scene = GLOBAL_SCENE_MANAGER->create_battle_scene(player->move_scene()); if(!scene){ return -1; } scene->set_battle_type(Battle_Scene::BATTLE_TYPE_ARENA); int fight_map_id = CONFIG_CACHE_ARENA->get_arena_fight_map_id(); scene->set_map_id(fight_map_id); // role_id_t match_role_id = 0; // buf.read_int64(match_role_id); // if(match_role_id == 0){ // // }else{ // // } int32_t inner_area = 0; int8_t career = 0; int8_t gender = 0; std::string role_name; buf.read_int32(inner_area); buf.read_int8(career); buf.read_int8(gender); buf.read_string(role_name); int8_t size = 0; buf.read_int8(size); Int_Vec avatar_vec; for (int8_t i=0; i<size; ++i) { int avatar_id = 0; buf.read_int32(avatar_id); avatar_vec.push_back(avatar_id); } NPC_Addition_Info add_info; add_info.birth_coord.x = 1; add_info.birth_coord.y = 5; add_info.ex_val1 = career; add_info.ex_val2 = gender; add_info.name = role_name; int monster_type = 63800108; Player_Monster* player_monster; player_monster = NPC_MANAGER->create_player_monster(monster_type, NULL, add_info, scene, buf); if(player_monster == NULL){ MSG_DEBUG("creat arena monster fail"); return -1; } player_monster->set_player_monster_avatar(avatar_vec); player_monster->hero_battle_birth(buf, scene); player_monster->battle_enter_appaer(scene); double morale_init = player_monster->fighter_detail().fetch_fight_property(Property_Type::PT_INIT_MORALE, Prop_Value::ELEM_NORMAL); Hero* hero = player_monster->find_hero(); if(0 != hero) { morale_init += hero->fighter_detail().fetch_fight_property(Property_Type::PT_INIT_MORALE, Prop_Value::ELEM_NORMAL); } player_monster->reset_morale_and_hp(morale_init, player_monster->blood_max(), false); if(player->set_battle_position(0, Position_Key::LINE_TWO_FRONT, scene) == 0){ player->enter_battle_scene(scene); } return 0; }