当前位置: 首页>>代码示例>>PHP>>正文


PHP Protocol::get_protocol方法代码示例

本文整理汇总了PHP中Protocol::get_protocol方法的典型用法代码示例。如果您正苦于以下问题:PHP Protocol::get_protocol方法的具体用法?PHP Protocol::get_protocol怎么用?PHP Protocol::get_protocol使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Protocol的用法示例。


在下文中一共展示了Protocol::get_protocol方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: router

 public function router($cmd0, $cmd1, $cmd2, $player_id, $arr_param)
 {
     global $arrParam, $arrAuthUser, $logHandler;
     $arrAuthUser['player_id'] = $player_id;
     $arrParam = $arr_param;
     $class = 'S2P_' . $cmd1;
     $include_file = ACTION_PATH . "/S2P/S2P_{$cmd1}.php";
     if (is_file($include_file)) {
         require $include_file;
         try {
             //调用对应指令函数
             $obj = new $class();
             $exec_cmd2 = 'CMD2_' . $cmd2;
             if (ECONOMY_LOG_SWITCH === TRUE) {
                 $logHandler['logger'] = new Com_Logger($cmd0, $cmd1, $cmd2, $player_id);
             }
             call_user_func_array(array($obj, $exec_cmd2), array());
             $protocols = Protocol::get_protocol();
             Protocol::out();
             Statistic::report($cmd0, $cmd1, $cmd2, $arrAuthUser, $arrParam, 1, 'exec fun success', $protocols);
             if (ECONOMY_LOG_SWITCH === TRUE) {
                 $logHandler['logger']->flush_log();
             }
             exit;
         } catch (Exception $e) {
             //有异常
             $msg = json_decode($e->getMessage(), true);
             $error = "Exception: " . $e->getFile() . " line:" . $e->getLine() . " error code " . $msg['error']['code'];
             Statistic::report($cmd0, $cmd1, $cmd2, $arrAuthUser, $arrParam, 0, $error);
             Protocol::input($player_id, 8, 7, 742, array(0 => array($msg['error'])));
             Protocol::out();
             exit;
         }
     }
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:35,代码来源:S2PRouter.php

示例2: decisions

 /**
  * decissions shows the decissions of this or all protocols
  * 
  * @param int $pid entry-id for protocol
  * @return string html of the decissions page
  */
 private function decisions($pid)
 {
     // pagecaption
     $this->tpl->assign('pagecaption', parent::lang('class.ProtocolView#page#caption#decisions'));
     // check rights
     if (Rights::check_rights($pid, 'protocol', true) || $pid == false) {
         // prepare template
         $sD = new JudoIntranetSmarty();
         // check pid all or single
         if ($pid === false) {
             // get protocol ids
             $pids = Protocol::return_protocols();
             // create protocol objects to sort
             $protocols = array();
             foreach ($pids as $pid) {
                 $protocols[] = new Protocol($pid);
             }
             // sort array by protocols date
             usort($protocols, array($this, 'callback_compare_protocols'));
             // walk through ids
             $counter = 0;
             foreach ($protocols as $protocol) {
                 // assign data
                 $data[$counter] = array('date' => $protocol->get_date('d.m.Y'), 'type' => $protocol->get_type(), 'location' => $protocol->get_location(), 'decisions' => $this->parseHtml($protocol->get_protocol(), '<p class="tmceDecision">|</p>'));
                 // check if protocol has decisions
                 if (count($data[$counter]['decisions']) == 0) {
                     unset($data[$counter]);
                 }
                 $data = array_merge($data);
                 // add to template
                 $sD->assign('data', $data);
                 // increment counter
                 $counter++;
             }
         } else {
             // get protocol object
             $protocol = new Protocol($pid);
             // assign data
             $data[] = array('date' => $protocol->get_date('d.m.Y'), 'type' => $protocol->get_type(), 'location' => $protocol->get_location(), 'decisions' => $this->parseHtml($protocol->get_protocol(), '<p class="tmceDecision">|</p>'));
             // add to template
             $sD->assign('data', $data);
         }
         // return
         return $sD->fetch('smarty.protocol.showdecisions.tpl');
     } else {
         // error
         $errno = $GLOBALS['Error']->error_raised('NotAuthorized', 'entry:' . $this->get('id'), $this->get('id'));
         $GLOBALS['Error']->handle_error($errno);
         return $GLOBALS['Error']->to_html($errno);
     }
 }
开发者ID:BackupTheBerlios,项目名称:judointranet,代码行数:57,代码来源:class.ProtocolView.php

示例3: finish_challenge_battle


//.........这里部分代码省略.........
                 }
             }
         }
         for ($i = 1; $i <= $this->challenge_reward_buff_stint; $i++) {
             if ($reward_buff_info['buff' . $i . '_offset'] == $reward_buff_offset) {
                 $reward_buff_info['buff' . $i . '_offset'] = 0;
                 $reward_buff_info['buff' . $i . '_type'] = 0;
                 break;
             }
         }
         $re = $this->get_data('Challenge')->update_challenge_reward_buff($reward_buff_info);
         $this->write_check($re, 3010923);
     }
     # 更新连胜连败信息
     $update_fields = array('challenge_cont_win' => $player_info['challenge_cont_win'], 'challenge_cont_lose' => $player_info['challenge_cont_lose']);
     $re = $this->get_data('Player')->update_player_info($player_id, $update_fields);
     $this->write_check($re, 3010932);
     $item_keys = Cache_Currency::getInstance()->get_key();
     # 统一发放奖励
     $reward = array();
     $this->get_game('Reward')->gen_reward_array($reward_detail_battle_correct, $reward);
     $this->get_game('Reward')->gen_reward_array($reward_detail_buff, $reward);
     $this->get_game('Reward')->gen_reward_array($reward_detail_monster, $reward);
     if (!empty($reward)) {
         if ($exception_flag == 1) {
             # 异常情况下发邮件
             # 生成奖励邮件附件信息
             $attachment = array();
             $reward_detail = $this->get_game('Reward')->get_reward_detail_by_reward($reward);
             foreach ($reward_detail as $item_idx => $item_num) {
                 $attachment[] = array("prop_id" => $item_idx, "prop_num" => $item_num);
             }
             # 邮件发送
             $phrase_id = $battle_result ? 14 : 15;
             $phrase_config = Cache_FuncPhraseConfig::getInstance()->get_phrase_config_info($phrase_id);
             $re = $this->get_game('Mail')->async_trigger_mail($player_id, $phrase_config['title'], $phrase_config['content'], $attachment, $phrase_config['sender'], 1, 429);
         } else {
             $re = $this->get_game('Reward')->send_reward($player_id, $reward, array('cmd_id' => '429'));
             $this->write_check_strict($re, 3010943);
         }
     }
     # 更新挑战日志
     $battle_log = array('battle_seq' => $battle_seq, 'player_id' => $player_id, 'tgt_player_id' => $tgt_player_id, 'battle_status' => 1, 'battle_result' => $battle_result);
     $re = $this->get_data('Challenge')->update_challenge_battle_log($battle_log);
     $this->write_check($re, 3010955);
     # 记录挑战MYSQL日志
     $player_rank_after = $player_rank_info['rank'];
     # 发起方战后排名
     $challenge_log_info = array('player_id' => $player_id, 'tgt_player_id' => $tgt_player_id, 'reg_date' => $this->current_time, 'battle_seq' => $battle_seq, 'player_rank_before' => $player_rank_before, 'player_rank_after' => $player_rank_after, 'player_fake_rank_before' => $player_frank_before, 'player_fake_rank_after' => $player_frank_after, 'tgt_player_rank_before' => $tgt_player_rank_before, 'fight_with_monster' => $fight_with_monster, 'fight_with_dummy' => $fight_with_dummy, 'challenge_status_after' => $player_rank_info['challenge_status'], 'status' => $battle_result);
     $re = $this->get_data('Challenge')->record_challenge_log($challenge_log_info);
     $this->write_check($re, 3010975);
     # 系统公告与广播信息只对应挑战发起方,包括获取天梯第一名和天梯连胜
     $replace_info1 = array(array('rep_type' => 0, 'rep_val' => $player_id), array('rep_type' => 1, 'rep_val' => 1050), array('rep_type' => 0, 'rep_val' => $tgt_player_id));
     $replace_info2 = array(array('rep_type' => 0, 'rep_val' => $player_id), array('rep_type' => 1, 'rep_val' => 1050), array('rep_type' => 7, 'txt' => $player_info['challenge_cont_win']));
     # 挑战发起者胜利 && 挑战发起者战前与战后排名不一致[因为胜利,所以排名一定是提高] && 挑战发起者战后排名是第一名
     if ($battle_result && $player_rank_before != $player_rank_info['rank'] && $player_rank_info['rank'] == 1) {
         $this->get_game('SystemNotice')->push_sys_notice($player_id, 1050, 2, $replace_info1, $player_rank_info['rank']);
         # 排名第一
     }
     $this->get_game('SystemNotice')->push_sys_notice($player_id, 1050, 1, $replace_info2, $player_info['challenge_cont_win']);
     # 连胜
     $this->commit();
     # 该方法会自动推送843协议告知前端显示奖励信息,会调用prop_806协议通知道具变更,调用p2c_part_update通知人物信息变更
     $this->get_game('Reward')->add_reward_log();
     #if ($exception_flag == 0) { # 战斗超时时,也是走异常结算逻辑,但却需要推送结算协议给前端
     $reward_string = $this->get_game('Reward')->get_reward_string_by_reward_detail($reward_detail_battle_correct);
     # 挑战奖励通用字符串
     # 合并$reward_detail_monster和$reward_detail_buff
     $extra_reward_array = array();
     if (!empty($reward_detail_monster)) {
         foreach ($reward_detail_monster as $item_idx => $item_num) {
             $extra_reward_array[$item_idx] += $item_num;
         }
     }
     if (!empty($reward_detail_buff)) {
         foreach ($reward_detail_buff as $item_idx => $item_num) {
             $extra_reward_array[$item_idx] += $item_num;
         }
     }
     $extra_string = $this->get_game('Reward')->get_reward_string_by_reward_detail($extra_reward_array);
     $player_rank_before_display = $this->get_display_rank($player_rank_before, $player_cstatus_before, $player_frank_before);
     # 发起方战前显示排名
     $player_rank_after_display = $this->get_display_rank($player_rank_info['rank'], $player_rank_info['challenge_status'], $player_rank_info['fake_rank']);
     # 发起方战后显示排名
     $data = array('result' => $battle_result, 'reward' => $reward_string, 'extra_reward' => $extra_string, 'rank' => $player_rank_after_display, 'raw_rank' => $player_rank_before_display);
     # 推送FLASH结果与奖励信息
     Protocol::input($player_id, 8, 12, 1203, $data);
     #}
     # 日常任务埋点
     $this->get_game('TaskTrigger')->async_trigger_task($player_id, 102, 102, 1);
     #引导任务
     $this->get_game('TaskTrigger')->async_trigger_guide_task($player_id, 7, 1);
     # 记录行为
     Com_Log::write('xgame.challenge', "{$player_id}\t" . "finish_challenge_battle\tend\t" . "{$battle_seq}\t" . "{$winner_player_id}\t" . "{$loser_player_id}\t");
     #Protocol::input($player_id,7,4,429,array(null)); # C++不需要下行
     $protocols = Protocol::get_protocol();
     Protocol::out(GATEWAY_IP);
     # 异步处理时,推送协议需要手动调用out执行
     return null;
 }
开发者ID:bluefan,项目名称:phpsource,代码行数:101,代码来源:Challenge.php


注:本文中的Protocol::get_protocol方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。