Esempio n. 1
0
 public function get_reward_by_sid($player_id, $sid, $times, $currency_types, $pinfo, $union_level, $wanted_level, $player_times = array())
 {
     $currency_types = explode(',', $currency_types);
     $reward = '';
     switch ($sid) {
         case 1:
             //主线副本
             $exp_num = $this->get_game('PlayerFB')->main_fb_resource_retrieve($player_id, $times, 3, $pinfo, $union_level);
             if ($exp_num) {
                 $reward = "1:" . ceil($exp_num);
             }
             break;
         case 2:
             //挑战副本
             $send_reward = $this->get_game('PlayerPVE')->get_compensation_reward($player_id, 2, null, null, null, $pinfo);
             $arr_award = array();
             foreach ($send_reward as $value) {
                 if (in_array($value['item_id'], $currency_types)) {
                     $arr_award[] = $value['item_id'] . ':' . ceil($value['item_num'] * $times);
                 }
             }
             if ($arr_award) {
                 $reward = implode('|', $arr_award);
             }
             break;
         case 3:
             //vip副本
             $exp_num = $this->get_game('PlayerFB')->vip_fb_resource_retrieve($player_id, $pinfo['level'], $pinfo['vip'], $times);
             if ($exp_num) {
                 $reward = "1:" . ceil($exp_num);
             }
             break;
         case 4:
             //日常任务
             $arr_reward = $this->get_game('TaskHandler')->get_daily_task_reward($player_id, $pinfo);
             if ($arr_reward) {
                 $send_reward = $arr_reward[0];
                 $arr_award = array();
                 foreach ($send_reward as $value) {
                     if (in_array($value['item_id'], $currency_types)) {
                         $arr_award[] = $value['item_id'] . ':' . ceil($value['item_num'] * $times);
                     }
                 }
                 if ($arr_award) {
                     $reward = implode('|', $arr_award);
                 }
             }
             break;
         case 5:
             //天梯
             $reward_detail = $this->get_game('Challenge')->get_challenge_battle_reward($player_id, $pinfo);
             if ($reward_detail) {
                 $arr_award = array();
                 foreach ($reward_detail as $key => $value) {
                     if (in_array($key, $currency_types)) {
                         $arr_award[] = $key . ':' . ceil($value * $times);
                     }
                 }
                 if ($arr_award) {
                     $reward = implode('|', $arr_award);
                 }
             }
             break;
         case 6:
             //竞技场
             $send_reward = $this->get_game('KFArena')->get_back_reward($player_id, $pinfo['privilege_level'], $times);
             $arr_award = array();
             foreach ($send_reward as $value) {
                 if (in_array($value['item_id'], $currency_types)) {
                     $arr_award[] = $value['item_id'] . ':' . ceil($value['item_num']);
                 }
             }
             if ($arr_award) {
                 $reward = implode('|', $arr_award);
             }
             break;
         case 7:
             //世界boss
             if (!$this->_player_func) {
                 $this->get_now_sids($player_id, $pinfo['level']);
             }
             $f_sid = $this->_player_func[$sid];
             if (!$f_sid) {
                 return $reward;
             }
             $baseinfo = $this->get_game('WorldBoss')->get_base_info_id($f_sid);
             #vip加成奖励
             $vip_exp = 0;
             if ($pinfo['privilege_level'] > 0) {
                 $left_cd = $this->get_game('VipSpecial')->get_left_time($player_id);
                 if ($left_cd > 0) {
                     $vip_set = Cache_VipLevelLimit::getInstance()->get_limit_info($pinfo['privilege_level'], 10034);
                     if (!empty($vip_set)) {
                         $vip_exp = $vip_set['max_times'];
                     }
                 }
             }
             $rank_list = Cache_WorldBoss::getInstance()->get_rank_reward();
             $rankreward = $rank_list[25]['reward_per'];
             $item_num = ($vip_exp / 10000 + 1) * ceil($baseinfo['dps_reward'] * $rankreward / 100);
             $reward = '1:' . ceil($item_num * $times);
             if (isset($player_times['world_boss_battle_rank']) && $player_times['world_boss_battle_rank']) {
                 $count = count($rank_list);
                 if ($player_times['world_boss_battle_rank'] > $count) {
                     $rank_num = $count;
                 } else {
                     $rank_num = $player_times['world_boss_battle_rank'];
                 }
                 if ($rank_list[$rank_num - 1]['item_id'] && in_array($rank_list[$rank_num - 1]['item_id'], $currency_types) && $rank_list[$rank_num - 1]['item_reward_cnt']) {
                     $item_num = ceil($rank_list[$rank_num - 1]['item_reward_cnt'] * 0.7) * $times;
                     $reward = $reward . '|' . $rank_list[$rank_num - 1]['item_id'] . ':' . $item_num;
                 }
             }
             break;
         case 8:
             //水晶争夺
             if (!$this->_player_func) {
                 $this->get_now_sids($player_id, $pinfo['level']);
             }
             $f_sid = $this->_player_func[$sid];
             if (!$f_sid) {
                 return $reward;
             }
             $send_reward = $this->get_game('GrabMine')->get_grabmine_reward($player_id, $pinfo, $f_sid);
             $arr_award = array();
             foreach ($send_reward as $value) {
                 if (in_array($value['item_id'], $currency_types)) {
                     $arr_award[] = $value['item_id'] . ':' . ceil($value['item_num'] * $times);
                 }
             }
             if ($arr_award) {
                 $reward = implode('|', $arr_award);
             }
             break;
         case 9:
             //智力问答
             $reward_detail = $this->get_game('AthenaQuestion')->get_athena_question_socre_reward($player_id, $pinfo);
             if ($reward_detail) {
                 $arr_award = array();
                 foreach ($reward_detail as $key => $value) {
                     if (in_array($key, $currency_types)) {
                         $arr_award[] = $key . ':' . ceil($value * $times);
                     }
                 }
                 if ($arr_award) {
                     $reward = implode('|', $arr_award);
                 }
             }
             break;
         case 10:
             //欢乐魔蛋
             $rewards = $this->get_game('PlayerFB')->egg_active_resource_retrieve($player_id, $pinfo['level'], $times);
             if ($rewards) {
                 $arr_award = array();
                 foreach ($rewards as $value) {
                     if (in_array($value['id'], $currency_types)) {
                         $arr_award[] = $value['id'] . ':' . ceil($value['num']);
                     }
                 }
                 if ($arr_award) {
                     $reward = implode('|', $arr_award);
                 }
             }
             break;
         case 11:
             //守卫女神
             if (!$this->_player_func) {
                 $this->get_now_sids($player_id, $pinfo['level']);
             }
             $f_sid = $this->_player_func[$sid];
             if (!$f_sid) {
                 return $reward;
             }
             $athena_set = Cache_Athena::getInstance()->get_athena_set($f_sid);
             $max_waves = $athena_set['max_waves'];
             $wave = ceil($max_waves * 0.7);
             $rewards = Cache_Athena::getInstance()->get_athena_reward($f_sid);
             if ($rewards && $wave > 0) {
                 $reward_ids = array();
                 foreach ($rewards as $val) {
                     if ($val['sid'] == $f_sid && $wave == $val['waves']) {
                         $reward_ids = explode('|', $val['rewards']);
                     }
                 }
                 if (!empty($reward_ids)) {
                     $arr_award = array();
                     $vip_exp = $this->get_game('Athena')->get_vip_add_exp($player_id);
                     foreach ($reward_ids as $v) {
                         $temp = explode(':', $v);
                         if (count($temp) > 1) {
                             if (in_array($temp[0], $currency_types)) {
                                 $item_num = $temp[1] * (1 + $vip_exp);
                                 $arr_award[] = $temp[0] . ':' . ceil($item_num * $times);
                             }
                         }
                     }
                     if ($arr_award) {
                         $reward = implode('|', $arr_award);
                     }
                 }
             }
             break;
         case 12:
             //神之试炼
             if (!$this->_player_func) {
                 $this->get_now_sids($player_id, $pinfo['level']);
             }
             $f_sid = $this->_player_func[$sid];
             if (!$f_sid) {
                 return $reward;
             }
             $buff = Cache_Trial::getInstance()->get_buff($f_sid, 3);
             $rewards = Cache_Trial::getInstance()->get_trial_reward();
             $reward_string = Cache_Trial::getInstance()->get_reward($pinfo['level'], $rewards);
             $reward_array = explode("|", $reward_string);
             $arr_award = array();
             foreach ($reward_array as $arr) {
                 list($item_idx, $item_num) = explode(":", $arr);
                 if (empty($item_num)) {
                     continue;
                 }
                 if (in_array($item_idx, $currency_types)) {
                     $arr_award[] = $item_idx . ':' . ceil($item_num * $buff * $times);
                 }
             }
             if ($arr_award) {
                 $reward = implode('|', $arr_award);
             }
             break;
         case 13:
             //公会通缉
             $exp_num = $this->get_game('UnionWanted')->wanted_fb_resource_retrieve($pinfo['level'], $wanted_level, 3, 2, $times);
             if ($exp_num) {
                 $reward = "1:" . ceil($exp_num);
             }
             break;
         case 14:
             //3v3
             $id = $this->get_data('KFDuel')->get_open_sid($pinfo['level']);
             $reward = '';
             if ($id) {
                 $reward_conf = Cache_CrossDuel::getInstance()->get_battle_reward_conf($id, $pinfo['level']);
                 $point = intval($reward_conf['point'] * $times / 2);
                 $rewards = array();
                 $arr_reward = explode('|', $reward_conf['reward']);
                 foreach ($arr_reward as $value) {
                     $ar_re = explode(':', $value);
                     if (in_array($ar_re[0], $currency_types)) {
                         $rewards[] = $ar_re[0] . ':' . intval($ar_re[1] * $times / 2);
                     }
                 }
                 $reward = implode('|', $rewards);
                 if (in_array(16, $currency_types)) {
                     $reward = $reward . '|16:' . $point;
                 }
             }
             break;
         case 15:
             //8v8
             $rank_conf = Cache_FlameBattle::getInstance()->get_rank_conf(11);
             $gold = $rank_conf['gold'];
             $score = $rank_conf['reward'];
             $rewards = array();
             $reward = '';
             if (in_array(3, $currency_types)) {
                 $rewards[] = '3:' . $gold * $times;
             }
             if (in_array(17, $currency_types)) {
                 $rewards[] = '17:' . $score * $times;
             }
             $reward = implode('|', $rewards);
             break;
         default:
             //pass
             break;
     }
     return $reward;
 }
