public function player_hero_grow_upgrade($player_id, $hero_id, $state) { $player_id = intval($player_id); $hero_id = strval($hero_id); $obj_player_hero_data = $this->get_data('PlayerHero'); $hero_data = $obj_player_hero_data->get_player_hero_info($player_id, $hero_id); if (empty($hero_data)) { $this->throw_error('10102'); #英雄不存在 } $hero_conf = Cache_HeroAttr::getInstance()->get_hero_attr_info($hero_data['hero_code']); if (empty($hero_conf)) { $this->throw_error('50120'); #英雄配置错误 } if ($hero_data['grow_rate'] >= $hero_conf['grow_limit']) { $this->throw_error('50121'); #成长值已达上限 } /* $obj_hero_grow = $this->get_data('PlayerHeroGrow'); $hero_grow_id = $obj_hero_grow->get_player_hero_grow_data($hero_id); $hero_grow_conf = array(); $findFlag = false; if(!$hero_grow_id){ $findFlag = true; }else{ $hero_grow_conf = Cache_HeroGrow::getInstance()->get_config_info($hero_grow_id); if(empty($hero_grow_conf)){ $findFlag = true; }else{ if($hero_data['grow_rate']<$hero_grow_conf['grow_left'] || $hero_data['grow_rate']>=$hero_grow_conf['grow_right']){#区间错误 $findFlag = true; } } } if($findFlag){#启动自动纠错 $hero_grow_id = $this->find_hero_grow_id($hero_data['grow_rate'], $hero_grow_conf); if(!$hero_grow_id){ $this->throw_error('10111');#配置错误 } } if(empty($hero_grow_conf)){ $this->throw_error('10111'); } $obj_prop_game = $this->get_game('Prop'); $consume_props = $last_props = array(); $last_props[$hero_grow_conf['item_id']] = intval($obj_prop_game->get_prop_num_by_prop_id($player_id, $hero_grow_conf['item_id'])); if($last_props[$hero_grow_conf['item_id']] < $hero_grow_conf['item_nums']){ $this->throw_error('50107'); } */ list($need_prop_id, $need_prop_nums) = explode(":", trim($hero_conf['grow_expend'])); if (empty($need_prop_id) || empty($need_prop_nums)) { $this->throw_error('10111'); } $obj_prop_game = $this->get_game('Prop'); $last_props_nums = intval($obj_prop_game->get_prop_num_by_prop_id($player_id, $need_prop_id)); if ($last_props_nums < $need_prop_nums) { $this->throw_error('50107'); } $hero_grow_conf = Cache_HeroGrow::getInstance()->get_config_info($need_prop_id); if (empty($hero_grow_conf)) { $this->throw_error('10111'); #配置错误 } $consume_props_nums = 0; #消耗道具数量 $crit_counter = 0; #暴击计数 $counter = 10; #while执行计数 $sum_rand_grow_val = 0; #总提升数量 $new_hero_grow_val = 0; #新的成长值 do { $counter--; // $last_props[$hero_grow_conf['item_id']] -= $hero_grow_conf['item_nums'];#剩余数量 // $consume_props[$hero_grow_conf['item_id']] += $hero_grow_conf['item_nums'];#消耗数量 $last_props_nums -= $need_prop_nums; $consume_props_nums += $need_prop_nums; $rand_val = 0; $is_crit = Com_Random::probability($hero_grow_conf['crit_rate']); if ($is_crit) { $crit_counter++; $rand_val = $this->parse_data($hero_grow_conf['val_crit']); } else { $rand_val = $this->parse_data($hero_grow_conf['val_nor']); } if (!$rand_val) { $this->throw_error('50122'); #英雄成长配置表解析错误 } #单次随机值 $real_rand_val = Com_Random::get_probability_key($rand_val); #批量随机值之和 $sum_rand_grow_val += $real_rand_val; #英雄的新成长值 $new_hero_grow_val = $hero_data['grow_rate'] + $sum_rand_grow_val; if ($new_hero_grow_val >= $hero_conf['grow_limit']) { #超过英雄成长值上限 $new_hero_grow_val = $hero_conf['grow_limit']; $sum_rand_grow_val = $hero_conf['grow_limit'] - $hero_data['grow_rate']; break; } /* #移动至下一个成长值区间 if($new_hero_grow_val > $hero_grow_conf['grow_right']){ $hero_grow_id++; $hero_grow_conf = Cache_HeroGrow::getInstance()->get_config_info($hero_grow_id); if(empty($hero_grow_conf)){ break; } if(!isset($last_props[$hero_grow_conf['item_id']])){ $last_props[$hero_grow_conf['item_id']] = intval($obj_prop_game->get_prop_num_by_prop_id($player_id, $hero_grow_conf['item_id'])); } } if($last_props[$hero_grow_conf['item_id']] < $hero_grow_conf['item_nums']){#道具不足 break; } */ if ($last_props_nums < $need_prop_nums) { break; } } while ($counter > 0 && $state > 0); #控制循环数量防止进入死循环 $result = true; $player_info = $this->get_data('Player')->get_player_info($player_id, array('level', 'vip')); $log_param = array('cmd_id' => 557, 'level' => $player_info['level'], 'vip' => $player_info['vip']); $log = array(); $this->start_trans(); /* foreach($consume_props as $prop_id=>$prop_nums){#批量扣除多个道具如果可能 $result = $obj_prop_game->deduct_prop_by_prop_id($player_id, $prop_id, $prop_nums, $log, 1, $log_param); if(!$result){ $this->throw_error('10101'); } } */ $result = $obj_prop_game->deduct_prop_by_prop_id($player_id, $need_prop_id, $consume_props_nums, $log, 1, $log_param); if ($result) { $hero_data['grow_rate'] = $new_hero_grow_val; $result = $obj_player_hero_data->update_player_hero($player_id, $hero_id, array('grow_rate' => $new_hero_grow_val), $hero_data); } if ($result) { $this->commit(); // $obj_hero_grow->set_player_hero_grow_data($hero_id, $hero_grow_id); // $n_hero_grow_conf = Cache_HeroGrow::getInstance()->get_config_info($hero_grow_id); return array('res' => $crit_counter, 'rand_val' => $sum_rand_grow_val, 'cur_grow_val' => $new_hero_grow_val, 'effect' => 1000 * self::calc_grow_attar($new_hero_grow_val, $hero_conf['grow']), 'prop_id' => $need_prop_id, 'prop_nums' => $need_prop_nums, 'nor_desc' => $hero_grow_conf['nor_desc'], 'crit_desc' => $hero_grow_conf['crit_desc']); } else { $this->throw_error('10101'); } }
/** * @Purpose: * 提升英雄成长值 * @Param $player_id * @Param $hero_id * @Param $state 0普通提升 1批量提升 * @Param $auto 为1时表示道具不足时从上次自动购买道具 */ public function player_hero_grow_upgrade($player_id, $hero_id, $state, $auto = 0) { $player_id = intval($player_id); $hero_id = strval($hero_id); $obj_player_hero_data = $this->get_data('PlayerHero'); $hero_data = $obj_player_hero_data->get_player_hero_info($player_id, $hero_id); if (empty($hero_data)) { $this->throw_error('10102'); #英雄不存在 } $hero_conf = Cache_HeroAttr::getInstance()->get_hero_attr_info($hero_data['hero_code']); if (empty($hero_conf)) { $this->throw_error('50120'); #英雄配置错误 } if ($hero_data['grow_rate'] >= $hero_conf['grow_limit']) { $this->throw_error('50121'); #成长值已达上限 } $obj_hero_grow = $this->get_data('PlayerHeroGrow'); $hero_grow_id = $obj_hero_grow->get_player_hero_grow_data($hero_id); $hero_grow_conf = array(); $findFlag = false; if (!$hero_grow_id) { $findFlag = true; } else { $hero_grow_conf = Cache_HeroGrow::getInstance()->get_config_info($hero_grow_id); if (empty($hero_grow_conf)) { $findFlag = true; } else { if ($hero_data['grow_rate'] < $hero_grow_conf['grow_left'] || $hero_data['grow_rate'] >= $hero_grow_conf['grow_right']) { #区间错误 $findFlag = true; } } } if ($findFlag) { #启动自动纠错 $hero_grow_id = $this->find_hero_grow_id($hero_data['grow_rate'], $hero_grow_conf); if (!$hero_grow_id) { $this->throw_error('10111'); #配置错误 } } if (empty($hero_grow_conf)) { $this->throw_error('10111'); } $obj_prop_game = $this->get_game('Prop'); $obj_shop_game = $this->get_game('Shop'); $consume_props = $last_props = $arr_consume = $arr_shop_log = array(); $last_props[$hero_grow_conf['item_id']] = intval($obj_prop_game->get_prop_num_by_prop_id($player_id, $hero_grow_conf['item_id'])); if (empty($auto) && $last_props[$hero_grow_conf['item_id']] < $hero_grow_conf['item_nums']) { $this->throw_error('50107'); } $player_info = $this->get_data('Player')->get_player_info($player_id, Com_Util::get_player_fields(array('currency', 'level', 'vip', 'privilege_level'))); $crit_counter = 0; #暴击计数 $counter = 10; #while执行计数 $sum_rand_grow_val = 0; #总提升数量 $new_hero_grow_val = 0; #新的成长值 $upgrade_times = $counter; $error_code = 0; $update_gold = false; #是否更新彩钻或钻石资源 do { $need_buy_prop_nums = 0; #每次执行所需要的材料需在商城购买的数量 if ($last_props[$hero_grow_conf['item_id']] < $hero_grow_conf['item_nums']) { $last_props[$hero_grow_conf['item_id']] = 0; $need_buy_prop_nums = $hero_grow_conf['item_nums'] - $last_props[$hero_grow_conf['item_id']]; if ($last_props[$hero_grow_conf['item_id']] > 0) { $consume_props[$hero_grow_conf['item_id']] += $last_props[$hero_grow_conf['item_id']]; } } else { $last_props[$hero_grow_conf['item_id']] -= $hero_grow_conf['item_nums']; #剩余数量 $consume_props[$hero_grow_conf['item_id']] += $hero_grow_conf['item_nums']; #消耗数量 } if ($need_buy_prop_nums > 0) { #材料不足需要在商城购买 $update_gold = true; $buy_prop_info = $obj_shop_game->shortcut_purchase_interface($hero_grow_conf['item_id'], 1); if (empty($buy_prop_info['item_price'])) { $this->throw_error('130001'); #商城没有出售该道具 } list($cost_currency_type, $cost_currency_value) = each($buy_prop_info['item_price']); $cost_currency_value *= $need_buy_prop_nums; $cost_currency_key = Cache_Currency::getInstance()->get_key($cost_currency_type); $arr_tmp_consume = Com_Util::get_consume_info_for_data_center($player_info, $cost_currency_key, $cost_currency_value, $need_buy_prop_nums); if (!empty($arr_tmp_consume)) { $arr_consume['price'] += $arr_tmp_consume['price']; $arr_consume['gold'] += $arr_tmp_consume['gold']; $arr_consume['ticket'] += $arr_tmp_consume['ticket']; $arr_consume['count'] += $arr_tmp_consume['count']; } #虚拟商城记录日志 if (!isset($arr_shop_log[$hero_grow_conf['item_id']])) { $arr_shop_log[$hero_grow_conf['item_id']]['cost_resource_id'] = $cost_currency_type; } $arr_shop_log[$hero_grow_conf['item_id']]['item_num'] += $need_buy_prop_nums; $arr_shop_log[$hero_grow_conf['item_id']]['cost_resource_num'] += $cost_currency_value; $error_code = $this->get_data('Player')->check_player_resource($player_id, $player_info, '-', $cost_currency_key, $cost_currency_value, 0, $cost_currency_type); if ($error_code !== true) { if ($counter == 10) { #首次执行如果资源不足则退出 $this->throw_error($error_code); } break; } } $counter--; $rand_val = 0; $is_crit = Com_Random::probability($hero_grow_conf['crit_rate']); if ($is_crit) { $crit_counter++; $rand_val = $this->parse_data($hero_grow_conf['val_crit']); } else { $rand_val = $this->parse_data($hero_grow_conf['val_nor']); } if (!$rand_val) { $this->throw_error('50122'); #英雄成长配置表解析错误 } #单次随机值 $real_rand_val = Com_Random::get_probability_key($rand_val); #批量随机值之和 $sum_rand_grow_val += $real_rand_val; #英雄的新成长值 $new_hero_grow_val = $hero_data['grow_rate'] + $sum_rand_grow_val; if ($new_hero_grow_val >= $hero_conf['grow_limit']) { #超过英雄成长值上限 $new_hero_grow_val = $hero_conf['grow_limit']; $sum_rand_grow_val = $hero_conf['grow_limit'] - $hero_data['grow_rate']; break; } #移动至下一个成长值区间 if ($new_hero_grow_val > $hero_grow_conf['grow_right']) { $hero_grow_id++; $hero_grow_conf = Cache_HeroGrow::getInstance()->get_config_info($hero_grow_id); if (empty($hero_grow_conf)) { break; } if (!isset($last_props[$hero_grow_conf['item_id']])) { $last_props[$hero_grow_conf['item_id']] = intval($obj_prop_game->get_prop_num_by_prop_id($player_id, $hero_grow_conf['item_id'])); } } if (empty($auto) && $last_props[$hero_grow_conf['item_id']] < $hero_grow_conf['item_nums']) { #道具不足 break; } } while ($counter > 0 && $state > 0); #控制循环数量防止进入死循环 $this->start_trans(); $result = true; if ($update_gold) { $result = $this->get_data('Player')->update_player_resource($player_id, $player_info, 557, array(), $arr_consume); $this->write_check($result, 3010476); } if (!empty($consume_props)) { $log_param = array('cmd_id' => 557, 'level' => $player_info['level'], 'vip' => $player_info['vip']); $logs = array(); foreach ($consume_props as $prop_id => $prop_nums) { #批量扣除多个道具如果可能 $result = $obj_prop_game->deduct_prop_by_prop_id($player_id, $prop_id, $prop_nums, $logs, 1, $log_param); if (!$result) { $this->throw_error('10101'); } } } if ($result) { $hero_data['grow_rate'] = $new_hero_grow_val; $hero_data['fight'] = $this->calc_fight($player_id, $hero_data, $hero_data['fit'], $hero_data['rune_hole_list'], $hero_data['star_add_attr_per'], $hero_data['skill_list']); $update_field['grow_rate'] = $hero_data['grow_rate']; $update_field['fight'] = $hero_data['fight']; $result = $this->update_db($player_id, $update_field, $hero_data, 557); $this->get_data('RankList')->update_hero_rank($hero_id, $hero_data['fight']); } if ($result) { $this->commit(); $obj_hero_grow->set_player_hero_grow_data($hero_id, $hero_grow_id); $n_hero_grow_conf = Cache_HeroGrow::getInstance()->get_config_info($hero_grow_id); #引导任务 $this->get_game('TaskTrigger')->async_trigger_guide_task($player_id, 26, $upgrade_times - $counter); $this->get_game('PlayerAchieve')->async_trigger_achieve_target($player_id, 37, $hero_data['grow_rate'] + $hero_data['fit_grow'], 8); if (!empty($arr_shop_log)) { foreach ($arr_shop_log as $item_id => $item_info) { $obj_shop_game->add_dummy_shop_log($player_id, $player_info, $item_id, $item_info['item_num'], $item_info['cost_resource_id'], $item_info['cost_resource_num'], 557); } } return array('res' => $crit_counter, 'rand_val' => $sum_rand_grow_val, 'cur_grow_val' => $new_hero_grow_val, 'effect' => 10000 * round($this->calc_grow_attar($new_hero_grow_val, $hero_conf['grow']), 4), 'prop_id' => $n_hero_grow_conf['item_id'], 'prop_nums' => $n_hero_grow_conf['item_nums'], 'nor_desc' => $n_hero_grow_conf['nor_desc'], 'crit_desc' => $n_hero_grow_conf['crit_desc']); } else { $this->throw_error('10101'); } }
/** * 小红点提示 * @param $player_id * @param $type * @param $condition */ public function red_icon($player_id, $player_info = null, $player_detail = null) { if (is_null($player_info)) { $player_info = $this->get_data('Player')->get_player_info($player_id, array('silver', 'crystal', 'level', 'fame_level', 'career_type', 'gold', 'online_time')); } if (is_null($player_detail)) { $player_detail = $this->get_data('PlayerDetail')->get_player_detail($player_id, array('func_open', 'equip_wing', 'wing_info', 'skill_info', 'skill_rune_info', 'skill_rune_cote_info', 'dower_info', 'train_info')); } $prop_list = $this->get_data('PlayerProp')->get_player_prop_by_item_position($player_id); //重包裹里去除道具 $arr_prop_num = array(); $arr_prop_type = array(); $func_open = $player_detail['func_open']; if ($prop_list) { foreach ($prop_list as $prop) { $arr_prop_num[$prop['prop_id']] += $prop['item_num']; $arr_prop_type[$prop['type']][$prop['sub_type']][] = $prop; } } ##################[翅膀进阶检查]#################### $wing_id = $player_detail['equip_wing']; $out = array(); if (!empty($wing_id)) { if (isset($func_open[111])) { $wing_table = Cache_PlayerWing::getInstance()->get_player_wing_info(array('id' => $wing_id, 'level' => $player_detail[$wing_id]['lvl'] + 1)); if ($wing_table) { $tip = false; if ($wing_table[0]['condition']) { list($type, $condition) = explode("|", $wing_table[0]['condition']); if ($type == 5) { if ($player_info['fame_level'] >= $condition) { $tip = true; } } } if ($tip) { $material_prop = Com_FmtData::format_table_prop($wing_table[0]['condition']); if (Com_Array::is_good_arr($material_prop)) { foreach ($material_prop as $id => $num) { if ($arr_prop_num[$id] >= intval($num)) { $tip = true; } } } } if ($tip) { $out[] = array('func_id' => 1, 'status' => intval($tip), 'param' => ''); } } } } ##################[翅膀进阶检查]#################### ###################[翅膀激活]####################### if (isset($func_open[110]) && $player_detail['wing_info']) { $tip = false; $data = $player_detail['wing_info']; foreach ($data as $key => $val) { if ($val['activation'] == 0) { #在线时间检测 if ($val['condition'][0] == 3) { $data[$key]['condition'][2] = $this->get_game('DailyBoon')->daily_online_time($player_id); if ($data[$key]['condition'][2] >= $data[$key]['condition'][1][0]) { $tip = true; } else { if ($player_info['online_time'] >= $data[$key]['condition'][1][0]) { $tip = true; } } } else { if ($val['condition'][0] == 7) { $data[$key]['condition'][2] = $player_info['level']; if ($data[$key]['condition'][2] >= $data[$key]['condition'][1][0]) { $tip = true; } } else { if ($val['condition'][0] == 6) { #获取翅膀配置表 $wing_table_task = $this->get_game('PlayerWing')->get_cache_table_data('player_wing_table', array('id' => $val['id'], 'level' => $val['lvl'])); if ($wing_table_task) { list($type, $task_id) = explode("|", $wing_table_task[0]['condition']); $task_res = $this->get_game('TaskMain')->task_is_finish($player_id, $task_id); if ($task_res) { $tip = true; } } } } } if ($val['condition'][0] == 4) { #获取翅膀配置表 $wing_table = $this->get_game('PlayerWing')->get_cache_table_data('player_wing_table', array('id' => $val['id'], 'level' => 1)); if (Com_Array::is_good_arr($wing_table)) { foreach ($wing_table as $wing) { list($type, $value) = explode("|", $wing['condition']); if ($type == 4) { if ($data[$val['id']]['activation'] != 0) { continue; } $is_activate = true; $wing_list = explode(":", $value); if (is_array($wing_list)) { #检测是否有被激活的翅膀 foreach ($wing_list as $wid) { if ($data[$wid]['activation'] != 2) { $is_activate = false; break; } } } else { if ($data[$wing_list]['activation'] != 2) { $is_activate = false; } } #改变隐藏翅膀激活状态 if ($is_activate) { $tip = true; } } } } } if ($val['condition'][0] == 2 || $val['condition'][0] == 1) { if ($data[$id]['condition'][2] >= $wing['condition'][1][0]) { $tip = true; } } } if ($tip == true) { break; } } if ($tip) { $out[] = array('func_id' => 15, 'status' => intval($tip), 'param' => ''); } } ###################[翅膀激活]####################### ###################[翅膀羽炼]####################### // if (isset($func_open[112])) { $start = strtotime(SERVER_FIRST_START_TIME); list($login_series_max, $login_acc) = $this->get_game('EventCondFunc')->_cal_login_refer($player_id, $start, $this->current_time); $deal_log_hash = $this->get_data('Wing')->get_deal_log_by_player_id($player_id); $tip = false; for ($i = 7; $i <= 8; $i++) { $item_list = Cache_PlayerWing::getInstance()->get_wing_equip_gift_info_list($i); if ($item_list) { foreach ($item_list as $item_info) { $gain_status = 0; # 领取状态:0可领,1条件未达成不可领,2已领取不可领[NOTE:可领只有一种情况,不可领有多种情况,所以这样表示] # 判断达成条件 if ($login_acc < $item_info['login_acc'] && empty($deal_log_hash[$item_info['item_id']])) { $tip = true; break 2; } } } } if ($tip) { $out[] = array('func_id' => 17, 'status' => intval($tip), 'param' => ''); } // } ###################[翅膀羽炼]####################### ##################[翅膀装备检查]################### $wing_info = $player_detail['wing_info'][$wing_id]; if (isset($func_open[110]) && $wing_info) { $tip = false; if ($wing_id == 7 && $wing_id == 8) { if (!empty($wing_info['equipment']) && Com_Array::is_good_arr($wing_info['equipment'])) { for ($i = 1; $i <= 7; $i++) { if (!isset($wing_info['equipment'][$i])) { if (isset($arr_prop_type[6][$i]) && count($arr_prop_type[6][$i] > 0)) { foreach ($arr_prop_type[6][$i] as $arr_prop_detail) { if ($wing_info['lvl'] < $arr_prop_detail['level']) { $tip = true; break 2; } } } } } } } if ($tip) { $out[] = array('func_id' => 2, 'status' => intval($tip), 'param' => ''); } } ##################[翅膀装备检查]################### ##################[英雄]############################## if (isset($func_open[20])) { $tip = false; $hero_list = $this->get_data('PlayerHero')->get_fight_hero($player_id); if (!empty($hero_list)) { foreach ($hero_list as $hero_id => $hero_code) { $obj_player_hero_data = $this->get_data('PlayerHero'); $hero_data = $obj_player_hero_data->get_player_hero_info($player_id, $hero_id); if ($hero_data) { ###################[成长值]######################################### if (isset($func_open[29])) { $hero_conf = Cache_HeroAttr::getInstance()->get_hero_attr_info($hero_data['hero_code']); if ($hero_data['grow_rate'] <= $hero_conf['grow_limit']) { $obj_hero_grow = $this->get_data('PlayerHeroGrow'); $hero_grow_id = $obj_hero_grow->get_player_hero_grow_data($hero_id); $hero_grow_conf = array(); $findFlag = false; if (!$hero_grow_id) { $findFlag = true; } else { $hero_grow_conf = Cache_HeroGrow::getInstance()->get_config_info($hero_grow_id); if (empty($hero_grow_conf)) { $findFlag = true; } else { if ($hero_data['grow_rate'] < $hero_grow_conf['grow_left'] || $hero_data['grow_rate'] >= $hero_grow_conf['grow_right']) { #区间错误 $findFlag = true; } } } if ($findFlag) { #启动自动纠错 $hero_grow_id = $this->get_game('Hero')->find_hero_grow_id($hero_data['grow_rate'], $hero_grow_conf); } if ($hero_grow_id) { $last_props[$hero_grow_conf['item_id']] = intval($arr_prop_num[$hero_grow_conf['item_id']]); if ($last_props[$hero_grow_conf['item_id']] >= $hero_grow_conf['item_nums']) { $tip = true; } } if ($tip) { $out[] = array('func_id' => 3, 'status' => intval($tip), 'param' => $hero_id); } } } ###################[成长值]######################################### ##################[英雄等级]############################### if (isset($func_open[22])) { $tip = false; $is_culture = $this->get_game('Hero')->is_culture_hero($player_id, $hero_id, $hero_data['hero_code']); if ($is_culture) { if ($hero_data['level'] < $player_info['level']) { //英雄是否满级 $full_level_res = $this->get_game('Hero')->is_full_level($hero_data['hero_code'], $hero_data['level']); if (!$full_level_res) { //是否有同类型已培养的英雄 $upgrade_prop_list = $this->get_game('Hero')->upgrade_prop_list; foreach ($upgrade_prop_list as $prop_id) { if (isset($arr_prop_num[$prop_id])) { $tip = true; break; } } } } } if ($tip) { $out[] = array('func_id' => 4, 'status' => intval($tip), 'param' => $hero_id); } } ##################[英雄等级]############################### ##################[英雄潜能]############################### if (isset($func_open[23])) { $tip = false; //是否有同类型已培养的英雄 if ($is_culture) { for ($i = 1; $i <= 3; $i++) { $hero_potential_base_table = $this->get_game('Hero')->get_hero_potential_base_table($i, $hero_data['potential_level']); if ($player_info['silver'] >= $hero_potential_base_table['coin_num']) { if (!empty($hero_potential_base_table) && $hero_potential_base_table['prop_id'] && $hero_potential_base_table['prop_num']) { //获取玩家背包中的升级道具数量 $player_prop_num = $arr_prop_num[$hero_potential_base_table['prop_id']]; if ($player_prop_num >= $hero_potential_base_table['prop_num']) { $attr_max = $this->get_game('Hero')->get_potential_attr_max($hero_data['potential_level'], $i); if ($hero_data['potential_' . $i] < $attr_max) { $tip = true; break; } } } } } } if ($tip) { $out[] = array('func_id' => 5, 'status' => intval($tip), 'param' => $hero_id); } } ##################[英雄潜能]############################### ##################[英雄合体]############################### if (isset($func_open[24])) { $tip = false; if ($is_culture) { $full_stairs_res = $this->get_game('Hero')->is_full_stairs($hero_data['hero_code'], $hero_data['fit']); if (!$full_stairs_res) { $hero_attr_base = $this->get_game('Hero')->get_hero_attr_table($hero_data['hero_code']); $fit_table = $this->get_game('Hero')->get_hero_fit_table($hero_attr_base['fit_expend_type'], $hero_data['fit'] + 1); $player_prop_num = $arr_prop_num[$fit_table['prop_id']]; if ($player_prop_num >= $fit_table['prop_num']) { $hero_info = $this->get_game('Hero')->get_fit_hero_num($player_id, $hero_id, $hero_data['fit_type'], $hero_data['hero_code'], $hero_data['quality'], $hero_data['quality']); //英雄是否足够 $is_full_hero_res = $this->get_game('Hero')->is_full_hero($hero_attr_base['fit_expend_type'], $hero_data['fit'] + 1, $hero_info['num']); if ($is_full_hero_res) { $tip = true; } } } } if ($tip) { $out[] = array('func_id' => 6, 'status' => intval($tip), 'param' => $hero_id); } } ##################[英雄合体]############################### ##################[英雄星级]############################### if (isset($func_open[25])) { $tip = false; if ($is_culture) { $full_level_res = $this->get_game('Hero')->is_full_star($hero_data['hero_code'], $hero_data['star']); if (!$full_level_res) { $star_table = $this->get_game('Hero')->get_hero_star_table($hero_data['star'] + 1); if ($star_table && $star_table['prop_id1']) { $prop_id = $star_table['prop_id1']; $deduct_coin_num = $star_table['prop_id2']; $player_prop_num = $arr_prop_num[$prop_id]; if ($player_prop_num >= $star_table['prop_num1']) { if ($player_info['silver'] >= $deduct_coin_num) { $tip = true; } } } } } if ($tip) { $out[] = array('func_id' => 7, 'status' => intval($tip), 'param' => $hero_id); } } ##################[英雄星级]############################### } } } } ##################[英雄]################################################## ##################[女神]################################################# if (isset($func_open[30])) { $obj_player_fairy_data = $this->get_data('Fairy'); $fairy_list = $obj_player_fairy_data->get_player_fairy_list($player_id); $fairy_id = ''; if ($fairy_list) { foreach ($fairy_list as $val) { $fairy_id = $val['fairy_id']; if (!empty($fairy_id)) { $fairy_info = $this->get_data('Fairy')->get_player_fairy_info($fairy_id); if ($fairy_info) { ##################[女神强化]############################################ if ($fairy_info['type'] == 1) { $func_id = 35; } else { $func_id = 36; } if (isset($func_open[$func_id])) { $tip = false; $max_train_lv = Cache_FairyTrain::getInstance()->get_max_train_lv(); if (!empty($max_train_lv)) { $max_train_lv = 100; } if ($fairy_info['train_level'] < $max_train_lv) { $trainConfigs = $this->get_game('Fairy')->get_cache_table_data('fairy_train_table', array("lvl" => $fairy_info['train_level'])); if ($trainConfigs[0] || !empty($trainConfigs[0]['expend'])) { $train_config = $trainConfigs[0]; // 消耗需求 $cost_material = explode("|", $train_config['expend']); //升级下一级消耗 $costItemInfo = explode(':', $cost_material[0]); //道具消耗 $costGoldInfo = !empty($cost_material[1]) ? explode(':', $cost_material[1]) : 0; //金币消耗 if ($fairy_info['level'] >= $train_config['fairy_lvl']) { $cost_item_id = $costItemInfo[0]; $cost_item_num = intval($costItemInfo[1]); $player_prop_num = $arr_prop_num[$cost_item_id]; $cost_silver_num = is_array($costGoldInfo) ? intval($costGoldInfo[1]) : 0; if ($player_info['silver'] >= $cost_silver_num) { if ($player_prop_num >= $cost_item_num) { $tip = true; } } } } } if ($tip) { $out[] = array('func_id' => 8, 'status' => intval($tip), 'param' => $fairy_id); } } ##################[女神强化]############################################ ##################[女神培养]############################################ if (isset($func_open[31])) { $tip = false; $fairy_level_table = $this->get_game('Fairy')->get_fairy_lvl_tabel_data($fairy_info['fairy_code'], $fairy_info['star']); if ($fairy_level_table) { if ($player_info['fame_level'] >= $fairy_level_table['fame']) { $item_data = array(); $get_item_res = $this->get_game('Fairy')->get_item_data($fairy_info['fairy_code'], $fairy_info['star'], $item_data); if ($get_item_res == true) { $prop_id = $item_data['item']; $prop_num = $item_data['count']; $coin = $item_data['coin']; if ($item_data['fame'] > 0) { $coin = 0; } if ($prop_id && $prop_num) { if ($arr_prop_num[$prop_id] >= $prop_num) { if ($player_info['silver'] >= $coin) { $tip = true; } } } } } } if ($tip) { $out[] = array('func_id' => 9, 'status' => intval($tip), 'param' => $fairy_id); } } ##################[女神培养]############################################ ##################[女神符文位置]############################################ if (isset($func_open[31])) { $tip = false; if (Com_Array::is_good_arr($fairy_info['combination_list'])) { foreach ($fairy_info['combination_list'] as $value) { if ($value['state'] == 1) { $tip = true; } } } if ($tip) { $out[] = array('func_id' => 16, 'status' => intval($tip), 'param' => $fairy_id); } } ##################[女神符文位置]############################################ } } } } } ##################[女神]################################################# ########################[技能]########################################## $skill_list_all = Cache_Skill::getInstance()->get_skill_list($player_info['career_type']); $skill_list_distinct = Cache_Skill::getInstance()->get_distinct_skill_list($player_info['career_type'], 1); $skill_hash_all = $this->get_game('PlayerSkill')->convert_skill_list_to_hash($skill_list_all); $tip = false; foreach ($skill_list_distinct as $val) { if ($val['display'] == 0) { continue; } $skill_id = $val['sid']; $data['skill_status'] = 0; if (isset($player_detail['skill_info'][$skill_id]['level'])) { //已激活 $data['skill_status'] = 1; $data['skill_level'] = $player_detail['skill_info'][$skill_id]['level']; } if ($data['skill_status'] > 0) { if ($data['skill_level'] < $skill_hash_all[$skill_id][$data['skill_level']]['max_level'] && $player_info['level'] >= $skill_hash_all[$skill_id][$data['skill_level'] + 1]['unlock'] && $player_info['silver'] >= $skill_hash_all[$skill_id][$data['skill_level'] + 1]['levelup_cost_silver'] && $player_info['crystal'] >= $skill_hash_all[$skill_id][$data['skill_level'] + 1]['levelup_cost_skill_point']) { $tip = true; break; } } } if ($tip) { $out[] = array('func_id' => 10, 'status' => intval($tip), 'param' => ''); } ########################[技能]########################################## ########################[天赋]########################################## $tip = false; $active_dower_list = $this->get_data('PlayerDower')->get_player_dower($player_id); $dower_list_all = Cache_Dower::getInstance()->get_dower_list($player_info['career_type']); $dower_list_distinct = Cache_Dower::getInstance()->get_distinct_dower_list($player_info['career_type'], 0); // $dower_hash_all = $this->get_game('PlayerSkill')->convert_dower_list_to_hash($dower_list_all); if (!empty($dower_list_distinct)) { foreach ($dower_list_distinct as $val) { $dower_id = $val['sid']; if (isset($active_dower_list[$dower_id])) { $active_dower_list[$dower_id]['dower_lv'] += 1; } else { $active_dower_list[$dower_id] = array('dower_id' => $dower_id, 'dower_lv' => 1, 'player_id' => $player_id); } # 获取天赋配置信息 $dower_info = Cache_Dower::getInstance()->get_dower_info($dower_id, $active_dower_list[$dower_id]['dower_lv'], 0); if ($player_info['level'] > $dower_info['unlock']) { if ($player_info['crystal'] >= $dower_info['cost_crystal']) { if (!empty($dower_info['item_id']) && !empty($dower_info['item_num'])) { $player_prop_num = $arr_prop_num[$dower_info['item_id']]; if ($player_prop_num >= $dower_info['item_num']) { $tip = true; break; } } } } } if ($tip) { $out[] = array('func_id' => 11, 'status' => intval($tip), 'param' => ''); } } ########################[圣器]########################################## $trains = $player_detail['train_info']; if ($trains) { foreach ($trains as $train_type => $train) { $train_rank = $train['train_rank']; foreach ($train['train_detail'] as $train_attr_seq => $train_detail) { $train_step = $train_detail[$train_attr_seq]['train_step'] + 1; $train_detail = Cache_Train::getInstance()->get_train_detail($train_type, $train_rank, $train_attr_seq, $train_step); if ($train_detail) { if (!empty($train_detail['require_player_level']) && $player_info['level'] >= $train_detail['require_player_level']) { $cost_currency_value = Formula_Train::get_strengthen_train_cost(); $cost_currency_key = Cache_Currency::getInstance()->get_key($this->get_game('Train')->get_strengthen_train_cost_cur_type()); if ($player_info[$cost_currency_key] >= $cost_currency_value) { if ($player_info['silver'] >= $train_detail['consume_silver']) { if (!empty($train_detail['consume_item_id'])) { if ($arr_prop_num[$train_detail['consume_item_id']] >= $train_detail['consume_item_num']) { if ($train_type == 1) { $out[] = array('func_id' => 12, 'status' => intval($tip), 'param' => ''); } if ($train_type == 2) { $out[] = array('func_id' => 13, 'status' => intval($tip), 'param' => ''); } if ($train_type == 3) { $out[] = array('func_id' => 14, 'status' => intval($tip), 'param' => ''); } } } } } } } } } } ########################[圣器]######################################### return $out; }