|
@@ -7,6 +7,8 @@ namespace loyalsoft;
|
|
|
* @author gwang
|
|
|
*/
|
|
|
class SweepGatesProc {
|
|
|
+ //
|
|
|
+ // <editor-fold defaultstate="collapsed" desc="三层关卡">
|
|
|
|
|
|
/**
|
|
|
* [6817]新版本的挑战地图关卡
|
|
@@ -29,7 +31,7 @@ class SweepGatesProc {
|
|
|
$gold = self::getProperty_n($smGate, "gold", $i);
|
|
|
$exp = self::getProperty_n($smGate, "exp", $i);
|
|
|
|
|
|
- self::recordFight($req, $gateId, $difficulty, $star); # 更新战斗记录
|
|
|
+ self::newRecordFight($req, $gateId, $difficulty, $star); # 更新战斗记录
|
|
|
|
|
|
$canfighterr = SweepGatesProc::CanFight($req, $gateId, $difficulty); # 是否可以挑战当前关卡计算
|
|
|
|
|
@@ -96,13 +98,13 @@ class SweepGatesProc {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 更新战斗记录
|
|
|
+ * 更新战斗记录(新)
|
|
|
* @param req $req
|
|
|
* @param type $gateId
|
|
|
* @param type $difficulty
|
|
|
* @param type $star
|
|
|
*/
|
|
|
- private static function recordFight($req, $gateId, $difficulty, $star) {
|
|
|
+ private static function newRecordFight($req, $gateId, $difficulty, $star) {
|
|
|
if (!CommUtil::isPropertyExists($req->userInfo->game->gates, "newGateRecord")) {
|
|
|
$req->userInfo->game->gates->newGateRecord = ObjectInit(); # 防御未初始化的变量
|
|
|
}
|
|
@@ -133,6 +135,42 @@ class SweepGatesProc {
|
|
|
$req->userInfo->game->gates->newGateRecord = $gatesRecord; # 回写数据
|
|
|
}
|
|
|
|
|
|
+// /**
|
|
|
+// * [6818]更改地图所停留的城镇
|
|
|
+// * //需要消耗体力
|
|
|
+// * @param type $req
|
|
|
+// * @deprecated since version 0
|
|
|
+// */
|
|
|
+// public static function ChangeArenas_StayCity($req) {
|
|
|
+//# 提取参数
|
|
|
+//# 0. 目标地址
|
|
|
+//# 1. 消耗体力
|
|
|
+// $cityId = $req->paras[0];
|
|
|
+// $costTili = $req->paras[1];
|
|
|
+// if (!CommUtil::isPropertyExists($req->userInfo->game->gates, "newGateRecord")) {
|
|
|
+// $req->userInfo->game->gates->newGateRecord = ObjectInit();
|
|
|
+// }
|
|
|
+// $gatesRecord = $req->userInfo->game->gates->newGateRecord;
|
|
|
+//
|
|
|
+// #在此补充检查消耗体力的数值是否正确
|
|
|
+// #
|
|
|
+//
|
|
|
+// $gatesRecord->lastStayCityId = $cityId;
|
|
|
+// $req->userInfo->game->gates->newGateRecord = $gatesRecord;
|
|
|
+// #体力变化
|
|
|
+// ActiveProc::ChangeTili(-$costTili, $req);
|
|
|
+// UserProc::updateUserInfo($req);
|
|
|
+//
|
|
|
+// $result = array(
|
|
|
+// 'gates' => $req->userInfo->game->gates,
|
|
|
+// 'tili' => $req->userInfo->game->tili,
|
|
|
+// 'time' => $req->userInfo->game->privateState->TiliTime,
|
|
|
+// );
|
|
|
+// return Resp::ok($result);
|
|
|
+// }
|
|
|
+// </editor-fold>
|
|
|
+//
|
|
|
+
|
|
|
/**
|
|
|
* 提取某个对象的某个字段(利用后面2个参数组合为字段名)
|
|
|
* @param type $obj
|
|
@@ -151,148 +189,126 @@ class SweepGatesProc {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * [6818]更改地图所停留的城镇
|
|
|
- * //需要消耗体力
|
|
|
- * @param type $req
|
|
|
+ * [6801] 关卡挑战1次
|
|
|
+ * @param Req $req
|
|
|
+ * @deprecated since version 0 用新版
|
|
|
*/
|
|
|
- public static function ChangeArenas_StayCity($req) {
|
|
|
-# 提取参数
|
|
|
-# 0. 目标地址
|
|
|
-# 1. 消耗体力
|
|
|
- $cityId = $req->paras[0];
|
|
|
- $costTili = $req->paras[1];
|
|
|
- if (!CommUtil::isPropertyExists($req->userInfo->game->gates, "newGateRecord")) {
|
|
|
- $req->userInfo->game->gates->newGateRecord = ObjectInit();
|
|
|
+ public static function Arenas_Fight($req) {
|
|
|
+ list($gateId, $difficulty, $star) = $req->paras; # 提取参数: 挑战的关卡Id, 关卡难度(0,1,2), 几星.
|
|
|
+
|
|
|
+ $err = self::recordFight($req, $gateId, $difficulty, $star); # 挑战记录
|
|
|
+ if (ErrCode::ok != $err) {
|
|
|
+ return Resp::err($err);
|
|
|
}
|
|
|
- $gatesRecord = $req->userInfo->game->gates->newGateRecord;
|
|
|
+ $smGate = GameConfig::gate_getItem($gateId); # 关卡配置数据
|
|
|
+ $i = $difficulty + 1; # 按三个难度取不同的值.
|
|
|
+ $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);
|
|
|
|
|
|
- #在此补充检查消耗体力的数值是否正确
|
|
|
- #
|
|
|
+// ActiveProc::ChangeTili(-$tili, $req); # 扣减体力变化
|
|
|
+// foreach ($TeamObj as $heroUID) {
|
|
|
+// HeroProc::HeroAddEXP($heroUID, $tili, $req); # 增加英雄经验 这个功能组长取消掉了
|
|
|
+// }
|
|
|
+// UserGameModel::Add_Exp($req->mem, $req->userInfo->game, $tili); # 老的增加玩家经验的去掉
|
|
|
|
|
|
- $gatesRecord->lastStayCityId = $cityId;
|
|
|
- $req->userInfo->game->gates->newGateRecord = $gatesRecord;
|
|
|
- #体力变化
|
|
|
- ActiveProc::ChangeTili(-$costTili, $req);
|
|
|
- UserProc::updateUserInfo($req);
|
|
|
+ $err = StoreProc::AddMultiItemInStore($req, $rwdstr); # 发放战利品
|
|
|
+ if ($err != ErrCode::ok) {
|
|
|
+ return Resp::err($err);
|
|
|
+ }
|
|
|
+
|
|
|
+ UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $gold); // 增加发经验和发金币
|
|
|
+ UserGameModel::Add_Exp($req, $exp);
|
|
|
+
|
|
|
+ UserProc::updateUserInfo($req); // 在获取战利品那里已经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
|
|
|
);
|
|
|
return Resp::ok($result);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * [6801] 关卡挑战1次
|
|
|
- * @param Req $req
|
|
|
- * @deprecated since version 0 用新版
|
|
|
+ * 更新战斗记录
|
|
|
+ * @param req $req
|
|
|
+ * @param type $gateId
|
|
|
+ * @param type $difficulty
|
|
|
+ * @param type $star
|
|
|
*/
|
|
|
- public static function Arenas_Fight($req) {
|
|
|
-# 提取参数
|
|
|
-# 0. 挑战的关卡Id
|
|
|
-# 1. 挑战结果 和李宁商量了,挑战结果是没有用的,只有胜利以后才会发送服务器端.所以这里打算改为关卡难度(0,1,2)
|
|
|
-# 2. 挑战记录 // 验证之用.几星.
|
|
|
-#3.队伍信息
|
|
|
- $gateId = $req->paras[0];
|
|
|
- $difficulty = $req->paras[1]; ///这里将会改为关卡难度 difficulty
|
|
|
- $star = $req->paras[2];
|
|
|
- $TeamObj = $req->paras[3];
|
|
|
- $bossId = $req->paras[4]; // 本关消灭的bossid (<=0代表本关卡未出现boss)
|
|
|
-
|
|
|
-
|
|
|
- $isNewbieGuideGate = false;
|
|
|
- if ($gateId == 504001) {
|
|
|
- $isNewbieGuideGate = true;
|
|
|
- }
|
|
|
-
|
|
|
- $smGate = GameConfig::gate_getItem($gateId);
|
|
|
-///按三个难度取不同的值.
|
|
|
- if ($difficulty == 0) {
|
|
|
- $gates = $req->userInfo->game->gates->normal;
|
|
|
- $tili = $smGate->tili1;
|
|
|
- $rwdstr = $smGate->reward1;
|
|
|
- $gold = $smGate->gold1;
|
|
|
- $exp = $smGate->exp1;
|
|
|
+ private static function recordFight($req, $gateId, $difficulty, $star) {
|
|
|
+ $userGates = $req->userInfo->game->gates;
|
|
|
+ if ($difficulty == 0) { # 按照难度查找
|
|
|
+ $diffCult = $userGates->normal;
|
|
|
} else if ($difficulty == 1) {
|
|
|
- $gates = $req->userInfo->game->gates->hard;
|
|
|
- $tili = $smGate->tili2;
|
|
|
- $rwdstr = $smGate->reward2;
|
|
|
- $gold = $smGate->gold2;
|
|
|
- $exp = $smGate->exp2;
|
|
|
+ $diffCult = $userGates->hard;
|
|
|
} else if ($difficulty == 2) {
|
|
|
- $gates = $req->userInfo->game->gates->elite;
|
|
|
- $tili = $smGate->tili3;
|
|
|
- $rwdstr = $smGate->reward3;
|
|
|
- $gold = $smGate->gold3;
|
|
|
- $exp = $smGate->exp3;
|
|
|
+ $diffCult = $userGates->elite;
|
|
|
+ } else {
|
|
|
+ return ErrCode::err_arenas_difficulty; # 找不到难度类型
|
|
|
}
|
|
|
|
|
|
- $typeId = substr($gates->highest, 0, 3); #分类
|
|
|
+ $typeId = substr($diffCult->highest, 0, 3); # 防御: 分类头不对
|
|
|
if ($typeId != '503') {
|
|
|
- $gates->highest = 503000;
|
|
|
+ $diffCult->highest = 503000; # 设置为关卡第一关
|
|
|
+ }
|
|
|
+ if ($gateId > $diffCult->highest + 1) { # 不能跳关
|
|
|
+ return ErrCode::err_arenasgate_indexillegal;
|
|
|
}
|
|
|
|
|
|
- if (!$isNewbieGuideGate) {
|
|
|
- if ($gateId > $gates->highest + 1) { # 不能跳关
|
|
|
- return Resp::err(ErrCode::err_arenasgate_indexillegal);
|
|
|
- } else if ($gateId == $gates->highest + 1) {
|
|
|
- $gates->highest += 1; // 更新最高记录
|
|
|
- }
|
|
|
-
|
|
|
- $gates->latest = $gateId;
|
|
|
-#记录数据
|
|
|
- $uGate = new UGateModel();
|
|
|
- if (isset($gates->gates->$gateId)) {
|
|
|
- $uGate = $gates->gates->$gateId;
|
|
|
- }
|
|
|
- $uGate->challengeTimes++;
|
|
|
-
|
|
|
- if ($uGate->star < $star) {
|
|
|
- $uGate->star = $star;
|
|
|
- }
|
|
|
- $uGate->cleared = 1;
|
|
|
- $gates->gates->$gateId = $uGate;
|
|
|
-////体力变化
|
|
|
-// UserGameModel::Add_Exp($req->mem, $req->userInfo->game, $tili);////老的增加玩家经验的去掉
|
|
|
- ActiveProc::ChangeTili(-$tili, $req);
|
|
|
-
|
|
|
-///增加英雄经验 这个功能组长取消掉了
|
|
|
-// foreach ($TeamObj as $heroUID) {
|
|
|
-// HeroProc::HeroAddEXP($heroUID, $tili, $req);
|
|
|
-// }
|
|
|
-////总战斗次数+1
|
|
|
- $req->userInfo->game->gates->TotalNum++;
|
|
|
- $req->userInfo->game->gates->Times++;
|
|
|
+ if ($gateId == $diffCult->highest + 1) {
|
|
|
+ $diffCult->highest += 1; # 更新最高记录
|
|
|
}
|
|
|
+ $diffCult->latest = $gateId; # 记录上次挑战关卡id
|
|
|
|
|
|
-/////检测如果当前物品格子大于物品总数,则可以获取战利品,否则不可以
|
|
|
-////战利品获取
|
|
|
- $err = StoreProc::AddMultiItemInStore($req, $rwdstr);
|
|
|
- if ($err) {
|
|
|
- return Resp::err($err);
|
|
|
+ $uGate = new UGateModel(); # 当前关卡的记录数据
|
|
|
+ if (isset($diffCult->gates->$gateId)) {
|
|
|
+ $uGate = $diffCult->gates->$gateId;
|
|
|
}
|
|
|
+ $uGate->challengeTimes++; # 当前关卡挑战次数
|
|
|
|
|
|
- if ($bossId > 0) {
|
|
|
- $req->userInfo->game->gates->killedBoss[] = $bossId;
|
|
|
+ if ($uGate->star < $star) { # 当前关卡得分评星
|
|
|
+ $uGate->star = $star;
|
|
|
}
|
|
|
+ $uGate->cleared = 1; # 当前关卡未知
|
|
|
+ $diffCult->gates->$gateId = $uGate; # 回写关卡记录
|
|
|
|
|
|
-// 增加发经验和发金币
|
|
|
- UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $gold);
|
|
|
- UserGameModel::Add_Exp($req, $exp);
|
|
|
+ $userGates->TotalNum++; # 总战斗次数+1
|
|
|
+ $userGates->Times++;
|
|
|
+ $req->userInfo->game->gates = $userGates; # 回写数据
|
|
|
|
|
|
- UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
|
|
|
+ return ErrCode::ok;
|
|
|
+ }
|
|
|
|
|
|
- $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
|
|
|
- );
|
|
|
- return Resp::ok($result);
|
|
|
+ /**
|
|
|
+ * 清理每个难度副本的每日战斗次数
|
|
|
+ * @param Req $req
|
|
|
+ */
|
|
|
+ public static function ClearGateTimes($req) {
|
|
|
+ $req->userInfo->game->gates->Times = 0;
|
|
|
+// if (!CommUtil::isPropertyExists($req->userInfo->game->gates, 'newGateRecord')) {
|
|
|
+// $req->userInfo->game->gates->newGateRecord = ObjectInit();
|
|
|
+// }
|
|
|
+// if (!CommUtil::isPropertyExists($req->userInfo->game->gates->newGateRecord, 'record')) {
|
|
|
+// return;
|
|
|
+// }
|
|
|
+// $obj = $req->userInfo->game->gates->newGateRecord->record;
|
|
|
+// //$result = empty($obj);
|
|
|
+// // if ($result == true) {
|
|
|
+// // return;
|
|
|
+// //}
|
|
|
+// foreach ($obj as $key => $value) {
|
|
|
+// $value->normalToday = 0;
|
|
|
+// $value->hardToday = 0;
|
|
|
+// $value->eliteToday = 0;
|
|
|
+// }
|
|
|
+// UserProc::updateUserInfo($req);
|
|
|
}
|
|
|
|
|
|
//
|
|
@@ -569,516 +585,487 @@ class SweepGatesProc {
|
|
|
return $resp;
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * [6804] 扣除买buffer的费用
|
|
|
- * @param type $req
|
|
|
- * @return type
|
|
|
- */
|
|
|
- public static function ConsumeBufferGold($req) {
|
|
|
- $user = $req->userInfo->game; # user引用
|
|
|
- $money = $req->paras[0]; //需要的手工费
|
|
|
-// echo var_dump($money);
|
|
|
- $bDeal = UserGameModel::Consume_Gold($user, $money);
|
|
|
- if ($bDeal) {
|
|
|
- $result = array(
|
|
|
- 'resp' => "succeed!"
|
|
|
- );
|
|
|
-// 更新数据库数据
|
|
|
-
|
|
|
- $resp = Resp::ok($result);
|
|
|
- } else {
|
|
|
-
|
|
|
-// $user->gold=0;
|
|
|
- $result = array(
|
|
|
- 'resp' => "succeed!"
|
|
|
- );
|
|
|
-// 更新数据库数据
|
|
|
-
|
|
|
- $resp = Resp::ok($result);
|
|
|
- }
|
|
|
- UserProc::updateUserInfo($req);
|
|
|
- return $resp;
|
|
|
- }
|
|
|
-
|
|
|
//
|
|
|
// <editor-fold defaultstate="collapsed" desc=" 好友租借 ">
|
|
|
-
|
|
|
- /**
|
|
|
- * [6805] 查询租借好友记录
|
|
|
- * @param Req $req
|
|
|
- */
|
|
|
- public static function GetBorrowedFriends($req) {
|
|
|
-// 查询好友借用记录中的数据
|
|
|
- $rentedfriends = $req->userInfo->game->privateState->rentedFriends;
|
|
|
- if (!$rentedfriends || !is_array($rentedfriends)) {
|
|
|
- $rentedfriends = ArrayInit();
|
|
|
- }
|
|
|
- return Resp::ok(array('ret' => $rentedfriends));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 清理战斗租借好友记录
|
|
|
- *
|
|
|
- */
|
|
|
- public static function ClearFightRentRecord($req) {
|
|
|
- $req->userInfo->game->privateState->rentedFriends = ArrayInit();
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * [6806] 扣除借用好友费用
|
|
|
- * @param Req $req
|
|
|
- */
|
|
|
- public static function ConsumeBorrowFriend($req) {
|
|
|
-// 提取参数:好友id
|
|
|
- $friend_uid = $req->paras[0];
|
|
|
-// 验证好友关系
|
|
|
- if (!FriendProc::isFriendship($req->zoneid, $req->uid, $friend_uid)) {
|
|
|
- return Resp::err(ErrCode::friend_no_err);
|
|
|
- }
|
|
|
-// 验证尚未租借过
|
|
|
- $rentedfriends = $req->userInfo->game->privateState->rentedFriends;
|
|
|
- if (!$rentedfriends || !is_array($rentedfriends)) {
|
|
|
- $rentedfriends = ArrayInit();
|
|
|
- }
|
|
|
- if (in_array($friend_uid, $rentedfriends)) {
|
|
|
- return Resp::err(array('err' => -1, 'msg' => 'has rented this player today!'));
|
|
|
- }
|
|
|
-// 验证好友出借英雄
|
|
|
- $friend_info = UserProc::getUserInfo(gMem(), $req->zoneid, $friend_uid);
|
|
|
- if (!$friend_info) {
|
|
|
- return Resp::err(ErrCode::user_no_err, '找不到好友的游戏数据!');
|
|
|
- }
|
|
|
-// todo:啦啦啦... 先不写了,管它用的是哪个英雄呢
|
|
|
+// /**
|
|
|
+// * [6805] 查询租借好友记录
|
|
|
+// * @param Req $req
|
|
|
+// */
|
|
|
+// public static function GetBorrowedFriends($req) {
|
|
|
+//// 查询好友借用记录中的数据
|
|
|
+// $rentedfriends = $req->userInfo->game->privateState->rentedFriends;
|
|
|
+// if (!$rentedfriends || !is_array($rentedfriends)) {
|
|
|
+// $rentedfriends = ArrayInit();
|
|
|
+// }
|
|
|
+// return Resp::ok(array('ret' => $rentedfriends));
|
|
|
+// }
|
|
|
//
|
|
|
-// 扣除费用,失败->金币不足
|
|
|
- $arr = explode(',', glc()->User_Friends_HireFriendForBattle_Cost);
|
|
|
- if (count($arr) < 2) {
|
|
|
- return Resp::err(ErrCode::err_const_no);
|
|
|
- }
|
|
|
- $itemid = $arr[0]; # 道具id
|
|
|
- $amt = $arr[1]; # 数量
|
|
|
- if ($itemid == META_GOLD_ITEMID) {
|
|
|
- $user = $req->userInfo->game;
|
|
|
- if ($user->gold < $amt) {
|
|
|
- return Resp::err(array('err' => -2, 'msg' => 'gold not enough!'));
|
|
|
- }
|
|
|
- UserGameModel::Consume_Gold($user, $amt);
|
|
|
-// todo: 给好友发送金币 邮件
|
|
|
- EmailProc::SendHireCoinFromFight($req->zoneid, $friend_uid, #
|
|
|
- $req->userInfo->game->name, $req->uid, $amt); # 好友收益需要扣除系统税率.
|
|
|
- } else {
|
|
|
- return Resp::err(ErrCode::err_const_no);
|
|
|
- }
|
|
|
-// 添加借用记录
|
|
|
- $rentedfriends[] = $friend_uid;
|
|
|
- $req->userInfo->game->privateState->rentedFriends = $rentedfriends;
|
|
|
-// 回写数据
|
|
|
- UserProc::updateUserInfo($req); // 玩家数据
|
|
|
-// UserProc::setUserInfo(global_mem(), $friend_info); // 好友数据
|
|
|
-// 返回
|
|
|
- return Resp::ok(array('err' => 0, 'curgold' => $user->gold));
|
|
|
- }
|
|
|
-
|
|
|
+// /**
|
|
|
+// * 清理战斗租借好友记录
|
|
|
+// *
|
|
|
+// */
|
|
|
+// public static function ClearFightRentRecord($req) {
|
|
|
+// $req->userInfo->game->privateState->rentedFriends = ArrayInit();
|
|
|
+// }
|
|
|
+//
|
|
|
+// /**
|
|
|
+// * [6806] 扣除借用好友费用
|
|
|
+// * @param Req $req
|
|
|
+// */
|
|
|
+// public static function ConsumeBorrowFriend($req) {
|
|
|
+//// 提取参数:好友id
|
|
|
+// $friend_uid = $req->paras[0];
|
|
|
+//// 验证好友关系
|
|
|
+// if (!FriendProc::isFriendship($req->zoneid, $req->uid, $friend_uid)) {
|
|
|
+// return Resp::err(ErrCode::friend_no_err);
|
|
|
+// }
|
|
|
+//// 验证尚未租借过
|
|
|
+// $rentedfriends = $req->userInfo->game->privateState->rentedFriends;
|
|
|
+// if (!$rentedfriends || !is_array($rentedfriends)) {
|
|
|
+// $rentedfriends = ArrayInit();
|
|
|
+// }
|
|
|
+// if (in_array($friend_uid, $rentedfriends)) {
|
|
|
+// return Resp::err(array('err' => -1, 'msg' => 'has rented this player today!'));
|
|
|
+// }
|
|
|
+//// 验证好友出借英雄
|
|
|
+// $friend_info = UserProc::getUserInfo(gMem(), $req->zoneid, $friend_uid);
|
|
|
+// if (!$friend_info) {
|
|
|
+// return Resp::err(ErrCode::user_no_err, '找不到好友的游戏数据!');
|
|
|
+// }
|
|
|
+//// todo:啦啦啦... 先不写了,管它用的是哪个英雄呢
|
|
|
+////
|
|
|
+//// 扣除费用,失败->金币不足
|
|
|
+// $arr = explode(',', glc()->User_Friends_HireFriendForBattle_Cost);
|
|
|
+// if (count($arr) < 2) {
|
|
|
+// return Resp::err(ErrCode::err_const_no);
|
|
|
+// }
|
|
|
+// $itemid = $arr[0]; # 道具id
|
|
|
+// $amt = $arr[1]; # 数量
|
|
|
+// if ($itemid == META_GOLD_ITEMID) {
|
|
|
+// $user = $req->userInfo->game;
|
|
|
+// if ($user->gold < $amt) {
|
|
|
+// return Resp::err(array('err' => -2, 'msg' => 'gold not enough!'));
|
|
|
+// }
|
|
|
+// UserGameModel::Consume_Gold($user, $amt);
|
|
|
+//// todo: 给好友发送金币 邮件
|
|
|
+// EmailProc::SendHireCoinFromFight($req->zoneid, $friend_uid, #
|
|
|
+// $req->userInfo->game->name, $req->uid, $amt); # 好友收益需要扣除系统税率.
|
|
|
+// } else {
|
|
|
+// return Resp::err(ErrCode::err_const_no);
|
|
|
+// }
|
|
|
+//// 添加借用记录
|
|
|
+// $rentedfriends[] = $friend_uid;
|
|
|
+// $req->userInfo->game->privateState->rentedFriends = $rentedfriends;
|
|
|
+//// 回写数据
|
|
|
+// UserProc::updateUserInfo($req); // 玩家数据
|
|
|
+//// UserProc::setUserInfo(global_mem(), $friend_info); // 好友数据
|
|
|
+//// 返回
|
|
|
+// return Resp::ok(array('err' => 0, 'curgold' => $user->gold));
|
|
|
+// }
|
|
|
// </editor-fold>
|
|
|
+//
|
|
|
+// <editor-fold defaultstate="collapsed" desc="黄金挑战">
|
|
|
+// /**
|
|
|
+// * [6804] 扣除买buffer的费用
|
|
|
+// * @param type $req
|
|
|
+// * @return type
|
|
|
+// */
|
|
|
+// public static function ConsumeBufferGold($req) {
|
|
|
+// $user = $req->userInfo->game; # user引用
|
|
|
+// $money = $req->paras[0]; //需要的手工费
|
|
|
+//// echo var_dump($money);
|
|
|
+// $bDeal = UserGameModel::Consume_Gold($user, $money);
|
|
|
+// if ($bDeal) {
|
|
|
+// $result = array(
|
|
|
+// 'resp' => "succeed!"
|
|
|
+// );
|
|
|
+//// 更新数据库数据
|
|
|
//
|
|
|
-
|
|
|
- /**
|
|
|
- * [6807] 挑战黄金 无穷无尽战斗模式
|
|
|
- * @param type $req
|
|
|
- */
|
|
|
- public static function ChallengeEndlessFightMode_Gold($req) {
|
|
|
- $gateForeverId = $req->paras[0];
|
|
|
- $difficuty = $req->paras[1];
|
|
|
- $bociCount = $req->paras[2];
|
|
|
-//判断是否已经达到挑战的次数上限
|
|
|
- $gates = $req->userInfo->game->gates;
|
|
|
-
|
|
|
- if (!CommUtil::isPropertyExists($gates, "forever_Gold_FightTimes")) {
|
|
|
- $gates->forever_Gold_FightTimes = 0;
|
|
|
- }
|
|
|
-
|
|
|
- if ($gates->forever_Gold_FightTimes >= glc()->Battle_Forever_MaxCountEveryDay) {
|
|
|
- return Resp::err(ErrCode::err_gateForever_countIsFull, '挑战次数已经用尽!');
|
|
|
- }
|
|
|
-//1.取出无尽模式的关卡常量数据
|
|
|
- $gateForeverConst = GameConfig::gateforever_getItem($gateForeverId); // ConstProc::getGold_GateForeverGoldConst($gateForeverId);
|
|
|
- $gateBattleBociConst = GameConfig::gatecombat_getItem($gateForeverId);
|
|
|
- if (!$gateForeverConst) {
|
|
|
- return Resp::err(ErrCode::err_gateForever_const_no);
|
|
|
- }
|
|
|
-//判断次数是否合法
|
|
|
- $bociArr = explode(",", $gateBattleBociConst->level);
|
|
|
- if ($bociCount > count($bociArr)) {
|
|
|
- return Resp::err(ErrCode::err_gateForever_countillegal);
|
|
|
- }
|
|
|
-//2.取出模式下的奖励数据
|
|
|
- $rewardStr = $gateForeverConst->reward1;
|
|
|
-
|
|
|
- $arr_reward = explode(";", $rewardStr);
|
|
|
- foreach ($arr_reward as $value) {
|
|
|
- if (strlen($value) > 0) {
|
|
|
-
|
|
|
- $arr_RealReward = explode(",", $value);
|
|
|
- $itemId = $arr_RealReward[0];
|
|
|
- $itemNum = $arr_RealReward[1];
|
|
|
-
|
|
|
- $str1 = substr($itemId, 0, 3);
|
|
|
-//3.根据挑战的波次数据,重复累计获得奖励
|
|
|
- for ($i = 0; $i < $bociCount; $i++) {
|
|
|
-
|
|
|
- switch ($str1) {
|
|
|
-///怪物卡或者英雄卡牌获取
|
|
|
- case "101":
|
|
|
- case "201":
|
|
|
-// HeroProc::AddHeroTFromStore($req, $itemId);
|
|
|
- break;
|
|
|
-///装备物品的获取.
|
|
|
- case "301":
|
|
|
- case "302":
|
|
|
- case "303":
|
|
|
- StoreProc::PutEquipInStore($itemId, $req);
|
|
|
- break;
|
|
|
-///宝石的获取
|
|
|
- case "304":
|
|
|
- StoreProc:: PutOverlyingItemInStore($itemId, $itemNum, $req);
|
|
|
- break;
|
|
|
-//金币的获取
|
|
|
- case "399":
|
|
|
- if ($itemId == "399002") {
|
|
|
- UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $itemNum);
|
|
|
- }
|
|
|
- break;
|
|
|
- default:
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-//4、存储玩家的挑战次数
|
|
|
- $gates->forever_Gold_FightTimes = $gates->forever_Gold_FightTimes + 1;
|
|
|
-// 回写数据
|
|
|
- UserProc::updateUserInfo($req);
|
|
|
- $result = ObjectInit();
|
|
|
- $result->result = "succeed";
|
|
|
- $result->forever_Gold_FightTimes = $gates->forever_Gold_FightTimes;
|
|
|
- $resp = Resp::ok($result);
|
|
|
- return $resp;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 清理挑战无尽模式的 次数记录
|
|
|
- *
|
|
|
- */
|
|
|
- public static function ClearGateForeverGold_FightCountEveryDay($req) {
|
|
|
- $req->userInfo->game->gates->forever_Gold_FightTimes = 0;
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 清理每个难度副本的每日战斗次数
|
|
|
- * @param type $req
|
|
|
- */
|
|
|
- public static function ClearGateTimes($req) {
|
|
|
- if (!CommUtil::isPropertyExists($req->userInfo->game->gates, 'newGateRecord')) {
|
|
|
- $req->userInfo->game->gates->newGateRecord = ObjectInit();
|
|
|
- }
|
|
|
- if (!CommUtil::isPropertyExists($req->userInfo->game->gates->newGateRecord, 'record')) {
|
|
|
- return;
|
|
|
- }
|
|
|
- $obj = $req->userInfo->game->gates->newGateRecord->record;
|
|
|
- //$result = empty($obj);
|
|
|
- // if ($result == true) {
|
|
|
- // return;
|
|
|
- //}
|
|
|
- foreach ($obj as $key => $value) {
|
|
|
- $value->normalToday = 0;
|
|
|
- $value->hardToday = 0;
|
|
|
- $value->eliteToday = 0;
|
|
|
- }
|
|
|
- UserProc::updateUserInfo($req);
|
|
|
- }
|
|
|
-
|
|
|
+// $resp = Resp::ok($result);
|
|
|
+// } else {
|
|
|
+//
|
|
|
+//// $user->gold=0;
|
|
|
+// $result = array(
|
|
|
+// 'resp' => "succeed!"
|
|
|
+// );
|
|
|
+//// 更新数据库数据
|
|
|
+//
|
|
|
+// $resp = Resp::ok($result);
|
|
|
+// }
|
|
|
+// UserProc::updateUserInfo($req);
|
|
|
+// return $resp;
|
|
|
+// }
|
|
|
+// /**
|
|
|
+// * [6807] 挑战黄金 无穷无尽战斗模式
|
|
|
+// * @param type $req
|
|
|
+// */
|
|
|
+// public static function ChallengeEndlessFightMode_Gold($req) {
|
|
|
+// $gateForeverId = $req->paras[0];
|
|
|
+// $difficuty = $req->paras[1];
|
|
|
+// $bociCount = $req->paras[2];
|
|
|
+////判断是否已经达到挑战的次数上限
|
|
|
+// $gates = $req->userInfo->game->gates;
|
|
|
+//
|
|
|
+// if (!CommUtil::isPropertyExists($gates, "forever_Gold_FightTimes")) {
|
|
|
+// $gates->forever_Gold_FightTimes = 0;
|
|
|
+// }
|
|
|
+//
|
|
|
+// if ($gates->forever_Gold_FightTimes >= glc()->Battle_Forever_MaxCountEveryDay) {
|
|
|
+// return Resp::err(ErrCode::err_gateForever_countIsFull, '挑战次数已经用尽!');
|
|
|
+// }
|
|
|
+////1.取出无尽模式的关卡常量数据
|
|
|
+// $gateForeverConst = GameConfig::gateforever_getItem($gateForeverId); // ConstProc::getGold_GateForeverGoldConst($gateForeverId);
|
|
|
+// $gateBattleBociConst = GameConfig::gatecombat_getItem($gateForeverId);
|
|
|
+// if (!$gateForeverConst) {
|
|
|
+// return Resp::err(ErrCode::err_gateForever_const_no);
|
|
|
+// }
|
|
|
+////判断次数是否合法
|
|
|
+// $bociArr = explode(",", $gateBattleBociConst->level);
|
|
|
+// if ($bociCount > count($bociArr)) {
|
|
|
+// return Resp::err(ErrCode::err_gateForever_countillegal);
|
|
|
+// }
|
|
|
+////2.取出模式下的奖励数据
|
|
|
+// $rewardStr = $gateForeverConst->reward1;
|
|
|
+//
|
|
|
+// $arr_reward = explode(";", $rewardStr);
|
|
|
+// foreach ($arr_reward as $value) {
|
|
|
+// if (strlen($value) > 0) {
|
|
|
+//
|
|
|
+// $arr_RealReward = explode(",", $value);
|
|
|
+// $itemId = $arr_RealReward[0];
|
|
|
+// $itemNum = $arr_RealReward[1];
|
|
|
+//
|
|
|
+// $str1 = substr($itemId, 0, 3);
|
|
|
+////3.根据挑战的波次数据,重复累计获得奖励
|
|
|
+// for ($i = 0; $i < $bociCount; $i++) {
|
|
|
+//
|
|
|
+// switch ($str1) {
|
|
|
+/////怪物卡或者英雄卡牌获取
|
|
|
+// case "101":
|
|
|
+// case "201":
|
|
|
+//// HeroProc::AddHeroTFromStore($req, $itemId);
|
|
|
+// break;
|
|
|
+/////装备物品的获取.
|
|
|
+// case "301":
|
|
|
+// case "302":
|
|
|
+// case "303":
|
|
|
+// StoreProc::PutEquipInStore($itemId, $req);
|
|
|
+// break;
|
|
|
+/////宝石的获取
|
|
|
+// case "304":
|
|
|
+// StoreProc:: PutOverlyingItemInStore($itemId, $itemNum, $req);
|
|
|
+// break;
|
|
|
+////金币的获取
|
|
|
+// case "399":
|
|
|
+// if ($itemId == "399002") {
|
|
|
+// UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $itemNum);
|
|
|
+// }
|
|
|
+// break;
|
|
|
+// default:
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+// }
|
|
|
+////4、存储玩家的挑战次数
|
|
|
+// $gates->forever_Gold_FightTimes = $gates->forever_Gold_FightTimes + 1;
|
|
|
+//// 回写数据
|
|
|
+// UserProc::updateUserInfo($req);
|
|
|
+// $result = ObjectInit();
|
|
|
+// $result->result = "succeed";
|
|
|
+// $result->forever_Gold_FightTimes = $gates->forever_Gold_FightTimes;
|
|
|
+// $resp = Resp::ok($result);
|
|
|
+// return $resp;
|
|
|
+// }
|
|
|
+// /**
|
|
|
+// * 清理挑战无尽模式的 次数记录
|
|
|
+// *
|
|
|
+// */
|
|
|
+// public static function ClearGateForeverGold_FightCountEveryDay($req) {
|
|
|
+// $req->userInfo->game->gates->forever_Gold_FightTimes = 0;
|
|
|
+// }
|
|
|
+ // </editor-fold>
|
|
|
//
|
|
|
// <editor-fold defaultstate="collapsed" desc=" 副本 ">
|
|
|
//
|
|
|
-
|
|
|
- /**
|
|
|
- * [6801] 开启副本
|
|
|
- * @param Req $req
|
|
|
- */
|
|
|
- public static function OpenTheCarbon($req) {
|
|
|
- $gates = $req->userInfo->game->gates;
|
|
|
- $openedcarbons = $gates->carbons->openedCarbons;
|
|
|
-# 提取参数
|
|
|
- $carbonId = $req->paras[0]; # 副本ID
|
|
|
- $difficulty = $req->paras[1]; # 难度等级 1,2,3
|
|
|
- $key = "$carbonId-$difficulty"; # 键值
|
|
|
- if (!($gates && $openedcarbons)) {
|
|
|
- return Resp::err(ErrCode::err_innerfault);
|
|
|
- }
|
|
|
- if ($difficulty > 3 || $difficulty < 1) {
|
|
|
- return Resp::err(ErrCode::carbon_wrongdifficult);
|
|
|
- }
|
|
|
-
|
|
|
- if (CommUtil::isPropertyExists($openedcarbons, $key)) {
|
|
|
- $carbon = $openedcarbons->$key;
|
|
|
- } else {
|
|
|
- $carbon = new CarbonModel();
|
|
|
- }
|
|
|
- if ($carbon->closeTs > now()) {
|
|
|
- return Resp::err(ErrCode::carbon_opened);
|
|
|
- }
|
|
|
- $carbonModel = GameConfig::gate_carbon_getItem($carbonId); # 常量
|
|
|
-# 扣除开启消耗的道具
|
|
|
- $keyid = "keyId$difficulty";
|
|
|
- $keynum = "keyNum$difficulty";
|
|
|
- $costItemId = $carbonModel->$keyid;
|
|
|
- $costItemNum = $carbonModel->$keynum;
|
|
|
-
|
|
|
- $err = StoreProc::removeItemFromStore($req->userInfo->game->store, $costItemId, $costItemNum);
|
|
|
- if ($err) { # 扣除失败
|
|
|
- return Resp::err($err);
|
|
|
- }
|
|
|
- $carbon->closeTs = now() + $carbonModel->duration; # 关闭倒计时
|
|
|
- $carbon->curIndex = 0; # 索引重置为0
|
|
|
- $openedcarbons->$key = $carbon;
|
|
|
- $req->userInfo->game->gates->carbons->openedCarbons = $openedcarbons;
|
|
|
- UserProc::updateUserInfo($req);
|
|
|
- return Resp::ok(array('err' => 0, 'carbons' => $openedcarbons));
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * 挑战副本关卡
|
|
|
- * @param Req $req
|
|
|
- */
|
|
|
- public static function ChallengeCarbon($req) {
|
|
|
- $gates = $req->userInfo->game->gates;
|
|
|
- $carbons = $gates->carbons->openedCarbons;
|
|
|
-# 提取参数
|
|
|
- $carbonId = $req->paras[0]; # 副本ID
|
|
|
- $difficulty = $req->paras[1]; # 难度等级 1,2,3
|
|
|
- $gateindex = $req->paras[2]; # 关卡索引 0,1,2,...
|
|
|
- $star = $req->paras[3]; # 战斗评价(几星)
|
|
|
- $TeamObj = $req->paras[4]; # 队伍信息
|
|
|
-// $bossId = $req->paras[5]; # 本关消灭的bossid (<=0代表本关卡未出现boss)
|
|
|
- if ($difficulty > 3 || $difficulty < 1) {
|
|
|
- return Resp::err(ErrCode::carbon_wrongdifficult);
|
|
|
- }
|
|
|
- $key = "$carbonId-$difficulty"; # 键值
|
|
|
-# 0 当前副本处于开启状态
|
|
|
-# 1 当前关卡索引,不能跳着打,
|
|
|
-# 2 记录下战斗评价(几星), 也许以后用得着,比如最后通关后,给个啥奖励
|
|
|
-# 3 决定掉落物品, 发给客户端
|
|
|
-# 4 发放对应的经验之类的东西
|
|
|
-# 5 检查是否最后一个关卡, 是, 关闭副本
|
|
|
-# 6 回存数据,返回
|
|
|
-
|
|
|
- isEditor() && $carbon = new CarbonModel;
|
|
|
- if (CommUtil::isPropertyExists($carbons, $key)) {
|
|
|
- $carbon = $carbons->$key;
|
|
|
- } else {
|
|
|
- $carbon = null;
|
|
|
- }
|
|
|
- if (!$carbon || $carbon->closeTs < now()) {
|
|
|
- return Resp::err(ErrCode::carbon_closed);
|
|
|
- }
|
|
|
-
|
|
|
- $carbonModel = GameConfig::gate_carbon_getItem($carbonId); # 副本常量数据
|
|
|
- $gateIds = explode(',', $carbonModel->gateids);
|
|
|
- if ($gateindex < 0 || $gateindex >= count($gateIds)) {
|
|
|
- return Resp::err(ErrCode::carbon_gateIndex);
|
|
|
- }
|
|
|
- if ($carbon->curIndex == $gateindex || $gateindex == 0) {
|
|
|
- $carbon->curIndex += 1; # 更新进度
|
|
|
- } else { # 不能跳关
|
|
|
- return Resp::err(ErrCode::carbon_gateIndex);
|
|
|
- }
|
|
|
-
|
|
|
- $gateId = $gateIds[$gateindex]; # 通过索引获得关卡ID
|
|
|
- $tl = "tili$difficulty"; # 体力难度
|
|
|
- $rwd = "reward$difficulty"; # 奖励难度
|
|
|
- $arr = array("normal", 'hard', 'elite'); # 难度名称
|
|
|
- $gt = $arr[$difficulty - 1]; # 关卡分类
|
|
|
- $gateModel = GameConfig::gate_carbon_content_getItem($gateId); # 副本关卡常量数据
|
|
|
- $tili = $gateModel->$tl; # 扣除体力
|
|
|
- $reward = $gateModel->$rwd; # 获得奖励
|
|
|
-#
|
|
|
-# 打副本呢也要扣除体力
|
|
|
- ActiveProc::ChangeTili(-$tili, $req);
|
|
|
-# 扣除多少体力就给账号增加多少经验 -by 李宁, reconfirmed by wg 20170519144109
|
|
|
- UserGameModel::Add_Exp($req, $tili);
|
|
|
-# 增加英雄经验(也是依据扣除的体力数)
|
|
|
- foreach ($TeamObj as $heroUID) {
|
|
|
- HeroProc::HeroAddEXP($heroUID, $tili, $req);
|
|
|
- }
|
|
|
-// $carbon->stars; 暂不记录了
|
|
|
-# 掉落战利品->获取
|
|
|
- $err = StoreProc::AddMultiItemInStore($req, $reward);
|
|
|
- if ($err) {
|
|
|
- return Resp::err($err);
|
|
|
- }
|
|
|
- if (count($gateIds) == $gateindex + 1) { # 最后一个关卡
|
|
|
- unset($carbons->$key); # 关闭掉关卡,或者是直接删掉
|
|
|
- } else {
|
|
|
- $carbons->$key = $carbon; # 回存数据
|
|
|
- }
|
|
|
- $req->userInfo->game->gates->carbons->openedCarbons = $carbons;
|
|
|
- UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
|
|
|
- # Ps.备注,奖品是固定的,所以不必返回
|
|
|
- $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
|
|
|
- );
|
|
|
- return Resp::ok($result);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * [6809]新版本的挑战 副本胜利
|
|
|
- * @param Req $req
|
|
|
- */
|
|
|
- public static function NewChallengeCarbon($req) {
|
|
|
- $gates = $req->userInfo->game->gates;
|
|
|
- $carbons = $gates->carbons->openedCarbons;
|
|
|
-# 提取参数
|
|
|
- $carbonId = $req->paras[0]; # 副本ID
|
|
|
- $gateId = $req->paras[1]; # 关卡ID
|
|
|
- $difficulty = $req->paras[2]; # 难度等级 1,2,3
|
|
|
-
|
|
|
- $star = $req->paras[3]; # 战斗评价(几星)
|
|
|
- $TeamObj = $req->paras[4]; # 队伍信息
|
|
|
-
|
|
|
- if ($difficulty > 3 || $difficulty < 1) {
|
|
|
- return Resp::err(ErrCode::carbon_wrongdifficult);
|
|
|
- }
|
|
|
- $key = "$carbonId-$difficulty"; # 键值
|
|
|
- # 0 当前副本处于开启状态
|
|
|
- # 1 战斗胜利之后,副本直接关闭
|
|
|
- # 2 记录下战斗评价(几星), 也许以后用得着,比如最后通关后,给个啥奖励
|
|
|
- # 3 决定掉落物品, 发给客户端
|
|
|
- # 4 发放对应的经验之类的东西
|
|
|
- # 5 检查是否最后一个关卡, 是, 关闭副本
|
|
|
- # 6 回存数据,返回
|
|
|
-
|
|
|
- isEditor() && $carbon = new CarbonModel;
|
|
|
- if (CommUtil::isPropertyExists($carbons, $key)) {
|
|
|
- $carbon = $carbons->$key;
|
|
|
- } else {
|
|
|
- $carbon = null;
|
|
|
- }
|
|
|
- if (!$carbon || $carbon->closeTs < now()) {
|
|
|
- return Resp::err(ErrCode::carbon_closed);
|
|
|
- }
|
|
|
- unset($carbons->$key);
|
|
|
- $tl = "tili$difficulty"; # 体力难度
|
|
|
- $rwd = "reward$difficulty"; # 奖励难度
|
|
|
-
|
|
|
- $gateModel = GameConfig::gate_carbon_content_getItem($gateId); # 副本关卡常量数据
|
|
|
- $tili = $gateModel->$tl; # 扣除体力
|
|
|
- $reward = $gateModel->$rwd; # 获得奖励
|
|
|
- #
|
|
|
- # 打副本呢也要扣除体力
|
|
|
- ActiveProc::ChangeTili(-$tili, $req);
|
|
|
-
|
|
|
- // 按照概率规则发放奖品
|
|
|
- $rewardsArr = explode(";", $reward);
|
|
|
- $rwds = array();
|
|
|
- foreach ($rewardsArr as $r) {
|
|
|
- $arr = explode(',', $r);
|
|
|
- $itemid = intval($arr[0]);
|
|
|
- $num = intval($arr[1]);
|
|
|
- $probability = floatval($arr[2]); # 掉落概率精度精确到±0.01%
|
|
|
- if (CommUtil::randomPercent($probability)) { # 投色子
|
|
|
- $err = StoreProc::AddMultiItemInStore($req, "$itemid,$num");
|
|
|
- if ($err) {
|
|
|
- return Resp::err($err);
|
|
|
- }
|
|
|
- $rwds[] = "$itemid,$num";
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if ($err) {
|
|
|
- return Resp::err($err);
|
|
|
- }
|
|
|
-
|
|
|
- $req->userInfo->game->gates->carbons->openedCarbons = $carbons;
|
|
|
- UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
|
|
|
- # Ps.备注,奖品是固定的,所以不必返回
|
|
|
- SystemProc::Carbon_Win($req->zoneid, $req->userInfo->game, $carbonId, $difficulty); # 插入通过副本消息
|
|
|
- $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' => 0,
|
|
|
- 'exp' => 0,
|
|
|
- 'rewardstr' => implode(';', $rwds)
|
|
|
- );
|
|
|
- return Resp::ok($result);
|
|
|
- }
|
|
|
-
|
|
|
- /**
|
|
|
- * [6816] 挑战剧情关卡
|
|
|
- * @param type $req
|
|
|
- */
|
|
|
- public static function ChallengeStoryGate($req) {
|
|
|
- $gates = $req->userInfo->game->gates;
|
|
|
-# 提取参数
|
|
|
- $storyId = $req->paras[0]; # 剧情ID
|
|
|
- $difficulty = $req->paras[1]; # 难度等级 1,2,3
|
|
|
- $star = $req->paras[2]; # 战斗评价(几星)
|
|
|
- $TeamObj = $req->paras[3]; # 队伍信息
|
|
|
- $bossId = $req->paras[4]; # 本关消灭的bossid (<=0代表本关卡未出现boss)
|
|
|
+// /**
|
|
|
+// * [6801] 开启副本
|
|
|
+// * @param Req $req
|
|
|
+// * @deprecated since version 0
|
|
|
+// */
|
|
|
+// public static function OpenTheCarbon($req) {
|
|
|
+// $gates = $req->userInfo->game->gates;
|
|
|
+// $openedcarbons = $gates->carbons->openedCarbons;
|
|
|
+//# 提取参数
|
|
|
+// $carbonId = $req->paras[0]; # 副本ID
|
|
|
+// $difficulty = $req->paras[1]; # 难度等级 1,2,3
|
|
|
+// $key = "$carbonId-$difficulty"; # 键值
|
|
|
+// if (!($gates && $openedcarbons)) {
|
|
|
+// return Resp::err(ErrCode::err_innerfault);
|
|
|
+// }
|
|
|
+// if ($difficulty > 3 || $difficulty < 1) {
|
|
|
+// return Resp::err(ErrCode::carbon_wrongdifficult);
|
|
|
+// }
|
|
|
//
|
|
|
-#1. 判断是否有记录过剧情的战斗信息
|
|
|
- if (!CommUtil::isPropertyExists($gates, "story")) {
|
|
|
- $gates->story = ObjectInit();
|
|
|
- $gates->story->lastFinishedStoryGateId = 0;
|
|
|
- $gates->story->allFinishedStoryGateIdList = ArrayInit();
|
|
|
- }
|
|
|
- $storrRecord = $gates->story;
|
|
|
-#2.取出模式下的奖励数据
|
|
|
- $memStoryModel = GameConfig::gatestory_getItem($storyId);
|
|
|
- $tili = 0;
|
|
|
- $rewardStr = $memStoryModel->storyGateReward;
|
|
|
-
|
|
|
-#3 同步下剧情的推进进度数据
|
|
|
- if ($storrRecord->lastFinishedStoryGateId == $storyId || in_array($storyId, $storrRecord->allFinishedStoryGateIdList)) {
|
|
|
- return Resp::err(ErrCode::story_repeatfight); #剧情关卡不能重复战斗 只能打一次
|
|
|
- } else {
|
|
|
- $storrRecord->lastFinishedStoryGateId = $storyId;
|
|
|
- $storrRecord->allFinishedStoryGateIdList[] = $storyId;
|
|
|
- }
|
|
|
-#
|
|
|
-# 4 万一打剧情也扣除体力呢
|
|
|
- if ($tili > 0) {
|
|
|
- ActiveProc::ChangeTili(-$tili, $req);
|
|
|
-# 扣除多少体力就给账号增加多少经验 -by 李宁, reconfirmed by wg 20170519144109
|
|
|
- UserGameModel::Add_Exp($req, $tili);
|
|
|
-# 增加英雄经验(也是依据扣除的体力数)
|
|
|
- foreach ($TeamObj as $heroUID) {
|
|
|
- HeroProc::HeroAddEXP($heroUID, $tili, $req);
|
|
|
- }
|
|
|
- }# 5 玩家获得 剧情的战斗奖励
|
|
|
- $err = StoreProc::AddMultiItemInStore($req, $rewardStr);
|
|
|
- if ($err) {
|
|
|
- return Resp::err($err);
|
|
|
- }# 6 回存玩家的战斗记录
|
|
|
- $req->userInfo->game->gates->story = $storrRecord;
|
|
|
- UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
|
|
|
- # Ps.备注,奖品是固定的,所以不必返回
|
|
|
- $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
|
|
|
- );
|
|
|
- return Resp::ok($result);
|
|
|
- }
|
|
|
-
|
|
|
+// if (CommUtil::isPropertyExists($openedcarbons, $key)) {
|
|
|
+// $carbon = $openedcarbons->$key;
|
|
|
+// } else {
|
|
|
+// $carbon = new CarbonModel();
|
|
|
+// }
|
|
|
+// if ($carbon->closeTs > now()) {
|
|
|
+// return Resp::err(ErrCode::carbon_opened);
|
|
|
+// }
|
|
|
+// $carbonModel = GameConfig::gate_carbon_getItem($carbonId); # 常量
|
|
|
+//# 扣除开启消耗的道具
|
|
|
+// $keyid = "keyId$difficulty";
|
|
|
+// $keynum = "keyNum$difficulty";
|
|
|
+// $costItemId = $carbonModel->$keyid;
|
|
|
+// $costItemNum = $carbonModel->$keynum;
|
|
|
+//
|
|
|
+// $err = StoreProc::removeItemFromStore($req->userInfo->game->store, $costItemId, $costItemNum);
|
|
|
+// if ($err) { # 扣除失败
|
|
|
+// return Resp::err($err);
|
|
|
+// }
|
|
|
+// $carbon->closeTs = now() + $carbonModel->duration; # 关闭倒计时
|
|
|
+// $carbon->curIndex = 0; # 索引重置为0
|
|
|
+// $openedcarbons->$key = $carbon;
|
|
|
+// $req->userInfo->game->gates->carbons->openedCarbons = $openedcarbons;
|
|
|
+// UserProc::updateUserInfo($req);
|
|
|
+// return Resp::ok(array('err' => 0, 'carbons' => $openedcarbons));
|
|
|
+// }
|
|
|
+// /**
|
|
|
+// * 挑战副本关卡
|
|
|
+// * @param Req $req
|
|
|
+// * @deprecated since version number
|
|
|
+// */
|
|
|
+// public static function ChallengeCarbon($req) {
|
|
|
+// $gates = $req->userInfo->game->gates;
|
|
|
+// $carbons = $gates->carbons->openedCarbons;
|
|
|
+//# 提取参数
|
|
|
+// $carbonId = $req->paras[0]; # 副本ID
|
|
|
+// $difficulty = $req->paras[1]; # 难度等级 1,2,3
|
|
|
+// $gateindex = $req->paras[2]; # 关卡索引 0,1,2,...
|
|
|
+// $star = $req->paras[3]; # 战斗评价(几星)
|
|
|
+// $TeamObj = $req->paras[4]; # 队伍信息
|
|
|
+//// $bossId = $req->paras[5]; # 本关消灭的bossid (<=0代表本关卡未出现boss)
|
|
|
+// if ($difficulty > 3 || $difficulty < 1) {
|
|
|
+// return Resp::err(ErrCode::carbon_wrongdifficult);
|
|
|
+// }
|
|
|
+// $key = "$carbonId-$difficulty"; # 键值
|
|
|
+//# 0 当前副本处于开启状态
|
|
|
+//# 1 当前关卡索引,不能跳着打,
|
|
|
+//# 2 记录下战斗评价(几星), 也许以后用得着,比如最后通关后,给个啥奖励
|
|
|
+//# 3 决定掉落物品, 发给客户端
|
|
|
+//# 4 发放对应的经验之类的东西
|
|
|
+//# 5 检查是否最后一个关卡, 是, 关闭副本
|
|
|
+//# 6 回存数据,返回
|
|
|
+//
|
|
|
+// isEditor() && $carbon = new CarbonModel;
|
|
|
+// if (CommUtil::isPropertyExists($carbons, $key)) {
|
|
|
+// $carbon = $carbons->$key;
|
|
|
+// } else {
|
|
|
+// $carbon = null;
|
|
|
+// }
|
|
|
+// if (!$carbon || $carbon->closeTs < now()) {
|
|
|
+// return Resp::err(ErrCode::carbon_closed);
|
|
|
+// }
|
|
|
+//
|
|
|
+// $carbonModel = GameConfig::gate_carbon_getItem($carbonId); # 副本常量数据
|
|
|
+// $gateIds = explode(',', $carbonModel->gateids);
|
|
|
+// if ($gateindex < 0 || $gateindex >= count($gateIds)) {
|
|
|
+// return Resp::err(ErrCode::carbon_gateIndex);
|
|
|
+// }
|
|
|
+// if ($carbon->curIndex == $gateindex || $gateindex == 0) {
|
|
|
+// $carbon->curIndex += 1; # 更新进度
|
|
|
+// } else { # 不能跳关
|
|
|
+// return Resp::err(ErrCode::carbon_gateIndex);
|
|
|
+// }
|
|
|
+//
|
|
|
+// $gateId = $gateIds[$gateindex]; # 通过索引获得关卡ID
|
|
|
+// $tl = "tili$difficulty"; # 体力难度
|
|
|
+// $rwd = "reward$difficulty"; # 奖励难度
|
|
|
+// $arr = array("normal", 'hard', 'elite'); # 难度名称
|
|
|
+// $gt = $arr[$difficulty - 1]; # 关卡分类
|
|
|
+// $gateModel = GameConfig::gate_carbon_content_getItem($gateId); # 副本关卡常量数据
|
|
|
+// $tili = $gateModel->$tl; # 扣除体力
|
|
|
+// $reward = $gateModel->$rwd; # 获得奖励
|
|
|
+//#
|
|
|
+//# 打副本呢也要扣除体力
|
|
|
+// ActiveProc::ChangeTili(-$tili, $req);
|
|
|
+//# 扣除多少体力就给账号增加多少经验 -by 李宁, reconfirmed by wg 20170519144109
|
|
|
+// UserGameModel::Add_Exp($req, $tili);
|
|
|
+//# 增加英雄经验(也是依据扣除的体力数)
|
|
|
+// foreach ($TeamObj as $heroUID) {
|
|
|
+// HeroProc::HeroAddEXP($heroUID, $tili, $req);
|
|
|
+// }
|
|
|
+//// $carbon->stars; 暂不记录了
|
|
|
+//# 掉落战利品->获取
|
|
|
+// $err = StoreProc::AddMultiItemInStore($req, $reward);
|
|
|
+// if ($err) {
|
|
|
+// return Resp::err($err);
|
|
|
+// }
|
|
|
+// if (count($gateIds) == $gateindex + 1) { # 最后一个关卡
|
|
|
+// unset($carbons->$key); # 关闭掉关卡,或者是直接删掉
|
|
|
+// } else {
|
|
|
+// $carbons->$key = $carbon; # 回存数据
|
|
|
+// }
|
|
|
+// $req->userInfo->game->gates->carbons->openedCarbons = $carbons;
|
|
|
+// UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
|
|
|
+// # Ps.备注,奖品是固定的,所以不必返回
|
|
|
+// $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
|
|
|
+// );
|
|
|
+// return Resp::ok($result);
|
|
|
+// }
|
|
|
+// /**
|
|
|
+// * [6809]新版本的挑战 副本胜利
|
|
|
+// * @param Req $req
|
|
|
+// * @deprecated since version 0
|
|
|
+// */
|
|
|
+// public static function NewChallengeCarbon($req) {
|
|
|
+// $gates = $req->userInfo->game->gates;
|
|
|
+// $carbons = $gates->carbons->openedCarbons;
|
|
|
+//# 提取参数
|
|
|
+// $carbonId = $req->paras[0]; # 副本ID
|
|
|
+// $gateId = $req->paras[1]; # 关卡ID
|
|
|
+// $difficulty = $req->paras[2]; # 难度等级 1,2,3
|
|
|
+//
|
|
|
+// $star = $req->paras[3]; # 战斗评价(几星)
|
|
|
+// $TeamObj = $req->paras[4]; # 队伍信息
|
|
|
+//
|
|
|
+// if ($difficulty > 3 || $difficulty < 1) {
|
|
|
+// return Resp::err(ErrCode::carbon_wrongdifficult);
|
|
|
+// }
|
|
|
+// $key = "$carbonId-$difficulty"; # 键值
|
|
|
+// # 0 当前副本处于开启状态
|
|
|
+// # 1 战斗胜利之后,副本直接关闭
|
|
|
+// # 2 记录下战斗评价(几星), 也许以后用得着,比如最后通关后,给个啥奖励
|
|
|
+// # 3 决定掉落物品, 发给客户端
|
|
|
+// # 4 发放对应的经验之类的东西
|
|
|
+// # 5 检查是否最后一个关卡, 是, 关闭副本
|
|
|
+// # 6 回存数据,返回
|
|
|
+//
|
|
|
+// isEditor() && $carbon = new CarbonModel;
|
|
|
+// if (CommUtil::isPropertyExists($carbons, $key)) {
|
|
|
+// $carbon = $carbons->$key;
|
|
|
+// } else {
|
|
|
+// $carbon = null;
|
|
|
+// }
|
|
|
+// if (!$carbon || $carbon->closeTs < now()) {
|
|
|
+// return Resp::err(ErrCode::carbon_closed);
|
|
|
+// }
|
|
|
+// unset($carbons->$key);
|
|
|
+// $tl = "tili$difficulty"; # 体力难度
|
|
|
+// $rwd = "reward$difficulty"; # 奖励难度
|
|
|
+//
|
|
|
+// $gateModel = GameConfig::gate_carbon_content_getItem($gateId); # 副本关卡常量数据
|
|
|
+// $tili = $gateModel->$tl; # 扣除体力
|
|
|
+// $reward = $gateModel->$rwd; # 获得奖励
|
|
|
+// #
|
|
|
+// # 打副本呢也要扣除体力
|
|
|
+// ActiveProc::ChangeTili(-$tili, $req);
|
|
|
+//
|
|
|
+// // 按照概率规则发放奖品
|
|
|
+// $rewardsArr = explode(";", $reward);
|
|
|
+// $rwds = array();
|
|
|
+// foreach ($rewardsArr as $r) {
|
|
|
+// $arr = explode(',', $r);
|
|
|
+// $itemid = intval($arr[0]);
|
|
|
+// $num = intval($arr[1]);
|
|
|
+// $probability = floatval($arr[2]); # 掉落概率精度精确到±0.01%
|
|
|
+// if (CommUtil::randomPercent($probability)) { # 投色子
|
|
|
+// $err = StoreProc::AddMultiItemInStore($req, "$itemid,$num");
|
|
|
+// if ($err) {
|
|
|
+// return Resp::err($err);
|
|
|
+// }
|
|
|
+// $rwds[] = "$itemid,$num";
|
|
|
+// }
|
|
|
+// }
|
|
|
+//
|
|
|
+// if ($err) {
|
|
|
+// return Resp::err($err);
|
|
|
+// }
|
|
|
+//
|
|
|
+// $req->userInfo->game->gates->carbons->openedCarbons = $carbons;
|
|
|
+// UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
|
|
|
+// # Ps.备注,奖品是固定的,所以不必返回
|
|
|
+// SystemProc::Carbon_Win($req->zoneid, $req->userInfo->game, $carbonId, $difficulty); # 插入通过副本消息
|
|
|
+// $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' => 0,
|
|
|
+// 'exp' => 0,
|
|
|
+// 'rewardstr' => implode(';', $rwds)
|
|
|
+// );
|
|
|
+// return Resp::ok($result);
|
|
|
+// }
|
|
|
+// /**
|
|
|
+// * [6816] 挑战剧情关卡
|
|
|
+// * @param type $req
|
|
|
+// * @deprecated since version 0
|
|
|
+// */
|
|
|
+// public static function ChallengeStoryGate($req) {
|
|
|
+// $gates = $req->userInfo->game->gates;
|
|
|
+//# 提取参数
|
|
|
+// $storyId = $req->paras[0]; # 剧情ID
|
|
|
+// $difficulty = $req->paras[1]; # 难度等级 1,2,3
|
|
|
+// $star = $req->paras[2]; # 战斗评价(几星)
|
|
|
+// $TeamObj = $req->paras[3]; # 队伍信息
|
|
|
+// $bossId = $req->paras[4]; # 本关消灭的bossid (<=0代表本关卡未出现boss)
|
|
|
+////
|
|
|
+//#1. 判断是否有记录过剧情的战斗信息
|
|
|
+// if (!CommUtil::isPropertyExists($gates, "story")) {
|
|
|
+// $gates->story = ObjectInit();
|
|
|
+// $gates->story->lastFinishedStoryGateId = 0;
|
|
|
+// $gates->story->allFinishedStoryGateIdList = ArrayInit();
|
|
|
+// }
|
|
|
+// $storrRecord = $gates->story;
|
|
|
+//#2.取出模式下的奖励数据
|
|
|
+// $memStoryModel = GameConfig::gatestory_getItem($storyId);
|
|
|
+// $tili = 0;
|
|
|
+// $rewardStr = $memStoryModel->storyGateReward;
|
|
|
+//
|
|
|
+//#3 同步下剧情的推进进度数据
|
|
|
+// if ($storrRecord->lastFinishedStoryGateId == $storyId || in_array($storyId, $storrRecord->allFinishedStoryGateIdList)) {
|
|
|
+// return Resp::err(ErrCode::story_repeatfight); #剧情关卡不能重复战斗 只能打一次
|
|
|
+// } else {
|
|
|
+// $storrRecord->lastFinishedStoryGateId = $storyId;
|
|
|
+// $storrRecord->allFinishedStoryGateIdList[] = $storyId;
|
|
|
+// }
|
|
|
+//#
|
|
|
+//# 4 万一打剧情也扣除体力呢
|
|
|
+// if ($tili > 0) {
|
|
|
+// ActiveProc::ChangeTili(-$tili, $req);
|
|
|
+//# 扣除多少体力就给账号增加多少经验 -by 李宁, reconfirmed by wg 20170519144109
|
|
|
+// UserGameModel::Add_Exp($req, $tili);
|
|
|
+//# 增加英雄经验(也是依据扣除的体力数)
|
|
|
+// foreach ($TeamObj as $heroUID) {
|
|
|
+// HeroProc::HeroAddEXP($heroUID, $tili, $req);
|
|
|
+// }
|
|
|
+// }# 5 玩家获得 剧情的战斗奖励
|
|
|
+// $err = StoreProc::AddMultiItemInStore($req, $rewardStr);
|
|
|
+// if ($err) {
|
|
|
+// return Resp::err($err);
|
|
|
+// }# 6 回存玩家的战斗记录
|
|
|
+// $req->userInfo->game->gates->story = $storrRecord;
|
|
|
+// UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
|
|
|
+// # Ps.备注,奖品是固定的,所以不必返回
|
|
|
+// $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
|
|
|
+// );
|
|
|
+// return Resp::ok($result);
|
|
|
+// }
|
|
|
//
|
|
|
// </editor-fold>
|
|
|
//
|