Esempio n. 2
0
 /**
  * 获取最大次数
  * @param $player_id
  * @param $fun_id
  * @param $vip_level
  */
 public function get_max_daily_time($player_id, $field, $vip_level = 0)
 {
     $max_num = 0;
     switch ($field) {
         case 'pub_left_num':
             #普通抽取总次数
             $max_num = $this->get_game('PubHero')->get_max_free_time($vip_level, 1);
             break;
         case 'pub_left_ten_num':
             #十连抽
             $max_num = $this->get_game('PubHero')->get_max_free_time($vip_level, 3);
             break;
         case 'daily_task_finish_count':
             # 日常任务每日完成轮数上限
             $max_num = $this->get_game('TaskHandler')->get_daily_task_finish_stint($player_id);
             break;
         case 'challenge_battle_num':
             # 天梯战斗挑战次数上限
             list($challenge_battle_num, $max_num) = $this->get_game('Challenge')->get_challenge_battle_num_info($player_id);
             break;
         case 'used_fight_num':
             #副本挑战总次数
             $max_num = $this->get_game('PlayerPVE')->get_max_times($player_id, $vip_level);
             break;
         case 'coin_exchange_free_times_max':
             #炼金最大免费使用次数
             $max_num = $this->get_game('PlayerCoinExchange')->get_free_times_max_interface($player_id, $vip_level);
             break;
         case 'daily_sign_free_times_max':
             #签到最大免费次数
             $max_num = $this->get_game('DailySign')->get_free_times_max_interface($player_id, $vip_level);
             break;
         case 'union_wanted_times_max':
             #公会通缉任务最大完成次数
             $max_num = $this->get_game('UnionWanted')->get_free_times_max_interface($player_id, $vip_level);
             break;
         case 'kf_arena_add_times_max':
             #竞技场最大的挑战次数
             $kf_arena_conf = Cache_CrossArenaConf::getInstance()->get_conf(array('max_fight_times'));
             $max_fight_times = $kf_arena_conf['max_fight_times'];
             $max_num = $max_fight_times['val'] + $this->get_data('PlayerDailyTime')->get_player_used_time($player_id, 'kf_arena_add_times');
             break;
         case 'kf_duel_add_times_max':
             #组队最大的挑战次数
             $kf_duel_conf = Cache_CrossDuel::getInstance()->get_battle_conf(41001);
             $max_fight_times = $kf_duel_conf['times'];
             $max_num = $max_fight_times + $this->get_player_used_time($player_id, 'kf_duel_add_times');
             break;
         case 'union_bomb_count':
             #魔能巨炮强化最大次数
             $union_conf = Cache_UnionBase::getInstance()->get_union_conf();
             $max_num = $union_conf['max_bomb_time'];
             break;
         case 'grab_treasure_battle_times_max':
             $grab_treasure_battle_buy_type = $this->get_game('GrabTreasure')->get_grab_treasure_battle_buy_type();
             $buy_times_info = Cache_BuyTimes::getInstance()->get_buy_times_info($grab_treasure_battle_buy_type, 1);
             # 获取: 每日已挑战次数 + 每日挑战购买次数 + 当天剩余可用挑战次数
             $battle_buy_times = $this->get_data('PlayerDailyTime')->get_player_used_time($player_id, 'grab_treasure_battle_buy_times');
             if (empty($battle_buy_times)) {
                 $battle_buy_times = 0;
             }
             $max_num = $battle_buy_times * $buy_times_info['per_num'] + $this->get_game('GrabTreasure')->get_grab_treasure_max_times();
             break;
     }
     return $max_num;
 }
