|
@@ -14,6 +14,7 @@ namespace loyalsoft;
|
|
|
* @author c'y'zhao
|
|
|
*/
|
|
|
class FightProc {
|
|
|
+
|
|
|
/**
|
|
|
* 逻辑分发
|
|
|
* 所有的Proc中必须有这样一个方法
|
|
@@ -24,10 +25,10 @@ class FightProc {
|
|
|
case CmdCode::cmd_fight_settle: # 6801 战斗结算
|
|
|
return FightProc::Settle();
|
|
|
case CmdCode::cmd_fight_PassGateTsPrizeReceive: # 6802 章节宝箱的领取
|
|
|
- return FightProc::PassGateTsPrizeReceive();
|
|
|
+ return FightProc::PassGateTsPrizeReceive();
|
|
|
case CmdCode::cmd_fight_selectGate: # 6803 关卡选择
|
|
|
return FightProc::SelectGate();
|
|
|
- case CmdCode::cmd_fight_gateChallengePriceReviced: # 6804
|
|
|
+ case CmdCode::cmd_fight_gateChallengePriceReviced: # 6804
|
|
|
return FightProc::GateChallengePriceReviced();
|
|
|
case CmdCode::cmd_fight_evolveUnlock: # 6805进化解锁
|
|
|
return FightProc::EvolveUnlock();
|
|
@@ -39,6 +40,7 @@ class FightProc {
|
|
|
Err(ErrCode::cmd_err);
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 6807 巡逻奖励领取
|
|
|
* @return type
|
|
@@ -88,71 +90,71 @@ class FightProc {
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function EvolveUnlock() {
|
|
|
- list($type,$id) = req()->paras;
|
|
|
-
|
|
|
- if($type == 1){
|
|
|
+ list($type, $id) = req()->paras;
|
|
|
+
|
|
|
+ if ($type == 1) {
|
|
|
$mo = GameConfig::evolve_getItem($id);
|
|
|
- my_Assert($mo!=null, ErrCode::err_const_no);
|
|
|
-
|
|
|
- my_Assert(ctx()->baseInfo->gold>=$mo->needGold_unlock, ErrCode::notenough_gold_msg);
|
|
|
- ctx()->baseInfo->Consume_Gold($mo->needGold_unlock);
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
+
|
|
|
+ my_Assert(ctx()->baseInfo->gold >= $mo->needGold_unlock, ErrCode::notenough_gold_msg);
|
|
|
+ ctx()->baseInfo->Consume_Gold($mo->needGold_unlock);
|
|
|
} else {
|
|
|
- $mo =GameConfig::evolveSpecific_getItem($id);
|
|
|
- my_Assert($mo!=null, ErrCode::err_const_no);
|
|
|
- if($mo->specificEvolveCost != null){
|
|
|
+ $mo = GameConfig::evolveSpecific_getItem($id);
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
+ if ($mo->specificEvolveCost != null) {
|
|
|
$cost = explode(',', $mo->specificEvolveCost);
|
|
|
$costId = $cost[0];
|
|
|
$costNum = $cost[1];
|
|
|
- my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $costId) && ctx()->store->items->$costId >= $costNum , ErrCode::notenough_item);
|
|
|
+ my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $costId) && ctx()->store->items->$costId >= $costNum, ErrCode::notenough_item);
|
|
|
}
|
|
|
// my_Assert(ctx()->baseInfo->gold>=$mo->needGold_unlock, ErrCode::notenough_gold_msg);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
ctx()->gates->evolveUnlockRecord[] = $id;
|
|
|
-
|
|
|
+
|
|
|
UserProc::updateUserInfo();
|
|
|
- $ret = array(
|
|
|
- 'store' => ctx()->store,
|
|
|
- 'gates' => ctx()->gates,
|
|
|
- );
|
|
|
+ $ret = array(
|
|
|
+ 'store' => ctx()->store,
|
|
|
+ 'gates' => ctx()->gates,
|
|
|
+ );
|
|
|
return Resp::ok($ret);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 挑战奖励领取
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function GateChallengePriceReviced() {
|
|
|
list($zhangjieId, $gateId) = req()->paras;
|
|
|
-
|
|
|
+
|
|
|
$mo = GameConfig::gate_challenge_getItem($zhangjieId);
|
|
|
- my_Assert($mo!=null, ErrCode::err_const_no);
|
|
|
-
|
|
|
+ my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
+
|
|
|
// $list = explode(',', $mo->gates);
|
|
|
// my_Assert(in_array($gateId,$list), ErrCode::err_const_no);
|
|
|
-
|
|
|
+
|
|
|
$gateMo = GameConfig::gate_getItem($gateId);
|
|
|
- my_Assert($gateMo!=null, ErrCode::err_const_no);
|
|
|
-
|
|
|
- if(!StlUtil::dictHasProperty(ctx()->gates->GatesChallengeRecord, $zhangjieId)){
|
|
|
+ my_Assert($gateMo != null, ErrCode::err_const_no);
|
|
|
+
|
|
|
+ if (!StlUtil::dictHasProperty(ctx()->gates->GatesChallengeRecord, $zhangjieId)) {
|
|
|
ctx()->gates->GatesChallengeRecord->$zhangjieId = array();
|
|
|
}
|
|
|
-
|
|
|
- my_Assert(!in_array($gateId,ctx()->gates->GatesChallengeRecord->$zhangjieId), ErrCode::user_Gate_GatePriceHasReceive);
|
|
|
+
|
|
|
+ my_Assert(!in_array($gateId, ctx()->gates->GatesChallengeRecord->$zhangjieId), ErrCode::user_Gate_GatePriceHasReceive);
|
|
|
ctx()->gates->GatesChallengeRecord->$zhangjieId[] = $gateId;
|
|
|
-
|
|
|
+
|
|
|
StoreProc::AddMultiItemInStore($gateMo->reward_win);
|
|
|
-
|
|
|
+
|
|
|
ctx()->gates->CurrentGateId = $gateId;
|
|
|
-
|
|
|
+
|
|
|
UserProc::updateUserInfo();
|
|
|
- $ret = array(
|
|
|
- 'store' => ctx()->store,
|
|
|
- 'gates' => ctx()->gates,
|
|
|
- );
|
|
|
+ $ret = array(
|
|
|
+ 'store' => ctx()->store,
|
|
|
+ 'gates' => ctx()->gates,
|
|
|
+ );
|
|
|
return Resp::ok($ret);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 关卡选择
|
|
@@ -160,118 +162,119 @@ class FightProc {
|
|
|
*/
|
|
|
public static function SelectGate() {
|
|
|
list($gateId) = req()->paras;
|
|
|
-
|
|
|
+
|
|
|
ctx()->gates->CurrentGateId = $gateId;
|
|
|
-
|
|
|
+
|
|
|
UserProc::updateUserInfo();
|
|
|
- $ret = array(
|
|
|
- 'gates' => ctx()->gates,
|
|
|
- );
|
|
|
+ $ret = array(
|
|
|
+ 'gates' => ctx()->gates,
|
|
|
+ );
|
|
|
return Resp::ok($ret);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 关卡战斗结算
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function Settle() {
|
|
|
- list($resultType, $gateId,$gold,$curTs) = req()->paras;
|
|
|
-
|
|
|
+ list($resultType, $gateId, $gold, $curTs, $pickups) = req()->paras;
|
|
|
+
|
|
|
$gateMo = GameConfig::gate_getItem($gateId);
|
|
|
- my_Assert($gateMo!=null, ErrCode::err_const_no);
|
|
|
+ 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;
|
|
|
$ts = $gateInfo->MaxSeconds;
|
|
|
- if($curTs >= $ts){
|
|
|
+ if ($curTs >= $ts) {
|
|
|
$gateInfo->MaxSeconds = $curTs;
|
|
|
}
|
|
|
-
|
|
|
- if($resultType){
|
|
|
- if(ctx()->gates->GateList->$gateId->pass == 0){
|
|
|
+
|
|
|
+ if ($resultType) { # 胜利
|
|
|
+ if (ctx()->gates->GateList->$gateId->pass == 0) {
|
|
|
ctx()->gates->GateList->$gateId->pass = 1;
|
|
|
}
|
|
|
- StoreProc::AddMultiItemInStore($gateMo->reward_win);
|
|
|
- $newGateId = $gateId+1;
|
|
|
- if(!StlUtil::dictHasProperty(ctx()->gates->GateList, $newGateId)){
|
|
|
+ StoreProc::AddMultiItemInStore($gateMo->reward_win);
|
|
|
+ $newGateId = $gateId + 1;
|
|
|
+ if (!StlUtil::dictHasProperty(ctx()->gates->GateList, $newGateId)) {
|
|
|
ctx()->gates->CurrentGateId = $newGateId;
|
|
|
ctx()->gates->UnlockedGatesMaxId = $newGateId;
|
|
|
$gate = new Ins_GateInfo();
|
|
|
$gate->GateId = $newGateId;
|
|
|
ctx()->gates->GateList->$newGateId = $gate;
|
|
|
}
|
|
|
-
|
|
|
- } else {
|
|
|
+ } else { # 失败
|
|
|
StoreProc::AddMultiItemInStore($gateMo->reward_fail);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
+ StoreProc::AddMultiItemInStore($pickups); # 战场拾取道具
|
|
|
ctx()->baseInfo->Add_Gold($gold);
|
|
|
//ctx()->baseInfo->Add_Exp($exp);
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
UserProc::updateUserInfo();
|
|
|
- $ret = array(
|
|
|
- 'gates' => ctx()->gates,
|
|
|
+ $ret = array(
|
|
|
+ 'gates' => ctx()->gates,
|
|
|
'store' => ctx()->store,
|
|
|
- );
|
|
|
+ );
|
|
|
return Resp::ok($ret);
|
|
|
|
|
|
}
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 章节宝箱的领取
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function PassGateTsPrizeReceive() {
|
|
|
- list($gateId,$index) = req()->paras;
|
|
|
-
|
|
|
+ list($gateId, $index) = req()->paras;
|
|
|
+
|
|
|
$gateMo = GameConfig::gate_getItem($gateId);
|
|
|
- my_Assert($gateMo!=null, ErrCode::err_const_no);
|
|
|
-
|
|
|
+ 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;
|
|
|
+ $mask = 0;
|
|
|
switch ($index) {
|
|
|
case 1:
|
|
|
- $ts = $gateMo->first_ts1 *60;
|
|
|
- if($ts >= $gateInfo->MaxSeconds){
|
|
|
+ $ts = $gateMo->first_ts1 * 60;
|
|
|
+ if ($ts >= $gateInfo->MaxSeconds) {
|
|
|
$tag = true;
|
|
|
}
|
|
|
- $mask=1;
|
|
|
+ $mask = 1;
|
|
|
$prize = $gateMo->first_reward1;
|
|
|
break;
|
|
|
case 2:
|
|
|
- $ts = $gateMo->first_ts2*60;
|
|
|
- if($ts >= $gateInfo->MaxSeconds){
|
|
|
+ $ts = $gateMo->first_ts2 * 60;
|
|
|
+ if ($ts >= $gateInfo->MaxSeconds) {
|
|
|
$tag = true;
|
|
|
}
|
|
|
$mask = 2;
|
|
|
$prize = $gateMo->first_reward2;
|
|
|
break;
|
|
|
case 3:
|
|
|
- if($gateInfo->pass > 0){
|
|
|
+ if ($gateInfo->pass > 0) {
|
|
|
$tag = true;
|
|
|
- }
|
|
|
- $mask =3;
|
|
|
+ }
|
|
|
+ $mask = 3;
|
|
|
$prize = $gateMo->first_reward3;
|
|
|
break;
|
|
|
default:
|
|
|
break;
|
|
|
}
|
|
|
-
|
|
|
- if($tag){
|
|
|
- StoreProc::AddMultiItemInStore($prize);
|
|
|
- $gateInfo->FirstReward = $mask;
|
|
|
+
|
|
|
+ if ($tag) {
|
|
|
+ StoreProc::AddMultiItemInStore($prize);
|
|
|
+ $gateInfo->FirstReward = $mask;
|
|
|
}
|
|
|
- ctx()->gates->GateList->$gateId=$gateInfo;
|
|
|
+ ctx()->gates->GateList->$gateId = $gateInfo;
|
|
|
|
|
|
UserProc::updateUserInfo();
|
|
|
- $ret = array(
|
|
|
- 'gates' => ctx()->gates,
|
|
|
+ $ret = array(
|
|
|
+ 'gates' => ctx()->gates,
|
|
|
'store' => ctx()->store,
|
|
|
- );
|
|
|
+ );
|
|
|
return Resp::ok($ret);
|
|
|
}
|
|
|
|