/** * 获取玩家基础属性 * * @param unknown_type $player_id * @return unknown */ protected function get_player_base_attr($player_id, $calc_buff_attr) { if (is_null($this->_playerItem)) { $this->_playerItem = $this->get_data('Player')->get_player_info($player_id); } $this->_player = $this->_playerItem; if (empty($this->_player)) { //玩家不存在 $this->_player = '20001'; return false; } if (empty($this->_playerDetailItem)) { $this->_playerDetailItem = $this->get_data('PlayerDetail')->get_player_detail($this->_player['player_id']); } //基础属性 // $baseAttrData = $this->_playerDetailItem['base_attr']; // if(isset($baseAttrData['base_attr'])) $baseAttrData=$baseAttrData['base_attr']; //先这样写有的数据错了等可以清空数据库了 删除 // if (is_array($baseAttrData)) { // foreach ($baseAttrData as $key=>$value) { // $this->_player[$key] += $value; // } // } $baseAttrData = $this->getInitPlayerAttrData($this->_player['career_type']); if (is_array($baseAttrData)) { foreach ($baseAttrData as $key => $value) { $this->_player[$key] += $value; // if($key == 'atk_min'){ // Com_Log::write('player_attr_atk_'.$this->_player['player_id'],"base {$value}"); // } } } $this->_player['atk_min'] = $this->_player['atk_max'] = Formula_Player::get_upgrade_atk($this->_player['atk_min'], $this->_player['level']); // Com_Log::write('player_attr_atk_'.$this->_player['player_id'],"atk_min {$this->_player['atk_min']}"); $this->_player['arm'] = $this->_player['arm'] = Formula_Player::get_upgrade_arm($this->_player['arm'], $this->_player['level']); $this->_player['hp'] = $this->_player['hp'] = Formula_Player::get_upgrade_hp($this->_player['hp'], $this->_player['level']); if ($this->_player['map_id'] == 2100) { $this->_player['atk_min'] += 500; #策划要求序章攻击加500 } $equip_move_speed = 0; if (!empty($this->_playerDetailItem['equip_attr'])) { foreach ($this->_playerDetailItem['equip_attr'] as $key => $value) { if ($key == 'move_speed') { $equip_move_speed = $value; } else { $this->_player[$key] += $value; } } } if (!empty($this->_playerDetailItem['fairy_attr_1'])) { foreach ($this->_playerDetailItem['fairy_attr_1'] as $key => $value) { $this->_player[$key] += $value; } } if (!empty($this->_playerDetailItem['fairy_attr_2'])) { foreach ($this->_playerDetailItem['fairy_attr_2'] as $key => $value) { $this->_player[$key] += $value; } } if (!empty($this->_playerDetailItem['fashion_attr'])) { foreach ($this->_playerDetailItem['fashion_attr'] as $key => $value) { $this->_player[$key] += $value; } } if (!empty($this->_playerDetailItem['union_achieve_attr'])) { foreach ($this->_playerDetailItem['union_achieve_attr'] as $key => $value) { $this->_player[$key] += $value; } } if (!empty($this->_playerDetailItem['achieve_attr_1'])) { foreach ($this->_playerDetailItem['achieve_attr_1'] as $key => $value) { $this->_player[$key] += $value; } } if (!empty($this->_playerDetailItem['achieve_attr_2'])) { foreach ($this->_playerDetailItem['achieve_attr_2'] as $key => $value) { $this->_player[$key] += $value; } } # 培养属性加成 if (!empty($this->_playerDetailItem['train_attr_info']) && is_array($this->_playerDetailItem['train_attr_info'])) { foreach ($this->_playerDetailItem['train_attr_info'] as $key => $value) { $this->_player[$key] += $value; } } # -------------------------------------------------------------------- # 培养套装激活效果计算 # -------------------------------------------------------------------- $train_set_attr_addition = $this->get_game('Train')->get_player_train_set_attr_addition($this->_player['player_id'], $this->_playerItem, $this->_playerDetailItem); # 培养套装加成信息 if (!empty($train_set_attr_addition)) { foreach ($train_set_attr_addition as $attr_key => $attr_val) { if (!is_numeric($attr_key)) { # 忽略技能等级的加成 $this->_player[$attr_key] += $attr_val; } } } # -------------------------------------------------------------------- #--------------------------------------------------------------------- #翅膀属性 #--------------------------------------------------------------------- if (!empty($this->_playerDetailItem['equip_wing'])) { $wing_attr = $this->_playerDetailItem['wing_info'][$this->_playerDetailItem['equip_wing']]; $addition = 0; $attr_addition = array(); if ($this->_playerDetailItem['equip_wing'] == 7) { if (isset($this->_playerDetailItem['wing_info'][8]) && $this->_playerDetailItem['wing_info'][8]['activation'] == 2) { $add_config = Cache_WingAddition::getInstance()->get_wing_addition($this->_playerDetailItem['wing_info'][8]['lvl']); $addition = $add_config['addition'] / 10000; $attr_addition = $this->_playerDetailItem['wing_info'][8]['attr']; if (!empty($this->_playerDetailItem['wing_info'][8]['equip_attr']) && Com_Array::is_good_arr($this->_playerDetailItem['wing_info'][8]['equip_attr'])) { foreach ($this->_playerDetailItem['wing_info'][8]['equip_attr'] as $attr_type => $attr_val) { $attr_addition[$attr_type] += ceil($attr_val); } } foreach ($attr_addition as $attr_type => $attr_val) { $attr_addition[$attr_type] = $attr_val * $addition; } } } if ($this->_playerDetailItem['equip_wing'] == 8) { if (isset($this->_playerDetailItem['wing_info'][7]) && $this->_playerDetailItem['wing_info'][7]['activation'] == 2) { $add_config = Cache_WingAddition::getInstance()->get_wing_addition($this->_playerDetailItem['wing_info'][7]['lvl']); $addition = $add_config['addition'] / 10000; $attr_addition = $this->_playerDetailItem['wing_info'][7]['attr']; if (!empty($this->_playerDetailItem['wing_info'][7]['equip_attr']) && Com_Array::is_good_arr($this->_playerDetailItem['wing_info'][7]['equip_attr'])) { foreach ($this->_playerDetailItem['wing_info'][7]['equip_attr'] as $attr_type => $attr_val) { $attr_addition[$attr_type] += ceil($attr_val); } } foreach ($attr_addition as $attr_type => $attr_val) { $attr_addition[$attr_type] = $attr_val * $addition; } } } $w_attr = array(); if (!empty($wing_attr['attr'])) { foreach ($wing_attr['attr'] as $key => $value) { $w_attr[$key] += $value; } } if (!empty($wing_attr['equip_attr'])) { foreach ($wing_attr['equip_attr'] as $key => $value) { $w_attr[$key] += $value; } } if (!empty($attr_addition)) { foreach ($attr_addition as $key => $value) { $w_attr[$key] += $value; } } if (!empty($w_attr)) { foreach ($w_attr as $key => $value) { $this->_player[$key] += $value; } } } #--------------------------------------------------------------------- #文斌的属性 #--------------------------------------------------------------------- if (!empty($this->_playerDetailItem['player_grade_attr'])) { foreach ($this->_playerDetailItem['player_grade_attr'] as $key => $value) { $this->_player[$key] += $value; } } #--------------------------------------------------------------------- #帮会的属性 #--------------------------------------------------------------------- if (!empty($this->_playerDetailItem['union_player_attr'])) { foreach ($this->_playerDetailItem['union_player_attr'] as $key => $value) { $this->_player[$key] += $value; } } #--------------------------------------------------------------------- #声望的属性 #--------------------------------------------------------------------- if (!empty($this->_playerDetailItem['fame_attr'])) { foreach ($this->_playerDetailItem['fame_attr'] as $key => $value) { $this->_player[$key] += $value; } } if (!empty($this->_playerDetailItem['vip_special_attr'])) { foreach ($this->_playerDetailItem['vip_special_attr'] as $key => $value) { $this->_player[$key] += $this->_player[$key] * ($value / 10000); } } if ($calc_buff_attr) { #TODO:看这个参数是不是要算buff属性 现在是排行查看的时候要计算 登陆的时候获取人物帐数据的的时候不用 if (!empty($this->_playerDetailItem['dower_info'])) { $arr_buff = array(); foreach ($this->_playerDetailItem['dower_info'] as $val) { $dower = Cache_Dower::getInstance()->get_dower_info($val['dower_id'], $val['dower_lv']); if (!empty($dower)) { $skillPassive = Cache_SkillPassive::getInstance()->get_skill_passive_info(array('sid' => $dower['skill_id'], 'level' => $val['dower_lv'])); if (!empty($skillPassive['buff_id1'])) { $arr_buff[] = $skillPassive['buff_id1']; } if (!empty($skillPassive['buff_id2'])) { $arr_buff[] = $skillPassive['buff_id2']; } } } if ($arr_buff) { $buff_data = Cache_SkillBuff::getInstance()->get_buff_data($arr_buff); if ($buff_data) { foreach ($buff_data as $val) { $attr_key = $this->get_game('BuffData')->get_attr_by_buff_type($val['param1']); if ($val['buff_type'] == 'mod_fight_attr') { $this->_playerDetailItem['buff_attr'][$attr_key] += $val['param2']; } if ($val['buff_type'] == 'mod_fight_attr_%') { $this->_playerDetailItem['buff_attr_per'][$attr_key] += $val['param2']; } } } } } #--------------------------------------------------------------------- #buff属性 #--------------------------------------------------------------------- if (!empty($this->_playerDetailItem['buff_attr'])) { foreach ($this->_playerDetailItem['buff_attr'] as $key => $value) { if ($key == 'hp' || $key == 'atk_min' || $key == 'arm') { $this->_player[$key] += intval($this->_player[$key] * ($value / 10000)); } } } #--------------------------------------------------------------------- #buff百分比属性 #--------------------------------------------------------------------- if (!empty($this->_playerDetailItem['buff_attr_per'])) { foreach ($this->_playerDetailItem['buff_attr_per'] as $key => $value) { if ($key == 'hp' || $key == 'atk_min' || $key == 'arm') { $this->_player[$key] += intval($this->_player[$key] * ($value / 100)); } } } } // #vip特权加成 vip升级的时候挪到 // // $vip_level_config = Cache_VipLevelLimit::getInstance()->get_limit_info($this->_player['privilege_level'],10066); // // if($vip_level_config){ // $this->_player['hp'] += $this->_player['hp'] * ($vip_level_config['max_times']/10000); // } // $vip_level_config = Cache_VipLevelLimit::getInstance()->get_limit_info($this->_player['privilege_level'],10067); // if($vip_level_config){ // $this->_player['atk_min'] += $this->_player['atk_min'] * ($vip_level_config['max_times']/10000); // } // $vip_level_config = Cache_VipLevelLimit::getInstance()->get_limit_info($this->_player['privilege_level'],10068); // if($vip_level_config){ // $this->_player['arm'] += $this->_player['arm'] * ($vip_level_config['max_times']/10000); // } if ($equip_move_speed > 0) { $this->_player['move_speed'] = $this->_player['move_speed'] * (1 + $equip_move_speed / 10000); } ###统一向上取整 foreach (Cache_AttrConfig::get_attr() as $key) { $this->_player[$key] = intval($this->_player[$key]); } return $this->_player; }
protected function get_skill_recommend($player_id, $level, $skill_data, $dower_data) { $out = array(); $strengthen = Cache_Strengthen::getInstance()->get_strengthen($level, 2); $strengthen_list = array(); $skill_configs = array(); $dower_configs = array(); foreach ($strengthen as $key => $val) { switch ($val['condition_type']) { case 11: //每个技能的等级 foreach ($skill_data['skill_list'] as $skill) { $skill_id = $skill['skill_id']; if (!isset($skill_configs[$skill_id])) { $skill_configs[$skill_id] = Cache_Skill::getInstance()->get_skill_info($skill_id); } // echo $val['condition_val']."|".$skill['skill_level']."|".$val['condition_operation']; if ($this->cal_condition($val['condition_val'], $skill['skill_level'], $val['condition_operation'])) { $tmp_val = $val; $tmp_val['name'] = $skill_configs[$skill_id][0]['name']; $strengthen_list[$val['sub_type']][$skill_id] = $tmp_val; } } continue 2; break; case 12: //每个技能是否有可开启的符文 foreach ($skill_data['skill_list'] as $skill) { $skill_id = $skill['skill_id']; if (count($strengthen_list[$val['sub_type']][$skill_id] >= 1)) { continue; } if (!isset($skill_configs[$skill_id])) { $skill_configs[$skill_id] = Cache_Skill::getInstance()->get_skill_info($skill_id); } $num = 0; foreach ($skill['rune_list'] as $rune) { if ($rune[3] == 1) { ++$num; } } if ($this->cal_condition($val['condition_val'], $num, $val['condition_operation'])) { $tmp_val = $val; $tmp_val['name'] = $skill_configs[$skill_id][0]['name']; $strengthen_list[$val['sub_type']][$skill_id] = $tmp_val; } } continue 2; break; case 13: //技能每个符文等级是否达上限 foreach ($skill_data['skill_list'] as $skill) { $skill_id = $skill['skill_id']; if (count($strengthen_list[$val['sub_type']][$skill_id] >= 1)) { continue; } if (!isset($skill_configs[$skill_id])) { $skill_configs[$skill_id] = Cache_Skill::getInstance()->get_skill_info($skill_id); } $num = 0; $rune_list_all = Cache_SkillRune::getInstance()->get_skill_rune_list_by_skill_id($skill_id); $rune_hash_all = $this->convert_rune_list_to_hash($rune_list_all); $rune_max_level = array(); foreach ($rune_hash_all as $rune_id => $rune_lv_info) { $rune_max_level[$rune_id] = $rune_lv_info[1]['max_level']; } foreach ($skill['rune_list'] as $rune) { if ($rune[2] <= $rune_max_level[$rune[1]]) { $tmp_val = $val; $tmp_val['name'] = $skill_configs[$skill_id][0]['name']; $strengthen_list[$val['sub_type']][$skill_id] = $tmp_val; break; } } } continue 2; break; case 14: //天赋格装备个数 $num = count($dower_data['inuse_dower_list']); // echo $val['condition_val']."|".$num."|".$val['condition_operation']; if ($this->cal_condition($val['condition_val'], $num, $val['condition_operation'])) { $strengthen_list[$val['sub_type']]['s14'] = $val; } break; case 15: //当前装备的天赋可升级 if ($dower_data['inuse_dower_list']) { foreach ($dower_data['inuse_dower_list'] as $dower) { if (count($strengthen_list[$val['sub_type']]) >= 2) { break; } $dower_id = $dower['dower_id']; if (!isset($dower_configs[$dower_id])) { $dower_configs[$dower_id] = Cache_Dower::getInstance()->get_dower_info($dower_id, 1); } if ($dower['up_lv_flag'] == 1) { $tmp_val = $val; $tmp_val['name'] = $dower_configs[$dower_id]['name']; $strengthen_list[$val['sub_type']][$dower_id] = $tmp_val; } } } break; case 16: if ($dower_data['optional_dower_list']) { foreach ($dower_data['optional_dower_list'] as $dower) { if (count($strengthen_list[$val['sub_type']]) >= 2) { break; } $dower_id = $dower['dower_id']; if (!isset($dower_configs[$dower_id])) { $dower_configs[$dower_id] = Cache_Dower::getInstance()->get_dower_info($dower_id, 1); } if ($dower['up_lv_flag'] == 1) { $tmp_val = $val; $tmp_val['name'] = $dower_configs[$dower_id]['name']; $strengthen_list[$val['sub_type']][$dower_id] = $tmp_val; } } } break; } } if (!empty($strengthen_list)) { $out['advise'] = $this->format_advise_list(2, $strengthen_list); } else { $out['advise'] = array(); } // var_dump($out['advise']); return $out; }
public function active_dower($player_id, $dower_id) { $this->get_game('PlayerFunc')->get_func_is_open($player_id, $this->func_id_dower); $this->param_check_numeric(array($player_id, $dower_id)); $player_info = $this->get_data('Player')->get_player_info($player_id, array('career_type', 'level', 'vip', 'privilege_level', 'crystal')); # 更新等级和修改时间 $active_dower_list = $this->get_data('PlayerDower')->get_player_dower($player_id); $before_level = isset($active_dower_list[$dower_id]) ? $active_dower_list[$dower_id]['dower_lv'] : 0; if (isset($active_dower_list[$dower_id])) { $active_dower_list[$dower_id]['dower_lv'] += 1; $active_dower_list[$dower_id]['mod_time'] = $this->current_time; } else { $active_dower_list[$dower_id] = array('dower_id' => $dower_id, 'dower_lv' => 1, 'player_id' => $player_id, 'mod_time' => $this->current_time); } # 获取天赋配置信息 $dower_info = Cache_Dower::getInstance()->get_dower_info($dower_id, $active_dower_list[$dower_id]['dower_lv'], 1); if ($player_info['level'] < $dower_info['unlock']) { $this->throw_error('80605'); # 玩家等级不足 } $this->start_trans(); # 消耗魔晶 if (!empty($dower_info['cost_crystal'])) { $this->get_data('Player')->check_player_resource($player_id, $player_info, '-', 'crystal', $dower_info['cost_crystal'], 1); $re = $this->get_data('Player')->update_player_resource($player_id, $player_info, '613'); $this->write_check($re, 3010895); } # 消耗材料 if (!empty($dower_info['item_id']) && !empty($dower_info['item_num'])) { # deduct_prop_by_prop_id方法中有判断道具是否足够,故外层不判断 $arr_logs_consume = array(); $log_param = array('level' => $player_info['level'], 'vip' => $player_info['vip'], 'privilege_level' => $player_info['privilege_level'], 'cmd_id' => 613); $re = $this->get_game('Prop')->deduct_prop_by_prop_id($player_id, $dower_info['item_id'], $dower_info['item_num'], $arr_logs_consume, 0, $log_param); $this->write_check($re, 3010904); } # 更新玩家已激活天赋信息 $re = $this->get_data('PlayerDower')->update_player_dower($player_id, $active_dower_list[$dower_id]); $this->write_check($re, 3010909); # 获取玩家已经启用的天赋信息 $get_field = Protocol_Player::get_player_attr_detail_key(); $get_field[] = 'skill_starmap_info'; $get_field[] = 'skill_info'; $get_field[] = 'skill_rune_info'; $get_field[] = 'dower_info'; $player_detail = $this->get_data('PlayerDetail')->get_player_detail($player_id, $get_field); $player_detail['dower_info'][$dower_id] = array('slot_idx' => 0, 'dower_id' => $dower_id, 'dower_lv' => $active_dower_list[$dower_id]['dower_lv']); $re = $this->get_data('PlayerDetail')->update_player_detail($player_id, array('dower_info' => $player_detail['dower_info'])); $this->write_check($re, 3010915); $this->commit(); #引导任务 #if (empty($before_level)) { # 激活才触发,升级不触发 $this->get_game('TaskTrigger')->async_trigger_guide_task($player_id, 13, 1); # 升级也算 #} # -------------------------------------------------------------------- # 806同步道具变更 # -------------------------------------------------------------------- $ndata = array(); if (!empty($arr_logs_consume)) { foreach ($arr_logs_consume as $k => $v) { # 消耗的道具 $ndata[] = $v; } } Protocol_Prop::prop_806($player_id, $ndata); # -------------------------------------------------------------------- # 脏数据同步 # -------------------------------------------------------------------- //同步人物属性 $arr_part_update['dower_info'] = ''; $arr_part_update['player_data'] = array('player_detail' => $player_detail, 'player' => array('career_type' => $player_info['career_type'], 'level' => $player_info['level'])); Protocol_Player::p2c_part_update($player_id, $arr_part_update); $out_613 = array('dower_id' => $dower_id, 'dower_lv' => $active_dower_list[$dower_id]['dower_lv']); # 成就相关埋点 $this->handle_dower_refer_achieve($player_id); # 旧的仍然保留 $achieve_val = "1:" . $active_dower_list[$dower_id]['dower_lv'] . ":" . $dower_id; $this->get_game('PlayerAchieve')->async_trigger_achieve_target($player_id, 48, $achieve_val, 4); # -------------------------------------------------------------------- # 游戏日志记录 # -------------------------------------------------------------------- $log_info = array('player_id' => $player_id, 'player_level' => $player_info['level'], 'vip_level' => $player_info['vip'], 'vip_special_level' => $player_info['privilege_level'], 'add_time' => $this->current_time, 'dower_id' => $dower_id, 'dower_name' => $dower_info['name'], 'before_level' => $before_level, 'after_level' => $active_dower_list[$dower_id]['dower_lv']); Log_Skill::getInstance()->add_log($log_info, 'dower'); return $out_613; }
/** * 小红点提示 * @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; }