Пример #1
0
 /**
  * 功能图标变更下行协议
  * @param $player_id
  * @param $func_id 
  * @param $action_type: 0关闭,1开启
  *
  */
 public static function sync_func_data($player_id, $func_id, $action_type = 0, $func_config = null)
 {
     if (empty($func_config) || !is_array($func_config)) {
         $func_config = Cache_FuncConfig::getInstance()->get_func_config_info($func_id);
     }
     if ($action_type == 0) {
         # 告知Flash关闭功能
         $out_741['funcs'][] = array('operate' => 2, 'func_id' => $func_config['func_id'], 'func_name' => $func_config['func_name'], 'open' => 1, 'pos' => $func_config['pos'], 'order' => $func_config['order']);
     } elseif ($action_type == 1) {
         # 告知Flash开启功能
         $out_741['funcs'][] = array('operate' => 1, 'func_id' => $func_config['func_id'], 'func_name' => $func_config['func_name'], 'open' => 1, 'pos' => $func_config['pos'], 'order' => $func_config['order']);
     }
     Protocol::input($player_id, 8, 7, 741, $out_741);
 }
Пример #2
0
 public function fix_func_open()
 {
     $player_ids = $this->redis()->keys("data|player:*");
     foreach ($player_ids as $key) {
         $info = $this->redis()->hash_get($key);
         if (!empty($info['player_id'])) {
             $func_list = Cache_FuncConfig::getInstance()->get_func_config_by_open_type_condition_id_use_fix(2, $info['level']);
             if (!empty($func_list)) {
                 foreach ($func_list as $val) {
                     $func_open[$val['func_id']] = 1;
                 }
             } else {
                 $func_open[] = array();
             }
             $data['func_open'] = json_encode($func_open);
             $pkey = "data|player_detail:{$info['player_id']}";
             $this->redis()->hash_set($pkey, $data);
         }
     }
 }
Пример #3
0
 public function fix_func_open()
 {
     $player_ids = $this->redis()->keys("data|player:*");
     foreach ($player_ids as $key) {
         $info = $this->redis()->hash_get($key);
         if (!empty($info['player_id'])) {
             echo "fix func open for ", $info['player_id'], " ...\n";
             $func_list = Cache_FuncConfig::getInstance()->get_func_config_by_open_type_condition_id_use_fix(2, $info['level']);
             $player_detail = $this->get_data('PlayerDetail')->get_player_detail($info['player_id'], array('func_open'));
             $func_open = $player_detail['func_open'];
             echo "before func_open:", json_encode($func_open), "\n";
             if (!empty($func_list)) {
                 foreach ($func_list as $val) {
                     if (!isset($func_open[$val['func_id']])) {
                         $func_open[$val['func_id']] = 1;
                     }
                 }
             }
             $data['func_open'] = json_encode($func_open);
             $pkey = "data|player_detail:{$info['player_id']}";
             $this->redis()->hash_set($pkey, $data);
         }
     }
 }
Пример #4
0
 public function get_activity_list_for_player_id($player_id)
 {
     $player_id = intval($player_id);
     #获取所有活动大厅列表
     $hall_list = Cache_ActivityHall::getInstance()->get_Activity_set();
     $p_info = $this->get_data('Player')->get_player_info($player_id, array('level'));
     $res_list = array();
     $func_conf = Cache_FuncConfig::getInstance()->get_func_config_info(1090);
     if ($func_conf['condition_id'] > $p_info['level']) {
         return $res_list;
     }
     $list_1 = $this->get_res_activity_list($p_info['level'], 1, $hall_list, $player_id);
     #$list_2= $this->get_res_activity_list($p_info['level'],2,$hall_list,$player_id);
     if (!empty($list_1)) {
         foreach ($list_1 as $val) {
             if ($val['status'] == 1 || $val['status'] == 2) {
                 $res_list[] = array('forecast_type' => 0, 'open_time' => $val['start_time'], 'close_time' => $val['end_time'], 'sid' => $val['activity_id']);
             }
         }
     }
     return array($res_list);
 }
Пример #5
0
 protected function init_playerDetail_data($player_id, $career_type)
 {
     #加上功能开启
     $func_list = Cache_FuncConfig::getInstance()->get_func_config_by_open_type_condition_id(2, 1);
     if (!empty($func_list)) {
         foreach ($func_list as $val) {
             $func_open[$val['func_id']] = 1;
         }
     } else {
         $func_open[] = array();
     }
     $base_attr = $this->get_game('PlayerAttr')->getInitPlayerAttrData($career_type);
     $hook_settings = $this->get_game('PlayerBase')->init_onhook_settings();
     $wing_info = $this->get_game('PlayerWing')->create_player_wing($player_id, false);
     $arr_skill_info = $this->get_game('PlayerSkill')->extend_set($player_id, $career_type, 1, false);
     $micro_info = $this->get_game('MicroTerminalBag')->init_micro_terminal_bag_data($player_id, false);
     //$update_res = $this->get_data('PlayerDetail')->update_player_detail($player_id, array('micro_terminal_info' => $mtb_data));
     return array('player_id' => $player_id, 'base_attr' => $base_attr, 'hook_settings' => $hook_settings, 'func_open' => $func_open, 'wing_info' => $wing_info, 'skill_info' => $arr_skill_info['skill_info'], 'skill_rune_info' => $arr_skill_info['skill_rune_info'], 'micro_terminal_info' => $micro_info);
 }
