|
@@ -190,11 +190,10 @@ class SweepGatesProc {
|
|
|
|
|
|
/**
|
|
|
* [6801] 关卡挑战1次
|
|
|
- * @param Req $req
|
|
|
- * @deprecated since version 0 用新版
|
|
|
+ * @param Req $req
|
|
|
*/
|
|
|
public static function Arenas_Fight($req) {
|
|
|
- list($gateId, $difficulty, $star) = $req->paras; # 提取参数: 挑战的关卡Id, 关卡难度(0,1,2), 几星.
|
|
|
+ list($gateId, $difficulty, $star, $TeamObj) = $req->paras; # 提取参数: 挑战的关卡Id, 关卡难度(0,1,2), 几星, 队伍
|
|
|
Resp::assert($gateId > 0, "关卡id非法");
|
|
|
$err = self::recordFight($req, $gateId, $difficulty, $star); # 挑战记录
|
|
|
if (ErrCode::ok != $err) {
|
|
@@ -202,26 +201,38 @@ class SweepGatesProc {
|
|
|
}
|
|
|
$smGate = GameConfig::gate_getItem($gateId); # 关卡配置数据
|
|
|
$i = $difficulty + 1; # 按三个难度取不同的值.
|
|
|
- $tili = self::getProperty_n($smGate, "tili", $i);
|
|
|
+// $tili = self::getProperty_n($smGate, "tili", $i); # 体力暂时未用上
|
|
|
$rwdstr = self::getProperty_n($smGate, "reward", $i);
|
|
|
$gold = self::getProperty_n($smGate, "gold", $i);
|
|
|
$exp = self::getProperty_n($smGate, "exp", $i);
|
|
|
+ $heroExp = self::getProperty_n($smGate, "heroExp", $i);
|
|
|
|
|
|
// ActiveProc::ChangeTili(-$tili, $req); # 扣减体力变化
|
|
|
-// foreach ($TeamObj as $heroUID) {
|
|
|
-// HeroProc::HeroAddEXP($heroUID, $tili, $req); # 增加英雄经验 这个功能组长取消掉了
|
|
|
-// }
|
|
|
// UserGameModel::Add_Exp($req->mem, $req->userInfo->game, $tili); # 老的增加玩家经验的去掉
|
|
|
-
|
|
|
- $err = StoreProc::AddMultiItemInStore($req, $rwdstr); # 发放战利品
|
|
|
- if ($err != ErrCode::ok) {
|
|
|
- return Resp::err($err);
|
|
|
+//
|
|
|
+ foreach ($TeamObj as $heroUID) {
|
|
|
+ HeroProc::HeroAddEXP($heroUID, $heroExp, $req); # 增加英雄经验
|
|
|
}
|
|
|
|
|
|
- UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $gold); # 增加发经验和发金币
|
|
|
- UserGameModel::Add_Exp($req, $exp);
|
|
|
+ $rewardsArr = explode(";", $rwdstr); # 计算奖品
|
|
|
+ $rewardArr = array();
|
|
|
+ foreach ($rewardsArr as $r) { #
|
|
|
+ if (strlen($r) <= 0) { # 抽奖结果为空
|
|
|
+ return Resp::err(ErrCode::err_innerfault);
|
|
|
+ }
|
|
|
+ $percent = explode(',', $r)[2];
|
|
|
+ if (CommUtil::randomPercent($percent)) {
|
|
|
+ $err = StoreProc::AddMultiItemInStore($req, $r); # 发放战利品
|
|
|
+ if ($err != ErrCode::ok) { # 出错了
|
|
|
+ return Resp::err($err);
|
|
|
+ }
|
|
|
+ $rewardArr[] = substr($r, 0, strrpos($r, ',')); # 剔除最后一段概率字符串
|
|
|
+ }
|
|
|
+ }
|
|
|
+ UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $gold); # 发金币
|
|
|
+ UserGameModel::Add_Exp($req, $exp); # 给玩家(指挥官)增加经验
|
|
|
|
|
|
- UserProc::updateUserInfo($req); # 在获取战利品那里已经update了.
|
|
|
+ UserProc::updateUserInfo($req); # 回写玩家数据.
|
|
|
|
|
|
$result = array(
|
|
|
'store' => $req->userInfo->game->store,
|
|
@@ -230,7 +241,8 @@ class SweepGatesProc {
|
|
|
'tili' => $req->userInfo->game->tili,
|
|
|
'time' => $req->userInfo->game->privateState->TiliTime,
|
|
|
'gold' => $gold,
|
|
|
- 'exp' => $exp
|
|
|
+ 'exp' => $exp,
|
|
|
+ 'rewardstr' => implode(';', $rewardArr)
|
|
|
);
|
|
|
return Resp::ok($result);
|
|
|
}
|
|
@@ -262,7 +274,7 @@ class SweepGatesProc {
|
|
|
return ErrCode::err_arenasgate_indexillegal;
|
|
|
}
|
|
|
|
|
|
- if ($gateId == $diffCult->highest + 1) {
|
|
|
+ if ($gateId == $diffCult->highest + 1 && $star > 0) { # 星级大于等于0,才可以推关
|
|
|
$diffCult->highest += 1; # 更新最高记录
|
|
|
}
|
|
|
$diffCult->latest = $gateId; # 记录上次挑战关卡id
|
|
@@ -276,7 +288,9 @@ class SweepGatesProc {
|
|
|
if ($uGate->star < $star) { # 当前关卡得分评星
|
|
|
$uGate->star = $star;
|
|
|
}
|
|
|
- $uGate->cleared = 1; # 当前关卡未知
|
|
|
+
|
|
|
+ $uGate->cleared = 1; # 当前关卡是否已通关
|
|
|
+
|
|
|
$diffCult->gates->$gateId = $uGate; # 回写关卡记录
|
|
|
|
|
|
$userGates->TotalNum++; # 总战斗次数+1
|