1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- /*
- * To change this license header, choose License Headers in Project Properties.
- * To change this template file, choose Tools | Templates
- * and open the template in the editor.
- */
- namespace loyalsoft;
- /**
- * Description of FightProc
- *
- * @author c'y'zhao
- */
- class FightProc {
- /**
- * 逻辑分发
- * 所有的Proc中必须有这样一个方法
- * @param Req $req
- */
- public static function procMain($req) {
- switch ($req->cmd) {
- case CmdCode::cmd_fight_settle: # 6801 战斗结算
- return FightProc::settle();
- case CmdCode::cmd_fight_PassGateTsPrizeReceive: # 6802 章节宝箱的领取
- return FightProc::PassGateTsPrizeReceive();
- default:
- Err(ErrCode::cmd_err);
- }
- }
-
- public static function FightSettle() {
-
- }
-
- /**
- * 章节宝箱的领取
- * @return type
- */
- public static function PassGateTsPrizeReceive() {
- list($gateId,$index) = req()->paras;
-
- $gateMo = GameConfig::gate_getItem($gateId);
- my_Assert($gateMo!=null, ErrCode::err_const_no);
-
- my_Assert(StlUtil::dictHasProperty(ctx()->gates->GateList, $gateId), ErrCode::user_Gate_NoUserGateInfo);
- $gateInfo = ctx()->gates->GateList->$gateId;
-
- $tag = false;
- $prize = "";
- $mask =0;
- switch ($index) {
- case 1:
- $ts = $gateMo->first_ts1 *60;
- if($ts >= $gateInfo->MaxSeconds){
- $tag = true;
- }
- $mask=1;
- $prize = $gateMo->first_reward1;
- break;
- case 2:
- $ts = $gateMo->first_ts2*60;
- if($ts >= $gateInfo->MaxSeconds){
- $tag = true;
- }
- $mask = 2;
- $prize = $gateMo->first_reward2;
- break;
- case 3:
- if($gateInfo->pass > 0){
- $tag = true;
- }
- $mask =3;
- $prize = $gateMo->first_reward3;
- break;
- default:
- break;
- }
-
- if($tag){
- StoreProc::AddMultiItemInStore($prize);
- $gateInfo->FirstReward = $mask;
- }
- ctx()->gates->GateList->$gateId=$gateInfo;
- UserProc::updateUserInfo();
- $ret = array(
- 'gate' => $gateInfo,
- 'store' => ctx()->store,
- );
- return Resp::ok($ret);
- }
-
- }
|