Пример #6
0
 public function open_func($player_id)
 {
     $list = Cache_FuncConfig::getInstance()->get_func_config_info();
     $func_open = array();
     foreach ($list as $val) {
         #$func_open[$val['func_id']] = array(intval($val['func_id']));
         $func_open[$val['func_id']] = 1;
         # 不需要存数组形式啊...
     }
     $this->get_data('PlayerDetail')->update_player_detail($player_id, array('func_open' => $func_open));
 }
Пример #7
0
 /**
  * 发送玩家功能开启情况
  * @param $player_id
  * @return array
  */
 public function get_player_func($player_id, $player_info = null, $player_detail = null)
 {
     $configList = Cache_FuncConfig::getInstance()->get_func_config_info();
     if (empty($player_info) || !isset($player_info['level'])) {
         $player_info = $this->get_data('Player')->get_player_info($player_id, array('level', 'cz_status'));
     }
     if (empty($player_detail) || !isset($player_detail['func_open']) || !isset($player_detail['micro_terminal_info']) || !isset($player_detail['platform_bag_info'])) {
         $player_detail = $this->get_data('PlayerDetail')->get_player_detail($player_id, array('func_open', 'micro_terminal_info', 'platform_bag_info'));
     }
     if (!is_array($player_detail)) {
         $player_detail = array();
     }
     //        $finish_task = $this->get_data('PlayerTaskLog')->get_finish_task($player_id);
     $player_used_time = $this->get_data('PlayerDailyTime')->get_player_used_time($player_id);
     $out = array();
     $up_flag = false;
     if ($configList) {
         $add_func = array();
         $player_task = $this->get_data('PlayerTask')->get_task_info($player_id, array('main_val'));
         $check_seven_reward = $this->get_game('SevenReward')->check_all_reward_status($player_id);
         foreach ($configList as $val) {
             if (SERVER_ID > 1 && $val['issue'] == 0) {
                 continue;
             }
             if ($val['operator_id'] > 0 && $val['operator_id'] != OPERATOR_ID) {
                 continue;
             }
             if (1110 == $val['func_id'] || 1290 == $val['func_id'] || 1291 == $val['func_id']) {
                 continue;
             }
             $is_open = 1;
             if (isset($player_detail['func_open'][$val['func_id']])) {
                 if ($player_info['cz_status'] > 2 && $val['func_id'] == 1140) {
                     continue;
                 } elseif ($val['func_id'] == 1160 && $check_seven_reward === true) {
                     #7日目标礼
                     continue;
                 } else {
                     if ($val['func_id'] == 1180 && $player_detail['micro_terminal_info'][1]['state'] == 2 && $player_detail['micro_terminal_info'][3]['state'] == 2) {
                         continue;
                     } else {
                         if ($val['func_id'] == 91101 && $player_detail['platform_bag_info'][OPERATOR_ID][1] == 2) {
                             continue;
                         } else {
                             if ($val['func_id'] == 91102 && $player_detail['platform_bag_info'][OPERATOR_ID][2] == 2) {
                                 continue;
                             } else {
                                 $out[0][$val['func_id']] = array('operate' => $is_open, 'func_id' => $val['func_id'], 'open' => $is_open, 'guide' => 0, 'cd' => 0, 'tip' => $this->get_func_tips($player_id, $val['func_id'], $player_used_time, $player_detail['func_open']));
                             }
                         }
                     }
                 }
             } else {
                 $task_status = $this->get_game('TaskMain')->task_is_finish($player_id, $val['condition_id'], $player_task);
                 if ($val['open_type'] == 1 && $task_status) {
                     $out[0][$val['func_id']] = array('operate' => 1, 'func_id' => $val['func_id'], 'open' => 1, 'guide' => 0, 'cd' => 0, 'tip' => $this->get_func_tips($player_id, $val['func_id'], $player_used_time, $player_detail['func_open']));
                     $player_detail['func_open'][$val['func_id']] = 1;
                     $up_flag = true;
                 }
                 if ($val['open_type'] == 2 && $player_info['level'] >= $val['condition_id']) {
                     $out[0][$val['func_id']] = array('operate' => 1, 'func_id' => $val['func_id'], 'open' => 1, 'guide' => 0, 'cd' => 0, 'tip' => $this->get_func_tips($player_id, $val['func_id'], $player_used_time, $player_detail['func_open']));
                     $player_detail['func_open'][$val['func_id']] = 1;
                     $up_flag = true;
                 }
             }
         }
     }
     # 返回开启的功能列表前,刷新全民问卷功能和认证功能的开启状态
     list($func_id_1, $open_flag_1) = $this->get_game('ActivityQuestions')->flush_open_status_for_questionnaire_func($player_id);
     list($func_id_2, $open_flag_2) = $this->get_game('AuthReward')->flush_open_status_for_auth_reward_func($player_id);
     if (isset($player_detail['func_open'][$func_id_1]) && empty($open_flag_1)) {
         unset($player_detail['func_open'][$func_id_1]);
         unset($out[0][$func_id_1]);
     }
     if (isset($player_detail['func_open'][$func_id_2]) && empty($open_flag_2)) {
         unset($player_detail['func_open'][$func_id_2]);
         unset($out[0][$func_id_2]);
     }
     if ($up_flag) {
         $this->get_data('PlayerDetail')->update_player_detail($player_id, array('func_open' => $player_detail['func_open']));
     }
     $cd = $this->get_game('WorldBoss')->get_boss_open_state($player_id);
     if ($cd > 0) {
         $out[0][] = array('operate' => 1, 'func_id' => 1110, 'open' => 1, 'guide' => 0, 'cd' => $cd, 'tip' => $this->get_func_tips($player_id, 1110, $player_detail['func_open']));
     }
     $this->_func_tips = null;
     return $out;
 }