Esempio n. 3
0
 public function get_list_from_type_id($typeid)
 {
     $res = array();
     switch ($typeid) {
         case 1:
             $res = $this->get_data('RankList')->get_sort_list('level', 1);
             break;
         case 2:
             $res = $this->get_data('RankList')->get_sort_list('sum_fpower', 2);
             break;
         case 3:
             $data = $this->get_data('Challenge')->get_player_list_100();
             $res = $this->get_res_list($data);
             break;
         case 4:
             $res = $this->get_cross('KFArena')->get_rank_list();
             break;
         case 5:
             $res = $this->get_data('RankList')->get_vip_rank();
             break;
         case 6:
             //组队3v3
             $settle_date = Cache_CrossDuel::getInstance()->get_settle_time();
             $res = $this->get_cross('KFDuel')->get_rank_list($settle_date);
             break;
         case 7:
             $res = $this->get_data('RankList')->get_fairy_rank_cache();
             break;
         case 8:
             $res = $this->get_data('RankList')->get_hero_rank_cache();
             break;
         case 9:
             $res = $this->get_data('RankList')->get_wing_rank_cache();
             break;
         case 10:
             $res = $this->get_data('RankList')->get_main_dungeon_rank_cache();
             break;
         case 11:
             $res = $this->get_data('PlayerPve')->get_rank_list();
             break;
         case 12:
             $res = $this->get_data('WorldBoss')->get_harm_rank();
             break;
         case 13:
             $res = $this->get_data('FlameBattle')->get_rank();
             break;
         case 14:
             $list = $this->get_game('Trial')->get_rank_list();
             $res = $this->get_trial_info($list);
             break;
         case 15:
             $res = $this->get_data('Duel')->get_rank();
             break;
         case 16:
             $data = $this->get_game('GrabMine')->get_rank_list();
             $res = $this->get_res_list_2($data);
             break;
         case 17:
             $data = $this->get_data('MagicParliament')->get_fame_rank_list();
             $res = $this->get_res_list_2($data);
             break;
         case 18:
             //组队3v3 总积分排行
             $res = $this->get_cross('KFDuel')->get_total_rank_list();
             break;
     }
     return $res;
 }
