Beispiel #1
0
 /**
  * @Purpose:
  * 获取英雄技能信息
  * @Method Name: get_hero_skill_info()
  * @Parameter: $player_id 玩家ID     
  * @Parameter: $hero_id 英雄ID
  * @Parameter: $hero_skill_id 英雄技能ID
  * @Parameter: $hero_skill_pos 英雄技能孔ID
  * @Return: mixed 指定玩家的技能学习信息
  */
 public function get_hero_skill_info($player_id, $hero_id, $hero_skill_id, $hero_skill_pos)
 {
     $player_id = intval($player_id);
     #$hero_id = intval($hero_id);
     $hero_skill_id = intval($hero_skill_id);
     $hero_skill_pos = intval($hero_skill_pos);
     if (!$player_id || !$hero_id || !$hero_skill_id || !$hero_skill_pos) {
         $this->throw_error('10102');
     }
     $obj_player_hero_game = $this->get_game('Hero');
     $is_exist = $obj_player_hero_game->is_player_hero_id($player_id, $hero_id);
     if (!$is_exist) {
         $this->throw_error('10102');
     }
     $skill_data = $this->get_player_hero_skill_list($hero_id);
     if (!$skill_data[$hero_skill_id]) {
         $this->throw_error('10102');
     }
     //临时显示数据======================================
     $skill_lib_data[0] = 1111;
     $skill_lib_data[1] = 2222;
     $skill_lib_data[2] = 3333;
     //================================================
     $data = array();
     $data['item_num'] = 1;
     $data['skill_info'] = array_values($skill_data[$hero_skill_id]);
     $data['skill_lib_info'] = $skill_lib_data;
     return Struct_Hero::get_skill_item_struct($data);
 }
Beispiel #2
0
 /**
  * @Purpose:
  * 获取目标玩家英雄信息
  * @Param $player_id 玩家ID
  * @Return 指定格式的玩家英雄列表
  */
 public function get_target_player_hero_info($player_id)
 {
     $player_id = intval($player_id);
     #获取玩家所有英雄
     $obj_player_hero_data = $this->get_data('PlayerHero');
     $data = $obj_player_hero_data->get_player_hero_list($player_id);
     //出战英雄列表
     $fight_hero_list = array();
     //后补英雄列表
     $after_fight_hero_list = array();
     if (Com_Array::is_good_arr($data)) {
         #获取英雄公会科技属性加成
         $union_attr = $this->get_data('PlayerDetail')->get_player_detail($player_id, 'union_hero_attr');
         $union_attr = Com_FmtData::cus_json_decode($union_attr);
         foreach ($data as $key => $val) {
             if (!$val) {
                 unset($data[$key]);
                 continue;
             }
             $val = Com_FmtData::cus_json_decode($val);
             if (count($data) == 1 && !isset($val['hero_id'])) {
                 $data = array();
                 break;
             }
             $data[$key] = $val;
             if ($val['state'] == 1 || $val['state'] == 2) {
                 //获取英雄属性基础表
                 $attr_table = $this->get_hero_attr_table($data[$key]['hero_code']);
                 if (!$attr_table) {
                     $this->throw_error('10109');
                     //配置表读取错误
                 }
                 $data[$key]['fit_attr_per'] = Com_FmtData::cus_json_decode($data[$key]['fit_attr_per']);
                 $data[$key]['rune_hole_list'] = Com_FmtData::cus_json_decode($data[$key]['rune_hole_list']);
                 $data[$key]['skill_list'] = Com_FmtData::cus_json_decode($data[$key]['skill_list']);
                 if (Com_Array::is_good_arr($union_attr)) {
                     $hero_data = $data[$key];
                     //战斗力计算
                     $data[$key]['fight'] = $this->calc_fight($hero_data['player_id'], $hero_data, $hero_data['fit'], $hero_data['rune_hole_list'], $hero_data['star_add_attr_per'], $hero_data['skill_list'], $union_attr);
                 }
                 #等级,潜能等级,合体等级,星级最大值
                 $data[$key]['level_max'] = $attr_table['level_limit'];
                 $data[$key]['potential_max'] = $attr_table['potential_limit'];
                 $data[$key]['fit_max'] = $attr_table['fit_limit'];
                 $data[$key]['star_max'] = $attr_table['star_limit'];
                 //星级属性加成
                 $data[$key]['life'] += intval($data[$key]['life'] * ($data[$key]['star_add_attr_per'] / 10000));
                 $data[$key]['attack'] += intval($data[$key]['attack'] * ($data[$key]['star_add_attr_per'] / 10000));
                 $data[$key]['def'] += intval($data[$key]['def'] * ($data[$key]['star_add_attr_per'] / 10000));
                 //潜能属性加成
                 $data[$key]['life'] += $data[$key]['potential_life'];
                 $data[$key]['attack'] += $data[$key]['potential_attack'];
                 $data[$key]['def'] += $data[$key]['potential_def'];
                 #合体属性加成
                 $data[$key]['hp'] += $data[$key]['fit_life'];
                 $data[$key]['attack'] += $data[$key]['fit_attack'];
                 $data[$key]['def'] += $data[$key]['fit_def'];
                 #成长值
                 $data[$key]['grow'] = $data[$key]['grow_rate'] + $data[$key]['fit_grow'];
                 #合体属性百分比加成
                 if (Com_Array::is_good_arr($data[$key]['fit_attr_per'])) {
                     $data[$key]['life'] += intval($data[$key]['life'] * ($data[$key]['fit_attr_per']['hp_per'] / 10000));
                     $data[$key]['def'] += intval($data[$key]['def'] * ($data[$key]['fit_attr_per']['arm_per'] / 10000));
                     $data[$key]['attack'] += intval($data[$key]['attack'] * ($data[$key]['fit_attr_per']['atk_per'] / 10000));
                 }
                 #技能百分比加成
                 $data[$key]['hp'] += intval($data[$key]['hp'] * ($data[$key]['skill_life'] / 100));
                 $data[$key]['attack'] += intval($data[$key]['attack'] * ($data[$key]['skill_attack'] / 100));
                 $data[$key]['def'] += intval($data[$key]['def'] * ($data[$key]['skill_def'] / 100));
                 #成长值百分比加成
                 $data[$key]['life'] += intval($data[$key]['life'] * $this->calc_grow_attar($data[$key]['grow_rate'], $attr_table['grow']));
                 $data[$key]['def'] += intval($data[$key]['def'] * $this->calc_grow_attar($data[$key]['grow_rate'], $attr_table['grow']));
                 $data[$key]['attack'] += intval($data[$key]['attack'] * $this->calc_grow_attar($data[$key]['grow_rate'], $attr_table['grow']));
                 #公会科技加成
                 $data[$key]['life'] += $union_attr['hp'];
                 $data[$key]['attack'] += $union_attr['atk_min'];
                 $data[$key]['def'] += $union_attr['arm'];
                 //符文数据格式化
                 $data[$key]['rune_hole_list'] = $this->format_rune($player_id, $data[$key]['rune_hole_list']);
             }
             //获取出战英雄
             if ($val['state'] == 1) {
                 $data[$key]['hero_hole_state'] = 1;
                 $fight_hero_list[] = Struct_Hero::get_hero_info_struct($data[$key]);
             } else {
                 if ($val['state'] == 2) {
                     $data[$key]['hero_hole_state'] = 1;
                     $after_fight_hero_date[$key] = Struct_Hero::get_hero_info_struct($data[$key]);
                 }
             }
         }
     }
     //填补出战英雄空位数据
     if (!Com_Array::is_good_arr($fight_hero_list)) {
         $fight_hero_list[0]['hero_hole_state'] = 1;
         $fight_hero_list[0] = Struct_Hero::get_hero_info_struct($fight_hero_list[0]);
     }
     //后补英雄按按后补缓存顺序排序
     //获取后补英雄数据
     $after_fight_hero = $obj_player_hero_data->get_after_fight_hero($player_id);
     if (Com_Array::is_good_arr($after_fight_hero)) {
         foreach ($after_fight_hero as $key) {
             $after_fight_hero_list[$key] = $after_fight_hero_date[$key];
         }
     }
     //获取玩家后补英雄开启数量
     $after_fight_hero_limit = $this->get_data('Player')->get_player_info($player_id, 'after_hero_hole');
     //$after_fight_hero_limit = 2;
     $after_fight_hero_max = 2;
     //填补后补英雄空位数据
     $after_fight_hero_num = count($after_fight_hero_list);
     if (!Com_Array::is_good_arr($after_fight_hero_list) || $after_fight_hero_num < $after_fight_hero_max) {
         for ($i = $after_fight_hero_num; $i < $after_fight_hero_max; $i++) {
             if ($i < $after_fight_hero_limit) {
                 $after_fight_hero_list[$i]['hero_hole_state'] = 1;
                 $after_fight_hero_list[$i] = Struct_Hero::get_hero_info_struct($after_fight_hero_list[$i]);
             } else {
                 $after_fight_hero_list[$i] = Struct_Hero::get_hero_info_struct($after_fight_hero_list[$i]);
             }
         }
     }
     //合并列表
     $new_data = array_merge($fight_hero_list, $after_fight_hero_list);
     $rtn_data['hero_list'] = $new_data;
     return Struct_Hero::get_hero_panel_struct($rtn_data);
 }
