int Scene_Server_Request::process_20410001(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) { JUDGE_PLAYER_NULL(player, role_id); MSG_50200032 res_msg; res_msg.role_id = player->role_id(); res_msg.open_type = 1; player->fighter_detail().property_list(res_msg.prop_value); Hero *hero = SCENE_PUBLIC->find_fight_hero(player->role_id()); if (hero) { int hero_init_morale_type = hero->fighter_detail().init_morale.type; double hero_init_morale_val = hero->fighter_detail().init_morale.total(); for (uint16_t i = 0; i < res_msg.prop_value.size(); ++i) { if (res_msg.prop_value[i].type == hero_init_morale_type) { res_msg.prop_value[i].value += hero_init_morale_val; } } } res_msg.prop_value.push_back(Property(PT_CAREER, player->career())); res_msg.role_name = player->role_name();/*人物姓名*/ res_msg.gang_name = player->base_detail().gang_name;/*人物id*/ res_msg.gender = player->base_detail().gender;/*性别(1男,2女)*/ res_msg.gang_id = player->base_detail().gang_id;/*职业*/ res_msg.headship = player->ganger_detail().headship; res_msg.avatar_vec = player->base_detail().avatar_vec; OBJ_SEND_TO_CLIENT(res_msg, (*player)); return 0; }
void Player_Monster::floating_skill_trigger(const Skill_Config& cfg) { if (Skill_Type::TYPE_FLOAT_SKILL != cfg.skill_type) return; Hero *hero = find_hero(); if (0 == hero) return; Talent_Map::const_iterator find_it = hero->fighter_detail().talent_map.find(hero->fighter_detail().cur_used_talent_); if (find_it == hero->fighter_detail().talent_map.end()) return; for (Skill_DB_Info_Map::const_iterator it = find_it->second.skill_db_info_map.begin(); it != find_it->second.skill_db_info_map.end(); ++it) { const Skill_Config *cfg = CONFIG_CACHE_FIGHTER->skill_config_cache(it->second.skill_id); if (0 == cfg) continue; if (Skill_Type::TYPE_ADD_SKILL != cfg->skill_type) continue; hero->use_skill(cfg->skill_id); return; } }
int Scene_Server_Request::process_20100200(int cid, role_id_t role_id, Scene_Player *player, Block_Buffer &buf) { JUDGE_PLAYER_NULL(player, role_id); role_id_t role_id_2 = 0; int8_t open_type = 0; buf.read_int64(role_id_2); buf.read_int8(open_type); MSG_50100032 res_msg; res_msg.role_id = role_id_2; res_msg.open_type = open_type; player->fighter_detail().property_list(res_msg.prop_value); Hero *hero = SCENE_PUBLIC->find_fight_hero(player->role_id()); if (hero) { int hero_init_morale_type = hero->fighter_detail().init_morale.type; double hero_init_morale_val = hero->fighter_detail().init_morale.total(); for (uint16_t i = 0; i < res_msg.prop_value.size(); ++i) { if (res_msg.prop_value[i].type == hero_init_morale_type) { res_msg.prop_value[i].value += hero_init_morale_val; } } } res_msg.prop_value.push_back(Property(PT_CAREER, player->career())); res_msg.prop_value.push_back(Property(PT_CHARM, player->base_detail().charm)); /*魅力值*/ res_msg.role_name = player->role_name();/*人物姓名*/ res_msg.gang_name = player->base_detail().gang_name;/*人物id*/ res_msg.gender = player->base_detail().gender;/*性别(1男,2女)*/ res_msg.gang_id = player->base_detail().gang_id;/*职业*/ res_msg.headship = player->ganger_detail().headship; res_msg.avatar_vec = player->base_detail().avatar_vec; res_msg.vip = player->vip(); // OBJ_SEND_TO_CLIENT(res_msg, (*player)); Block_Buffer inner_buf; inner_buf.make_message(INNER_REQ_OPEN_PANEL); res_msg.serialize(inner_buf); inner_buf.finish_message(); player->send_to_logic(inner_buf); return 0; }
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 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; }