Esempio n. 4
0
 /**
  * 战斗结算
  * @param $group 地图id
  * @param $role_id 角色id
  * @param $is_win 是否胜利
  * @param $is_send_mail 是否发邮件
  * @param $opp_name 对手名字
  * @return null 
  */
 public function game_over($group, $role_id, $is_win, $is_send_mail, $opp_player_id, $opp_name, $opp_server_id, $rank_list = array(), $my_team_id, $friend)
 {
     //Com_Log::write('zzzwanghui',json_encode($rank_list));
     //Com_Log::write('zzzwanghui',$group.'-'.$role_id.'-'.$is_win.'-'.$is_send_mail.'-'.$opp_player_id.'-'.$opp_name.'-'.$opp_server_id);
     if (!in_array($group, array(1, 2, 3))) {
         return false;
     }
     $sid = $this->_map_ids[$group - 1];
     $player_info = $this->get_data('Player')->get_player_info($role_id, array('player_id', 'union_name', 'career_type', 'name', 'level', 'vip', 'privilege_level', 'sum_fpower', 'kf_score'));
     if (empty($player_info) || empty($player_info['player_id'])) {
         return false;
     }
     $player_id = $role_id;
     $settle_date = Cache_CrossDuel::getInstance()->get_settle_time();
     $my_duel_info = $this->get_data('KFDuel')->get_kf_duel_info($player_id, $settle_date);
     $old_rank = $this->get_cross('KFDuel')->get_my_rank($player_id, $settle_date);
     $front_score = $my_duel_info['score'];
     $front_rank = $old_rank;
     $my_update = array();
     $multi = 1;
     $battle_config = Cache_CrossDuel::getInstance()->get_battle_conf($sid);
     $time = time();
     if ($time <= strtotime($battle_config['double_end_time']) && $time >= strtotime($battle_config['double_open_time'])) {
         $multi = 2;
     }
     $reward_conf = Cache_CrossDuel::getInstance()->get_battle_reward_conf($sid, $player_info['level']);
     if (!$reward_conf) {
         $this->throw_error(10222, 6010101);
     }
     $point = $reward_conf['point'];
     $win_reward = '';
     $arr_reward = explode('|', $reward_conf['reward']);
     if ($is_win) {
         $my_update['win'] = $my_duel_info['win'] + 1;
         $point = $point * $multi;
         $rewards = array();
         foreach ($arr_reward as $value) {
             $ar_re = explode(':', $value);
             $rewards[] = $ar_re[0] . ':' . intval($ar_re[1] * $multi);
         }
         $win_reward = implode('|', $rewards);
     } else {
         $my_update['win'] = 0;
         $point = intval($point * $multi / 2);
         $rewards = array();
         foreach ($arr_reward as $value) {
             $ar_re = explode(':', $value);
             $rewards[] = $ar_re[0] . ':' . intval($ar_re[1] * $multi / 2);
         }
         $win_reward = implode('|', $rewards);
     }
     $my_update['score'] = $my_duel_info['score'] + $point;
     $total_score = $my_duel_info['total_score'] + $point;
     if ($total_score > 2147483000) {
         $total_score = 2147483000;
     }
     $my_update['total_score'] = $total_score;
     $base_reward = $this->_basic_reward_currency . ':' . $point;
     if ($win_reward) {
         $base_reward .= '|' . $win_reward;
     }
     $my_fight_log = array('player_id' => $player_id, 'opp_player_id' => $opp_player_id, 'opp_name' => $opp_name, 'opp_server_id' => $opp_server_id, 'result' => $is_win, 'score' => $point);
     $out_reward = array('result' => $is_win, 'base_reward' => $base_reward, 'other_reward' => '');
     $send_reward = array();
     $reward_detail = $this->get_game('Reward')->get_reward_detail($base_reward);
     $this->get_game('Reward')->gen_reward_array($reward_detail, $send_reward);
     $this->start_trans();
     $result = $this->get_data('KFDuel')->set_kf_duel_info($player_id, $my_update);
     if ($result) {
         $result = $this->get_data('KFDuel')->add_fight_log($my_fight_log);
     }
     if ($result) {
         if ($send_reward) {
             if ($is_send_mail) {
                 //发邮件
                 $attachment = array();
                 foreach ($send_reward as $val) {
                     $attachment[] = array('prop_id' => $val['item_id'], 'prop_num' => $val['item_num']);
                 }
                 $phrase_config = Cache_FuncPhraseConfig::getInstance()->get_phrase_config_info(13);
                 $result = $this->get_game('Mail')->async_trigger_mail($player_id, $phrase_config['title'], $phrase_config['content'], $attachment, $phrase_config['sender'], 1, 1236);
             } else {
                 //直接发奖励
                 $result = $this->get_game('Reward')->send_reward($player_id, $send_reward, array('cmd_id' => 1236));
                 if ($result !== true) {
                     $this->throw_error($result, 6010099);
                 }
             }
         }
     }
     if ($result) {
         $this->commit();
         if (!$is_send_mail) {
             $this->get_game('Reward')->add_reward_log();
         }
         //存入排行
         $rank_data = array();
         $rank_data['player_id'] = $player_id;
         $rank_data['player_name'] = $player_info['name'];
         $rank_data['career_type'] = $player_info['career_type'];
         $rank_data['player_level'] = $player_info['level'];
         $rank_data['union_name'] = $player_info['union_name'];
         $rank_data['sum_fpower'] = $player_info['sum_fpower'];
         $rank_data['sid'] = $sid;
         $rank_data['server_id'] = SERVER_ID;
         $rank_data['server_name'] = SHOW_TITLE;
         $rank_data['score'] = $my_update['score'];
         $rank_data['reward_status'] = 0;
         $rank_data['update_time'] = time();
         $this->get_cross('KFDuel')->set_kf_duel_rank($player_id, $settle_date, $rank_data);
         //存入排行
         $new_rank = $this->get_cross('KFDuel')->get_my_rank($player_id, $settle_date);
         //$this->get_data('KFDuel')->set_kf_duel_info($player_id,array('rank'=>$new_rank));
         $total_rank_data = $rank_data;
         $total_rank_data['score'] = $my_update['total_score'];
         $this->get_cross('KFDuel')->set_kf_duel_total_rank($player_id, $total_rank_data);
         //存入总积分排行
         $out_reward['rank'] = $new_rank;
         $out_reward['total_score'] = $player_info['kf_score'] + $point;
         $out_reward['score'] = $my_update['score'];
         if ($rank_list) {
             foreach ($rank_list as &$list) {
                 //真恶心,C++干的事情!!!!
                 if ($list[0] == $player_id) {
                     $list[13] = $point;
                     $list[14] = $win_reward;
                     $damage = $list[2] ? $list[2] : 0;
                     $multi_kill = $list[9] ? $list[9] : 0;
                     $this->get_cross('KFDuel')->update_day_info($player_id, $is_win, $damage, $multi_kill);
                 } else {
                     $reward_conf = Cache_CrossDuel::getInstance()->get_battle_reward_conf($sid, $list[12]);
                     $arr_reward = explode('|', $reward_conf['reward']);
                     if ($my_team_id == $list[6]) {
                         //队友
                         if ($is_win) {
                             $list[13] = $reward_conf['point'] * $multi;
                             $rewards = array();
                             foreach ($arr_reward as $value) {
                                 $ar_re = explode(':', $value);
                                 $rewards[] = $ar_re[0] . ':' . intval($ar_re[1] * $multi);
                             }
                             $list[14] = implode('|', $rewards);
                         } else {
                             $list[13] = intval($reward_conf['point'] * $multi / 2);
                             $rewards = array();
                             foreach ($arr_reward as $value) {
                                 $ar_re = explode(':', $value);
                                 $rewards[] = $ar_re[0] . ':' . intval($ar_re[1] * $multi / 2);
                             }
                             $list[14] = implode('|', $rewards);
                         }
                     } else {
                         if ($is_win) {
                             $list[13] = intval($reward_conf['point'] * $multi / 2);
                             $rewards = array();
                             foreach ($arr_reward as $value) {
                                 $ar_re = explode(':', $value);
                                 $rewards[] = $ar_re[0] . ':' . intval($ar_re[1] * $multi / 2);
                             }
                             $list[14] = implode('|', $rewards);
                         } else {
                             $list[13] = $reward_conf['point'] * $multi;
                             $rewards = array();
                             foreach ($arr_reward as $value) {
                                 $ar_re = explode(':', $value);
                                 $rewards[] = $ar_re[0] . ':' . intval($ar_re[1] * $multi);
                             }
                             $list[14] = implode('|', $rewards);
                         }
                     }
                 }
             }
         }
         $out_reward['rank_list'] = $rank_list;
         $out_reward['my_team_id'] = $my_team_id;
         #添加好友亲密度
         $this->get_game('Athena')->add_firend_point($player_id, $friend);
         $this->get_game('PlayerAchieve')->async_trigger_achieve_target($player_id, 42, $new_rank, 3);
         $this->get_game('DailyBoon')->async_trigger_daily_boon_task($player_id, 3009, 1);
         //日志
         Log_KfDuel::getInstance()->add_kf_duel_log($player_id, $player_info['level'], $player_info['vip'], $player_info['privilege_level'], $my_update['score'], $new_rank, $front_score, $front_rank);
         if (!$is_send_mail) {
             //推奖励面板
             //Com_Log::write('zzzwanghui',json_encode($out_reward));
             Protocol::input($player_id, 8, 12, 1236, $out_reward);
         }
     } else {
         $this->rollback();
         $this->throw_error('10104', 6010100);
     }
     return $result;
 }