Beispiel #3
0
 /**
  * 英雄推荐面板
  * @param $player_id
  */
 public function get_hero_panel($player_id)
 {
     $out = array('grade' => array(), 'heroes' => array());
     $hero_list = $this->get_data('PlayerHero')->get_fight_hero($player_id);
     $after_hero = $this->get_data('PlayerHero')->get_after_fight_hero($player_id);
     $hero_num = count($hero_list);
     $obj_player_hero_data = $this->get_data('PlayerHero');
     if (is_null($this->player_info)) {
         $player_info = $this->get_data('Player')->get_player_info($player_id, array('level', 'after_hero_hole', 'hero_fpower'));
     } else {
         $player_info = $this->player_info;
     }
     $sum_power = $player_info['hero_fpower'];
     if ($hero_list) {
         foreach ($hero_list as $hero_id => $hero_code) {
             $data = $obj_player_hero_data->get_player_hero_info($player_id, $hero_id);
             $data['hero_hole_state'] = 1;
             $hero_data = Struct_Hero::get_hero_info_struct($data);
             $advise_list = $this->get_hero_recommend($player_id, $player_info['level'], $hero_data, $hero_num);
             $out['heroes'][] = array('vo' => $hero_data, 'advise' => $advise_list);
         }
     } else {
         $tmp_data = $this->get_hero_recommend($player_id, $player_info['level'], array(), $hero_num);
         $out['heroes'][] = array('vo' => Struct_Hero::get_hero_info_struct(array('hero_hole_state' => 1)), 'advise' => $tmp_data);
     }
     $grade = $this->get_power_grade(4, $sum_power, $player_info['level']);
     $next_power = $this->get_next_power_grade(4, $grade, $player_info['level']);
     $out['grade']['type'] = 4;
     $out['grade']['grade'] = $grade;
     $out['grade']['power'] = intval($sum_power);
     $out['grade']['target_grade_power'] = $next_power - $sum_power;
     $out['grade']['target_grade_power'] = $out['grade']['target_grade_power'] < 0 ? 0 : $out['grade']['target_grade_power'];
     return $out;
 }