|
@@ -7,132 +7,6 @@ namespace loyalsoft;
|
|
|
* @author gwang
|
|
|
*/
|
|
|
class SweepGatesProc {
|
|
|
- //
|
|
|
- // <editor-fold defaultstate="collapsed" desc="三层关卡">
|
|
|
-// /**
|
|
|
-// * [6817]新版本的挑战地图关卡
|
|
|
-// * @param req $req
|
|
|
-// */
|
|
|
-// public static function NewArenas_Fight($req) {
|
|
|
-// # 提取参数
|
|
|
-// $gateId = $req->paras[0]; # 0. 挑战的关卡Id
|
|
|
-// $difficulty = $req->paras[1]; # 1. 关卡难度 difficulty
|
|
|
-// $star = $req->paras[2]; # 2. 几星
|
|
|
-// $TeamObj = $req->paras[3]; # 3. 队伍信息
|
|
|
-// $bossId = $req->paras[4]; # 4. 本关消灭的bossid (<=0代表本关卡未出现boss)
|
|
|
-// $rewards = $req->paras[5]; # 5. 本关获得的宝箱列表,id:num,id:num,...
|
|
|
-//
|
|
|
-// $smGate = GameConfig::gate_getItem($gateId); # 关卡配置数据
|
|
|
-/////按 三个难度取不同的值.
|
|
|
-// $i = $difficulty + 1;
|
|
|
-// $tili = self::getProperty_n($smGate, "tili", $i);
|
|
|
-//// $reward = self::getProperty_n($smGate, "reward", $i);
|
|
|
-// $gold = self::getProperty_n($smGate, "gold", $i);
|
|
|
-// $exp = self::getProperty_n($smGate, "exp", $i);
|
|
|
-//
|
|
|
-// self::newRecordFight($req, $gateId, $difficulty, $star); # 更新战斗记录
|
|
|
-//
|
|
|
-// $canfighterr = SweepGatesProc::CanFight($req, $gateId, $difficulty); # 是否可以挑战当前关卡计算
|
|
|
-//
|
|
|
-// if ($canfighterr) { # 不能符合战斗要求
|
|
|
-// return $canfighterr;
|
|
|
-// }
|
|
|
-////
|
|
|
-// ActiveProc::ChangeTili(-$tili); # 扣减体力
|
|
|
-// $req->userInfo->game->gates->TotalNum++; # 更新战斗次数统计
|
|
|
-// $req->userInfo->game->gates->Times++;
|
|
|
-/////增加英雄经验 组长去掉
|
|
|
-// foreach ($TeamObj as $heroUID) {
|
|
|
-// if ($heroUID > 0) {
|
|
|
-// HeroProc::HeroAddEXP($heroUID, $tili);
|
|
|
-// }
|
|
|
-// }
|
|
|
-//
|
|
|
-// $rewardsArr = explode(",", $rewards); // 开箱子抽奖品
|
|
|
-// $rewardArr = array();
|
|
|
-// foreach ($rewardsArr as $r) {
|
|
|
-// $arr = explode(':', $r);
|
|
|
-// $boxID = intval($arr[0]);
|
|
|
-// $num = intval($arr[1]);
|
|
|
-//// $boxMo = GameConfig::item_box_getItem($boxID);
|
|
|
-// $boxPool = GameConfig::boxpool_getItem($boxID); # 提取对应序列的奖池,
|
|
|
-// $itemArr = array_filter($boxPool, function($item) use($dropindex) { # 这一步形同虚设了. 所有dropType都填的1
|
|
|
-// return $item->dropType == 1;
|
|
|
-// });
|
|
|
-// $itemArr = Lotterys::FilterPrizepool($req, $itemArr); # 对奖池依解锁等级进行过滤
|
|
|
-// foreach ($itemArr as $item) {
|
|
|
-// $prop = $item->normal;
|
|
|
-// if ($prop < 0) {
|
|
|
-// $prop = 0;
|
|
|
-// }
|
|
|
-// $item->probability = $prop;
|
|
|
-// }
|
|
|
-// $err = Lotterys::Dice($itemArr, $num, $rewardstr); # 投骰子
|
|
|
-// if ($err != ErrCode::ok) { # 出错了
|
|
|
-// return Resp::err($err);
|
|
|
-// }
|
|
|
-// if (strlen($rewardstr) <= 0) { # 抽奖结果为空
|
|
|
-// return Resp::err(ErrCode::err_innerfault);
|
|
|
-// }
|
|
|
-// $rewardArr[] = $rewardstr;
|
|
|
-// }
|
|
|
-// if ($bossId > 0) { # boss关处理
|
|
|
-// $req->userInfo->game->gates->killedBoss[] = $bossId;
|
|
|
-// }
|
|
|
-// UserGameModel::Add_Gold($req->userInfo->game, $gold); # 发放金币奖励
|
|
|
-//
|
|
|
-// UserGameModel::Add_Exp($req->userInfo->game, $exp); # 发放经验奖励
|
|
|
-// UserProc::updateUserInfo(); # 在获取战利品哪里已经update了.
|
|
|
-// $result = array(
|
|
|
-// 'store' => $req->userInfo->game->store,
|
|
|
-// 'heros' => $req->userInfo->game->heros,
|
|
|
-// 'gates' => $req->userInfo->game->gates,
|
|
|
-// 'tili' => $req->userInfo->game->tili,
|
|
|
-// 'time' => $req->userInfo->game->privateState->TiliTime,
|
|
|
-// 'gold' => $gold,
|
|
|
-// 'exp' => $exp,
|
|
|
-// 'rewardstr' => implode(';', $rewardArr)
|
|
|
-// );
|
|
|
-// return Resp::ok($result);
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 更新战斗记录(新)
|
|
|
-// * @param req $req
|
|
|
-// * @param type $gateId
|
|
|
-// * @param type $difficulty
|
|
|
-// * @param type $star
|
|
|
-// */
|
|
|
-// private static function newRecordFight($req, $gateId, $difficulty, $star) {
|
|
|
-// if (!CommUtil::isPropertyExists($req->userInfo->game->gates, "newGateRecord")) {
|
|
|
-// $req->userInfo->game->gates->newGateRecord = ObjectInit(); # 防御未初始化的变量
|
|
|
-// }
|
|
|
-// $gatesRecord = $req->userInfo->game->gates->newGateRecord;
|
|
|
-// if (!CommUtil::isPropertyExists($gatesRecord, "record")) { # 防御未初始化的变量
|
|
|
-// $gatesRecord->record = ObjectInit();
|
|
|
-// }
|
|
|
-// if (!CommUtil::isPropertyExists($gatesRecord->record, $gateId)) { # 补充战斗记录
|
|
|
-// $gatesRecord->record->$gateId = ObjectInit();
|
|
|
-// }
|
|
|
-//
|
|
|
-// if ($difficulty <= 0) {
|
|
|
-// $gatesRecord->record->$gateId->normal = $star;
|
|
|
-// if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "normalToday")) {
|
|
|
-// $gatesRecord->record->$gateId->normalToday = 0;
|
|
|
-// }
|
|
|
-// } else if ($difficulty == 1) {
|
|
|
-// $gatesRecord->record->$gateId->hard = $star;
|
|
|
-// if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "hardToday")) {
|
|
|
-// $gatesRecord->record->$gateId->hardToday = 0;
|
|
|
-// }
|
|
|
-// } else if ($difficulty == 2) {
|
|
|
-// $gatesRecord->record->$gateId->elite = $star;
|
|
|
-// if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "eliteToday")) {
|
|
|
-// $gatesRecord->record->$gateId->eliteToday = 0;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// $req->userInfo->game->gates->newGateRecord = $gatesRecord; # 回写数据
|
|
|
-// }
|
|
|
|
|
|
/**
|
|
|
* 提取某个对象的某个字段(利用后面2个参数组合为字段名)
|