Esempio n. 5
0
 public function achieve_repair($player_id)
 {
     $version = 19;
     $achieve_repair_times = $this->get_data('PlayerAchieve')->get_achieve_repair_times($player_id);
     if ($achieve_repair_times >= $version) {
         return false;
     }
     $player_info = $this->get_data('Player')->get_player_info($player_id, array("level", "sum_fpower"));
     if ($achieve_repair_times < $version) {
         Com_Log::write('xgame.trigger_achieve_test1', "{$player_id}--cc");
         #=====================================同步进度===============================================#
         $task_type_progress = $this->get_data('PlayerAchieveCounter')->get_player_achieve_counter_info($player_id, 'task_type_progress');
         if (empty($task_type_progress)) {
             $this->get_data('PlayerAchieve')->set_achieve_repair_times($player_id, $version);
             return;
         }
         Com_Log::write('xgame.trigger_achieve_test1', "{$player_id}--ee" . json_encode($task_type_progress));
         $task_type_progress_his = $this->get_data('PlayerAchieveCounter')->get_player_achieve_counter_info($player_id, 'task_type_progress_his');
         if (empty($task_type_progress_his)) {
             $ret = $this->get_data('PlayerAchieveCounter')->update_player_achieve_counter($player_id, array("task_type_progress_his" => $task_type_progress));
             if (!$ret) {
                 return;
             }
         }
         if ($task_type_progress) {
             $ret = $this->get_data('PlayerAchieveCounter')->update_player_achieve_counter($player_id, array("task_type_progress" => array()));
             if (!$ret) {
                 return;
             }
         }
         Com_Log::write('xgame.trigger_achieve_test1', "{$player_id}--dd" . json_encode($task_type_progress));
         if (!empty($task_type_progress) && Com_Array::is_good_arr($task_type_progress)) {
             foreach ($task_type_progress as $progress) {
                 if (in_array($progress['type'], $this->special_task_type)) {
                     continue;
                 }
                 Com_Log::write('xgame.trigger_achieve_test1', "{$player_id}--aa" . json_encode($progress));
                 $this->async_trigger_achieve_target($player_id, $progress['type'], $progress['val'], $progress['update_type'], $player_info['level']);
                 Com_Log::write('xgame.trigger_achieve_test1', "{$player_id}--bb" . json_encode($progress));
             }
         }
         #===============================================================================================#
         #英雄等级类型(1:等级2:潜能3:星级4:合体5:战力)
         #英雄1:等级
         $max_level = $this->get_game('Hero')->get_hero_level_max($player_id, 1);
         $this->async_trigger_achieve_target($player_id, 11, $max_level, 8, $player_info['level']);
         #英雄2:潜能
         $max_level = $this->get_game('Hero')->get_hero_level_max($player_id, 2);
         $this->async_trigger_achieve_target($player_id, 12, $max_level, 8, $player_info['level']);
         #英雄3:星级
         $max_level = $this->get_game('Hero')->get_hero_level_max($player_id, 3);
         $this->async_trigger_achieve_target($player_id, 13, $max_level, 8, $player_info['level']);
         #女神品阶
         $max_level = $this->get_game('Fairy')->get_fairy_level_max($player_id);
         $this->async_trigger_achieve_target($player_id, 9, $max_level, 8, $player_info['level']);
         #以下新增任务暂不同步
         #翅膀装备最大羽炼等级
         $max_level = $this->get_game('PlayerWing')->get_wing_equip_level_max($player_id, 1);
         $this->async_trigger_achieve_target($player_id, 34, $max_level, 8, $player_info['level']);
         #当前拥有%s品质羽饰%s件
         $player_props = $this->get_data('PlayerProp')->get_player_all_prop($player_id);
         $install_starmap_sum = 0;
         foreach ($player_props as $prop) {
             if (!empty($prop['star_map_id'])) {
                 $install_starmap_sum += 1;
             }
             if ($prop['type'] == 6) {
                 $this->async_trigger_achieve_target($player_id, 35, "1:" . $prop['quality'] . ":" . $prop['star_level'] . ":" . intval($prop['level']) . ":{$prop['player_prop_id']}", 4, $player_info['level']);
             } else {
                 if ($prop['type'] == 1) {
                     $this->async_trigger_achieve_target($player_id, 6, "1:" . $prop['quality'] . ":" . $prop['star_level'] . ":" . intval($prop['intensive_level']) . ":{$prop['player_prop_id']}", 4, $player_info['level']);
                 }
             }
         }
         if ($install_starmap_sum) {
             $this->async_trigger_achieve_target($player_id, 8, $install_starmap_sum, 2);
         }
         #英雄最大成长值
         $max_level = $this->get_game('Hero')->get_hero_level_max($player_id, 6);
         $this->async_trigger_achieve_target($player_id, 37, $max_level, 8, $player_info['level']);
         #女神最大强化等级
         $max_level = $this->get_game('Fairy')->get_fairy_train_level_max($player_id, 1);
         $this->async_trigger_achieve_target($player_id, 38, $max_level, 8, $player_info['level']);
         #玩家女神符文等级
         $fairy_rune_list = $this->get_game('Fairy')->get_fairy_nune_info($player_id);
         if (!empty($fairy_rune_list) && Com_Array::is_good_arr($fairy_rune_list)) {
             foreach ($fairy_rune_list as $rune_info) {
                 $rune_level = $rune_info['level'];
                 $achieve_id = $rune_info['achieve_id'];
                 $this->async_trigger_achieve_target($player_id, 40, "1:{$rune_level}:{$achieve_id}", 4, $player_info['level']);
             }
         }
         #玩家大翅膀成就更新
         $wing_num = $this->get_game('PlayerWing')->get_activation_wing_num_interface($player_id);
         $this->async_trigger_achieve_target($player_id, 49, $wing_num, 2, $player_info['level']);
         #3v3竞技
         $settle_date = Cache_CrossDuel::getInstance()->get_settle_time();
         $new_rank = $this->get_cross('KFDuel')->get_my_rank($player_id, $settle_date);
         if ($new_rank) {
             $this->async_trigger_achieve_target($player_id, 42, $new_rank, 3, $player_info['level']);
         }
         #决斗
         $this->get_data('Duel')->get_my_rank($player_id);
         #修复洗练完美度相关成就
         $this->get_game("EquipRefine")->_forward_compatibility_for_achieve($player_id, 1);
         #修复翅膀装备精修等级相关成就
         $this->get_game("EquipRefine")->_forward_compatibility_for_achieve($player_id, 2);
         #修复天赋相关成就
         $this->get_game("PlayerSkill")->_forward_compatibility_for_achieve($player_id, 1);
         #同步战力
         $this->async_trigger_achieve_target($player_id, 1, $player_info['sum_fpower'], 2, $player_info['level']);
         $player_detail = $this->get_data('PlayerDetail')->get_player_detail($player_id, array('wing_info'));
         $data = $player_detail['wing_info'];
         if (!empty($data)) {
             foreach ($data as $info) {
                 $this->get_game('PlayerAchieve')->async_trigger_achieve_target($player_id, 27, $info['lvl']);
             }
         }
     }
     $this->get_data('PlayerAchieve')->set_achieve_repair_times($player_id, $version);
     $this->get_achieve_list($player_id);
 }
Esempio n. 6
0
 /**
  * 计算开启条件sid
  */
 public function get_open_sid($level)
 {
     $list = $this->get_data('RankList')->get_sort_list('level');
     $sid_list = Cache_CrossDuel::getInstance()->get_battle_conf();
     if (empty($list) || empty($sid_list)) {
         return 0;
     }
     $count = array();
     $conf_list = array();
     foreach ($sid_list as $val) {
         if ($level >= $val['open_level']) {
             $conf_list[] = $val;
             foreach ($list as $levels) {
                 if ($val['open_level'] <= $levels['level']) {
                     $count[$val['sid']] += 1;
                 }
             }
         }
     }
     $sid = 0;
     foreach ($conf_list as $val) {
         if ($count[$val['sid']] >= $val['open_num'] && $val['sid'] > $sid) {
             $sid = $val['sid'];
         }
     }
     return $sid;
 }