|
@@ -1,4 +1,5 @@
|
|
<?php
|
|
<?php
|
|
|
|
+
|
|
namespace loyalsoft;
|
|
namespace loyalsoft;
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -14,29 +15,33 @@ class FightProc {
|
|
*/
|
|
*/
|
|
public static function procMain($req) {
|
|
public static function procMain($req) {
|
|
switch ($req->cmd) {
|
|
switch ($req->cmd) {
|
|
- case CmdCode::cmd_fight_settle: # 6801 战斗结算
|
|
|
|
|
|
+ case CmdCode::fight_settle: # 6801 主线战斗结算
|
|
return FightProc::Settle();
|
|
return FightProc::Settle();
|
|
- case CmdCode::cmd_fight_PassGateTsPrizeReceive: # 6802 章节宝箱的领取
|
|
|
|
|
|
+ case CmdCode::fight_PassGateTsPrizeReceive: # 6802 章节宝箱的领取
|
|
return FightProc::PassGateTsPrizeReceive();
|
|
return FightProc::PassGateTsPrizeReceive();
|
|
- case CmdCode::cmd_fight_selectGate: # 6803 关卡选择
|
|
|
|
|
|
+ case CmdCode::fight_selectGate: # 6803 主线剧情关卡选择
|
|
return FightProc::SelectGate();
|
|
return FightProc::SelectGate();
|
|
- case CmdCode::cmd_fight_gateChallengePriceReviced: # 6804 挑战奖励
|
|
|
|
|
|
+ case CmdCode::fight_gateChallengePriceReviced: # 6804 挑战关卡: 领取奖励
|
|
return FightProc::GateChallengePriceReviced();
|
|
return FightProc::GateChallengePriceReviced();
|
|
- case CmdCode::cmd_fight_evolveUnlock: # 6805 进化解锁
|
|
|
|
- return FightProc::EvolveUnlock();
|
|
|
|
- case CmdCode::cmd_fight_plotSav: # 6806 剧情回存
|
|
|
|
|
|
+ case CmdCode::fihgt_towerStart: # 6805 挑战关卡: 开始挑战
|
|
|
|
+ return FightProc::ChallengeGateStartFight();
|
|
|
|
+ case CmdCode::fight_plotSav: # 6806 主线剧情(已播放)回存
|
|
return FightProc::PlotSav();
|
|
return FightProc::PlotSav();
|
|
- case CmdCode::cmd_fight_sweep: #6807 扫荡
|
|
|
|
|
|
+ case CmdCode::fight_sweep: # 6807 主线扫荡
|
|
return FightProc::FightSweep();
|
|
return FightProc::FightSweep();
|
|
- case CmdCode::fight_startFight: # 6808 开始挑战
|
|
|
|
|
|
+ case CmdCode::fight_startFight: # 6808 主线剧情关卡开始挑战
|
|
return self::StartFight();
|
|
return self::StartFight();
|
|
default:
|
|
default:
|
|
Err(ErrCode::cmd_err);
|
|
Err(ErrCode::cmd_err);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 6807 扫荡
|
|
|
|
+ * @return type
|
|
|
|
+ */
|
|
public static function FightSweep() {
|
|
public static function FightSweep() {
|
|
- //list($gateId) = req()->paras;
|
|
|
|
|
|
+ //list($gateId) = req()->paras;
|
|
my_Assert(ctx()->gates->UnlockedGatesMaxId != 0, ErrCode::user_Gate_NoSweep);
|
|
my_Assert(ctx()->gates->UnlockedGatesMaxId != 0, ErrCode::user_Gate_NoSweep);
|
|
$mo = GameConfig::gate_getItem(ctx()->gates->UnlockedGatesMaxId);
|
|
$mo = GameConfig::gate_getItem(ctx()->gates->UnlockedGatesMaxId);
|
|
$costTili = glc()->sweep_cost_tili;
|
|
$costTili = glc()->sweep_cost_tili;
|
|
@@ -47,79 +52,79 @@ class FightProc {
|
|
ctx()->baseInfo->Consume_tili($costTili);
|
|
ctx()->baseInfo->Consume_tili($costTili);
|
|
$prizeArr = array();
|
|
$prizeArr = array();
|
|
$prizeArr[] = $mo->reward_win;
|
|
$prizeArr[] = $mo->reward_win;
|
|
- if($mo->sweep_gold != null){
|
|
|
|
|
|
+ if ($mo->sweep_gold != null) {
|
|
$goodsStr = self::sweepRandReward($mo->sweep_gold);
|
|
$goodsStr = self::sweepRandReward($mo->sweep_gold);
|
|
$prizeArr[] = $goodsStr;
|
|
$prizeArr[] = $goodsStr;
|
|
StoreProc::AddMultiItemInStore($goodsStr);
|
|
StoreProc::AddMultiItemInStore($goodsStr);
|
|
}
|
|
}
|
|
-
|
|
|
|
- if($mo->sweep_tuzhi != null){
|
|
|
|
|
|
+
|
|
|
|
+ if ($mo->sweep_tuzhi != null) {
|
|
$goodsStr = self::sweepRandReward($mo->sweep_tuzhi);
|
|
$goodsStr = self::sweepRandReward($mo->sweep_tuzhi);
|
|
$prizeArr[] = $goodsStr;
|
|
$prizeArr[] = $goodsStr;
|
|
StoreProc::AddMultiItemInStore($goodsStr);
|
|
StoreProc::AddMultiItemInStore($goodsStr);
|
|
}
|
|
}
|
|
-
|
|
|
|
- if($mo->sweep_gem != null){
|
|
|
|
|
|
+
|
|
|
|
+ if ($mo->sweep_gem != null) {
|
|
$goodsStr = self::sweepRandReward($mo->sweep_gem);
|
|
$goodsStr = self::sweepRandReward($mo->sweep_gem);
|
|
$list = explode(',', $goodsStr);
|
|
$list = explode(',', $goodsStr);
|
|
- $posId = rand(1,6);
|
|
|
|
|
|
+ $posId = rand(1, 6);
|
|
$qual = $list[0];
|
|
$qual = $list[0];
|
|
$dic = GameConfig::gem();
|
|
$dic = GameConfig::gem();
|
|
-
|
|
|
|
|
|
+
|
|
foreach ($dic as $key => $gemMo) {
|
|
foreach ($dic as $key => $gemMo) {
|
|
- if($gemMo->qual == $qual && $gemMo->position == $posId){
|
|
|
|
- $prizeArr[] = $gemMo->typeId.','.$list[1];
|
|
|
|
- StoreProc::PutGemInStore($gemMo->typeId, $list[1]);
|
|
|
|
|
|
+ if ($gemMo->qual == $qual && $gemMo->position == $posId) {
|
|
|
|
+ $prizeArr[] = $gemMo->typeId . ',' . $list[1];
|
|
|
|
+ StoreProc::PutGemInStore($gemMo->typeId, $list[1]);
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+ }
|
|
}
|
|
}
|
|
-
|
|
|
|
- if($mo->sweep_qiling != null){
|
|
|
|
|
|
+
|
|
|
|
+ if ($mo->sweep_qiling != null) {
|
|
$goodsStr = self::sweepRandReward($mo->sweep_qiling);
|
|
$goodsStr = self::sweepRandReward($mo->sweep_qiling);
|
|
$prizeArr[] = $goodsStr;
|
|
$prizeArr[] = $goodsStr;
|
|
StoreProc::AddMultiItemInStore($goodsStr);
|
|
StoreProc::AddMultiItemInStore($goodsStr);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
UserProc::updateUserInfo();
|
|
UserProc::updateUserInfo();
|
|
$ret = array(
|
|
$ret = array(
|
|
'tili' => ctx()->baseInfo->tili,
|
|
'tili' => ctx()->baseInfo->tili,
|
|
- 'fightSweepNum'=>ctx()->gates->fightSweepNum,
|
|
|
|
- 'prizeArr'=> $prizeArr,
|
|
|
|
|
|
+ 'fightSweepNum' => ctx()->gates->fightSweepNum,
|
|
|
|
+ 'prizeArr' => $prizeArr,
|
|
'store' => ctx()->store,
|
|
'store' => ctx()->store,
|
|
);
|
|
);
|
|
return Resp::ok($ret);
|
|
return Resp::ok($ret);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
static function sweepRandReward($rewardStr) {
|
|
static function sweepRandReward($rewardStr) {
|
|
$ctxArr = explode(';', $rewardStr);
|
|
$ctxArr = explode(';', $rewardStr);
|
|
$numArr = explode('-', $ctxArr[0]);
|
|
$numArr = explode('-', $ctxArr[0]);
|
|
- $num = rand($numArr[0],$numArr[1]);
|
|
|
|
-
|
|
|
|
- $randNum = rand(1,100);
|
|
|
|
|
|
+ $num = rand($numArr[0], $numArr[1]);
|
|
|
|
+
|
|
|
|
+ $randNum = rand(1, 100);
|
|
$start = 0;
|
|
$start = 0;
|
|
$end = 0;
|
|
$end = 0;
|
|
-
|
|
|
|
|
|
+
|
|
$res = "";
|
|
$res = "";
|
|
- $itemArr = explode(',', $ctxArr[1]);
|
|
|
|
|
|
+ $itemArr = explode(',', $ctxArr[1]);
|
|
foreach ($itemArr as $str) {
|
|
foreach ($itemArr as $str) {
|
|
$arr = explode(':', $str);
|
|
$arr = explode(':', $str);
|
|
- $itemId = $arr[1];
|
|
|
|
|
|
+ $itemId = $arr[1];
|
|
$per = $arr[2];
|
|
$per = $arr[2];
|
|
-
|
|
|
|
|
|
+
|
|
$end += $per;
|
|
$end += $per;
|
|
- if($randNum >= $start && $randNum < $end){
|
|
|
|
|
|
+ if ($randNum >= $start && $randNum < $end) {
|
|
$res = $itemId;
|
|
$res = $itemId;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
- $start = $end;
|
|
|
|
|
|
+ $start = $end;
|
|
}
|
|
}
|
|
-
|
|
|
|
- return $res.','.$num;
|
|
|
|
|
|
+
|
|
|
|
+ return $res . ',' . $num;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 6808 开始挑战 (扣除体力)
|
|
|
|
|
|
+ * 6808 主线关卡: 开始挑战 (扣除体力)
|
|
*/
|
|
*/
|
|
private static function StartFight() {
|
|
private static function StartFight() {
|
|
list($gateId) = req()->paras;
|
|
list($gateId) = req()->paras;
|
|
@@ -131,7 +136,7 @@ class FightProc {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 6807 巡逻奖励领取 废弃
|
|
|
|
|
|
+ * [废弃] 6807 巡逻奖励领取
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
public static function XunluoPrizeReceived() {
|
|
public static function XunluoPrizeReceived() {
|
|
@@ -294,7 +299,7 @@ class FightProc {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 剧情回存
|
|
|
|
|
|
+ * 6806 剧情回存
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
public static function PlotSav() {
|
|
public static function PlotSav() {
|
|
@@ -311,40 +316,12 @@ class FightProc {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 6805 进化解锁
|
|
|
|
|
|
+ * 6805 挑战关卡: 开始挑战(扣除次数)
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
- public static function EvolveUnlock() {
|
|
|
|
|
|
+ public static function ChallengeGateStartFight() {
|
|
list($type, $id) = req()->paras;
|
|
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);
|
|
|
|
- ctx()->gates->evolveMaxId_left = $id;
|
|
|
|
-
|
|
|
|
- } else {
|
|
|
|
- $dic = GameConfig::evolve();
|
|
|
|
- foreach ($dic as $key => $value) {
|
|
|
|
- if ($value->specificEvolveId == $id) {
|
|
|
|
- $mo = $value;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- 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);
|
|
|
|
- }
|
|
|
|
- ctx()->gates->evolveMaxId_right = $id;
|
|
|
|
-// my_Assert(ctx()->baseInfo->gold>=$mo->needGold_unlock, ErrCode::notenough_gold_msg);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
-
|
|
|
|
UserProc::updateUserInfo();
|
|
UserProc::updateUserInfo();
|
|
$ret = array(
|
|
$ret = array(
|
|
'store' => ctx()->store,
|
|
'store' => ctx()->store,
|
|
@@ -354,7 +331,7 @@ class FightProc {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 6804 挑战奖励领取
|
|
|
|
|
|
+ * 6804 挑战关卡: 奖励领取
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
public static function GateChallengePriceReviced() {
|
|
public static function GateChallengePriceReviced() {
|
|
@@ -385,7 +362,7 @@ class FightProc {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 关卡选择
|
|
|
|
|
|
+ * 6803 关卡选择
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
public static function SelectGate() {
|
|
public static function SelectGate() {
|
|
@@ -401,63 +378,7 @@ class FightProc {
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * [6801]关卡战斗结算
|
|
|
|
- * @return type
|
|
|
|
- */
|
|
|
|
- public static function Settle() {
|
|
|
|
- list($resultType, $gateId, $gold, $curTs, $pickups) = 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;
|
|
|
|
- $ts = $gateInfo->MaxSeconds;
|
|
|
|
- if ($curTs >= $ts) {
|
|
|
|
- $gateInfo->MaxSeconds = $curTs;
|
|
|
|
- }
|
|
|
|
- if ($resultType) { # 胜利
|
|
|
|
- if (ctx()->gates->GateList->$gateId->pass == 0) {
|
|
|
|
- ctx()->gates->GateList->$gateId->pass = 1;
|
|
|
|
- }
|
|
|
|
- StoreProc::AddMultiItemInStore($gateMo->reward_win);
|
|
|
|
- if(Ins_GateInfo::GateTypeFromId($gateId) == Enum_GateType::MainStoryGate){
|
|
|
|
- ctx()->gates->UnlockNextPlotGate();
|
|
|
|
- $dic = GameConfig::gate();
|
|
|
|
- $index = 0; # 挑战关卡解锁逻辑. -gwang 2024年4月15日
|
|
|
|
- foreach ($dic as $id => $item) {
|
|
|
|
- if(Ins_GateInfo::GateTypeFromId($id) == Enum_GateType::MainChallengeGate
|
|
|
|
- && $item->challengeGateId == $gateId){
|
|
|
|
- $index += 1;
|
|
|
|
- $gate = new Ins_GateInfo();
|
|
|
|
- $gate->GateId = $id;
|
|
|
|
- ctx()->gates->GateList->$id = $gate;
|
|
|
|
- }
|
|
|
|
- if($index >= 3){
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
- }
|
|
|
|
- } 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,
|
|
|
|
- 'store' => ctx()->store,
|
|
|
|
- );
|
|
|
|
- return Resp::ok($ret);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- /**
|
|
|
|
- * 章节宝箱的领取
|
|
|
|
|
|
+ * 6802 章节宝箱的领取
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
public static function PassGateTsPrizeReceive() {
|
|
public static function PassGateTsPrizeReceive() {
|
|
@@ -503,10 +424,64 @@ class FightProc {
|
|
if ($tag) {
|
|
if ($tag) {
|
|
my_Assert($mask > $gateInfo->FirstReward, ErrCode::user_Gate_GatePriceHasReceive);
|
|
my_Assert($mask > $gateInfo->FirstReward, ErrCode::user_Gate_GatePriceHasReceive);
|
|
$gateInfo->FirstReward = $mask;
|
|
$gateInfo->FirstReward = $mask;
|
|
- StoreProc::AddMultiItemInStore($prize);
|
|
|
|
|
|
+ StoreProc::AddMultiItemInStore($prize);
|
|
}
|
|
}
|
|
ctx()->gates->GateList->$gateId = $gateInfo;
|
|
ctx()->gates->GateList->$gateId = $gateInfo;
|
|
|
|
|
|
|
|
+ UserProc::updateUserInfo();
|
|
|
|
+ $ret = array(
|
|
|
|
+ 'gates' => ctx()->gates,
|
|
|
|
+ 'store' => ctx()->store,
|
|
|
|
+ );
|
|
|
|
+ return Resp::ok($ret);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * [6801]关卡战斗结算
|
|
|
|
+ * @return type
|
|
|
|
+ */
|
|
|
|
+ public static function Settle() {
|
|
|
|
+ list($resultType, $gateId, $gold, $curTs, $pickups) = 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;
|
|
|
|
+ $ts = $gateInfo->MaxSeconds;
|
|
|
|
+ if ($curTs >= $ts) {
|
|
|
|
+ $gateInfo->MaxSeconds = $curTs;
|
|
|
|
+ }
|
|
|
|
+ if ($resultType) { # 胜利
|
|
|
|
+ if (ctx()->gates->GateList->$gateId->pass == 0) {
|
|
|
|
+ ctx()->gates->GateList->$gateId->pass = 1;
|
|
|
|
+ }
|
|
|
|
+ StoreProc::AddMultiItemInStore($gateMo->reward_win);
|
|
|
|
+ if (Ins_GateInfo::GateTypeFromId($gateId) == Enum_GateType::MainStoryGate) {
|
|
|
|
+ ctx()->gates->UnlockNextPlotGate();
|
|
|
|
+ $dic = GameConfig::gate();
|
|
|
|
+ $index = 0; # 挑战关卡解锁逻辑. -gwang 2024年4月15日
|
|
|
|
+ foreach ($dic as $id => $item) {
|
|
|
|
+ if (Ins_GateInfo::GateTypeFromId($id) == Enum_GateType::MainChallengeGate && $item->challengeGateId == $gateId) {
|
|
|
|
+ $index += 1;
|
|
|
|
+ $gate = new Ins_GateInfo();
|
|
|
|
+ $gate->GateId = $id;
|
|
|
|
+ ctx()->gates->GateList->$id = $gate;
|
|
|
|
+ }
|
|
|
|
+ if ($index >= 3) {
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ } else { # 失败
|
|
|
|
+ StoreProc::AddMultiItemInStore($gateMo->reward_fail);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ StoreProc::AddMultiItemInStore($pickups); # 战场拾取道具
|
|
|
|
+ ctx()->baseInfo->Add_Gold($gold);
|
|
|
|
+ //ctx()->baseInfo->Add_Exp($exp);
|
|
|
|
+
|
|
|
|
+
|
|
UserProc::updateUserInfo();
|
|
UserProc::updateUserInfo();
|
|
$ret = array(
|
|
$ret = array(
|
|
'gates' => ctx()->gates,
|
|
'gates' => ctx()->gates,
|