Exemplo n.º 1
0
 /**
  * 获取战斗日志
  * @param $player_id
  * @return array
  */
 protected function get_fight_history($player_id)
 {
     $data = $this->get_data('KFArena')->get_fight_log($player_id);
     if (empty($data)) {
         return array();
     }
     $out = array();
     $i = 0;
     $dw_configs = Cache_CrossArenaLevel::getInstance()->get_config_info();
     foreach ($data as $val) {
         if ($i > 3) {
             break;
         }
         $tmp = array('player_id' => $val['opponent_player_id'], 'name' => $val['opponent_name'], 'fpower' => $val['fpower'], 'win' => $val['result'], 'msg' => array());
         if ($val['result'] == 1 && $val['star'] > 0) {
             #你战胜了xxx获得一颗星
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']));
             $tmp['msg'] = Language_Message::make_message(120126, $params);
         } elseif ($val['result'] == 1 && $val['dw'] > 0) {
             #你战胜了xxxz,晋升至xxx
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']), 1 => array('rep_type' => 7, 'txt' => $dw_configs[$val['dw']]['name']));
             $tmp['msg'] = Language_Message::make_message(120127, $params);
         } elseif ($val['result'] == 1 && $val['dw'] == $this->max_dw && $val['rank'] == 0) {
             #你战胜了xxx,根据传说胜利场数,传说排名不变
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']));
             $tmp['msg'] = Language_Message::make_message(120128, $params);
         } elseif ($val['result'] == 1 && $val['dw'] == $this->max_dw && $val['rank'] > 0) {
             #你战胜了xxx,根据传说胜利场数,传说排名升至xx
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']), 1 => array('rep_type' => 7, 'txt' => "传说{$val['rank']}"));
             $tmp['msg'] = Language_Message::make_message(120129, $params);
         } elseif ($val['result'] == 0 && $val['star'] == 0 && $val['dw'] == 0 && $val['rank'] == 0) {
             #你败给了xxx改段位不掉星
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']));
             $tmp['msg'] = Language_Message::make_message(120130, $params);
         } elseif ($val['result'] == 0 && $val['star'] > 0) {
             #你失败了 失去一颗星
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']));
             $tmp['msg'] = Language_Message::make_message(120131, $params);
         } elseif ($val['result'] == 0 && $val['dw'] > 0 && $val['dw'] < $this->max_dw) {
             #你失败了 降至xx段位
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']), 1 => array('rep_type' => 7, 'txt' => $dw_configs[$val['dw']]['name']));
             $tmp['msg'] = Language_Message::make_message(120132, $params);
         } elseif ($val['result'] == 0 && $val['dw'] == $this->max_dw && $val['rank'] == 0) {
             #你失败 传说排名不变
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']));
             $tmp['msg'] = Language_Message::make_message(120133, $params);
         } elseif ($val['result'] == 0 && $val['dw'] == $this->max_dw && $val['rank'] > 0) {
             #你失败 传说排名降至xx
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']), 1 => array('rep_type' => 7, 'txt' => "传说{$val['rank']}"));
             $tmp['msg'] = Language_Message::make_message(120134, $params);
         }
         if ($tmp) {
             $out[] = $tmp;
             ++$i;
         }
     }
     return $out;
 }
Exemplo n.º 2
0
 /**
  * 获取战斗日志
  * @param $player_id
  * @return array
  */
 protected function get_fight_history($player_id)
 {
     $data = $this->get_data('KFDuel')->get_fight_log($player_id);
     if (empty($data)) {
         return array();
     }
     $out = array();
     $i = 0;
     $dw_configs = Cache_CrossArenaLevel::getInstance()->get_config_info();
     foreach ($data as $val) {
         if ($i > 3) {
             break;
         }
         $tmp = array('win' => $val['result'], 'msg' => array());
         if ($val['result'] == 1) {
             //你的队伍战胜了{0}的队伍,获得了{1}积分
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']), 1 => array('rep_type' => 7, 'txt' => "{$val['score']}"));
             $tmp['msg'] = Language_Message::make_message(6010104, $params);
         } elseif ($val['result'] == 0) {
             //你的队伍输给了{0}的队伍,获得了{1}积分
             $params = array(0 => array('rep_type' => 7, 'txt' => $val['opponent_name']), 1 => array('rep_type' => 7, 'txt' => "{$val['score']}"));
             $tmp['msg'] = Language_Message::make_message(6010105, $params);
         }
         if ($tmp) {
             $out[] = $tmp;
             ++$i;
         }
     }
     return $out;
 }
Exemplo n.º 3
0
 public function change_kfarena($player_id, $score, $score_tale)
 {
     $dw_configs = Cache_CrossArenaLevel::getInstance()->get_config_info();
     $res = $this->get_game('KFArena')->cal_dw($score, $dw_configs);
     $my_update['dw'] = $res['dw'];
     $my_update['dw_lv'] = $res['dw_lv'];
     $my_update['dw_star'] = $res['dw_star'];
     $my_update['score'] = $score;
     $my_update['score_tale'] = $score_tale;
     $result = $this->get_data('KFArena')->set_kf_arena_info($player_id, $my_update);
     if ($result) {
         #存入排行
         $rank_data = array();
         $rank_data['player_id'] = $player_id;
         $rank_data['dw'] = $my_update['dw'];
         $rank_data['dw_lv'] = $my_update['dw_lv'];
         $rank_data['dw_star'] = $my_update['dw_star'];
         $rank_data['score'] = $my_update['score'];
         $rank_data['score_tale'] = $my_update['score_tale'];
         $rank_data['update_time'] = time();
         $this->get_cross('KFArena')->set_kf_arena_rank($player_id, $rank_data);
         //存入排行
     }
     echo "更新成功刷新面板看结果";
 }