SweepGatesProc.php 45 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072
  1. <?php
  2. namespace loyalsoft;
  3. /**
  4. * 战斗 - 关卡
  5. * @author gwang
  6. */
  7. class SweepGatesProc {
  8. //
  9. // <editor-fold defaultstate="collapsed" desc="三层关卡">
  10. /**
  11. * [6817]新版本的挑战地图关卡
  12. * @param req $req
  13. */
  14. public static function NewArenas_Fight($req) {
  15. # 提取参数
  16. $gateId = $req->paras[0]; # 0. 挑战的关卡Id
  17. $difficulty = $req->paras[1]; # 1. 关卡难度 difficulty
  18. $star = $req->paras[2]; # 2. 几星
  19. $TeamObj = $req->paras[3]; # 3. 队伍信息
  20. $bossId = $req->paras[4]; # 4. 本关消灭的bossid (<=0代表本关卡未出现boss)
  21. $rewards = $req->paras[5]; # 5. 本关获得的宝箱列表,id:num,id:num,...
  22. $smGate = GameConfig::gate_getItem($gateId); # 关卡配置数据
  23. ///按 三个难度取不同的值.
  24. $i = $difficulty + 1;
  25. $tili = self::getProperty_n($smGate, "tili", $i);
  26. // $reward = self::getProperty_n($smGate, "reward", $i);
  27. $gold = self::getProperty_n($smGate, "gold", $i);
  28. $exp = self::getProperty_n($smGate, "exp", $i);
  29. self::newRecordFight($req, $gateId, $difficulty, $star); # 更新战斗记录
  30. $canfighterr = SweepGatesProc::CanFight($req, $gateId, $difficulty); # 是否可以挑战当前关卡计算
  31. if ($canfighterr) { # 不能符合战斗要求
  32. return $canfighterr;
  33. }
  34. //
  35. ActiveProc::ChangeTili(-$tili, $req); # 扣减体力
  36. $req->userInfo->game->gates->TotalNum++; # 更新战斗次数统计
  37. $req->userInfo->game->gates->Times++;
  38. ///增加英雄经验 组长去掉
  39. foreach ($TeamObj as $heroUID) {
  40. HeroProc::HeroAddEXP($heroUID, $tili, $req);
  41. }
  42. $rewardsArr = explode(",", $rewards); // 开箱子抽奖品
  43. $rewardArr = array();
  44. foreach ($rewardsArr as $r) {
  45. $arr = explode(':', $r);
  46. $boxID = intval($arr[0]);
  47. $num = intval($arr[1]);
  48. // $boxMo = GameConfig::item_box_getItem($boxID);
  49. $boxPool = GameConfig::boxpool_getItem($boxID); # 提取对应序列的奖池,
  50. $itemArr = array_filter($boxPool, function($item) use($dropindex) { # 这一步形同虚设了. 所有dropType都填的1
  51. return $item->dropType == 1;
  52. });
  53. $itemArr = Lotterys::FilterPrizepool($req, $itemArr); # 对奖池依解锁等级进行过滤
  54. foreach ($itemArr as $item) {
  55. $prop = $item->normal;
  56. if ($prop < 0) {
  57. $prop = 0;
  58. }
  59. $item->probability = $prop;
  60. }
  61. $err = Lotterys::Dice($itemArr, $num, $rewardstr); # 投骰子
  62. if ($err != ErrCode::ok) { # 出错了
  63. return Resp::err($err);
  64. }
  65. if (strlen($rewardstr) <= 0) { # 抽奖结果为空
  66. return Resp::err(ErrCode::err_innerfault);
  67. }
  68. $rewardArr[] = $rewardstr;
  69. }
  70. if ($bossId > 0) { # boss关处理
  71. $req->userInfo->game->gates->killedBoss[] = $bossId;
  72. }
  73. $err = UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $gold); # 发放金币奖励
  74. if ($err != ErrCode::ok) {
  75. return Resp::err($err);
  76. }
  77. UserGameModel::Add_Exp($req, $exp); # 发放经验奖励
  78. UserProc::updateUserInfo($req); # 在获取战利品哪里已经update了.
  79. $result = array(
  80. 'store' => $req->userInfo->game->store,
  81. 'heros' => $req->userInfo->game->heros,
  82. 'gates' => $req->userInfo->game->gates,
  83. 'tili' => $req->userInfo->game->tili,
  84. 'time' => $req->userInfo->game->privateState->TiliTime,
  85. 'gold' => $gold,
  86. 'exp' => $exp,
  87. 'rewardstr' => implode(';', $rewardArr)
  88. );
  89. return Resp::ok($result);
  90. }
  91. /**
  92. * 更新战斗记录(新)
  93. * @param req $req
  94. * @param type $gateId
  95. * @param type $difficulty
  96. * @param type $star
  97. */
  98. private static function newRecordFight($req, $gateId, $difficulty, $star) {
  99. if (!CommUtil::isPropertyExists($req->userInfo->game->gates, "newGateRecord")) {
  100. $req->userInfo->game->gates->newGateRecord = ObjectInit(); # 防御未初始化的变量
  101. }
  102. $gatesRecord = $req->userInfo->game->gates->newGateRecord;
  103. if (!CommUtil::isPropertyExists($gatesRecord, "record")) { # 防御未初始化的变量
  104. $gatesRecord->record = ObjectInit();
  105. }
  106. if (!CommUtil::isPropertyExists($gatesRecord->record, $gateId)) { # 补充战斗记录
  107. $gatesRecord->record->$gateId = ObjectInit();
  108. }
  109. if ($difficulty <= 0) {
  110. $gatesRecord->record->$gateId->normal = $star;
  111. if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "normalToday")) {
  112. $gatesRecord->record->$gateId->normalToday = 0;
  113. }
  114. } else if ($difficulty == 1) {
  115. $gatesRecord->record->$gateId->hard = $star;
  116. if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "hardToday")) {
  117. $gatesRecord->record->$gateId->hardToday = 0;
  118. }
  119. } else if ($difficulty == 2) {
  120. $gatesRecord->record->$gateId->elite = $star;
  121. if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "eliteToday")) {
  122. $gatesRecord->record->$gateId->eliteToday = 0;
  123. }
  124. }
  125. $req->userInfo->game->gates->newGateRecord = $gatesRecord; # 回写数据
  126. }
  127. // /**
  128. // * [6818]更改地图所停留的城镇
  129. // * //需要消耗体力
  130. // * @param type $req
  131. // * @deprecated since version 0
  132. // */
  133. // public static function ChangeArenas_StayCity($req) {
  134. //# 提取参数
  135. //# 0. 目标地址
  136. //# 1. 消耗体力
  137. // $cityId = $req->paras[0];
  138. // $costTili = $req->paras[1];
  139. // if (!CommUtil::isPropertyExists($req->userInfo->game->gates, "newGateRecord")) {
  140. // $req->userInfo->game->gates->newGateRecord = ObjectInit();
  141. // }
  142. // $gatesRecord = $req->userInfo->game->gates->newGateRecord;
  143. //
  144. // #在此补充检查消耗体力的数值是否正确
  145. // #
  146. //
  147. // $gatesRecord->lastStayCityId = $cityId;
  148. // $req->userInfo->game->gates->newGateRecord = $gatesRecord;
  149. // #体力变化
  150. // ActiveProc::ChangeTili(-$costTili, $req);
  151. // UserProc::updateUserInfo($req);
  152. //
  153. // $result = array(
  154. // 'gates' => $req->userInfo->game->gates,
  155. // 'tili' => $req->userInfo->game->tili,
  156. // 'time' => $req->userInfo->game->privateState->TiliTime,
  157. // );
  158. // return Resp::ok($result);
  159. // }
  160. // </editor-fold>
  161. //
  162. /**
  163. * 提取某个对象的某个字段(利用后面2个参数组合为字段名)
  164. * @param type $obj
  165. * @param type $name
  166. * @param type $index
  167. * @return type
  168. */
  169. private static function getProperty_n($obj, $name, $index) {
  170. if (is_object($obj)) {
  171. $ke = "$name$index";
  172. if (property_exists($obj, $ke)) {
  173. return $obj->$ke;
  174. }
  175. }
  176. return null;
  177. }
  178. /**
  179. * [6801] 关卡挑战1次
  180. * @param Req $req
  181. */
  182. public static function Arenas_Fight($req) {
  183. list($gateId, $difficulty, $star, $TeamObj) = $req->paras; # 提取参数: 挑战的关卡Id, 关卡难度(0,1,2), 几星, 队伍
  184. Resp::assert($gateId > 0, "关卡id非法");
  185. $isFirst = false; # 是否首次通关
  186. self::recordFight($req, $gateId, $difficulty, $star, $isFirst); # 更新挑战记录
  187. // CLog::err($isFirst);
  188. $smGate = GameConfig::gate_getItem($gateId); # 关卡配置数据
  189. $i = $difficulty + 1; # 按三个难度取不同的值.
  190. // $tili = self::getProperty_n($smGate, "tili", $i); # 体力暂时未用上
  191. $rwdstr = self::getProperty_n($smGate, "reward", $i);
  192. $firstPassRewardStr = self::getProperty_n($smGate, 'first_reward', $i);
  193. $gold = self::getProperty_n($smGate, "gold", $i);
  194. $exp = self::getProperty_n($smGate, "exp", $i);
  195. $firstExp = self::getProperty_n($smGate, "first_exp", $i);
  196. $heroExp = self::getProperty_n($smGate, "heroExp", $i);
  197. if ($isFirst) { # 是否首次通关切换奖励内容
  198. $exp = $firstExp;
  199. $rwdstr = $firstPassRewardStr;
  200. }
  201. // ActiveProc::ChangeTili(-$tili, $req); # 扣减体力变化
  202. // UserGameModel::Add_Exp($req->mem, $req->userInfo->game, $tili); # 老的增加玩家经验的去掉
  203. //
  204. foreach ($TeamObj as $heroUID) {
  205. HeroProc::HeroAddEXP($heroUID, $heroExp, $req); # 增加英雄经验
  206. }
  207. $rewardArr = array(); # 统计所获奖励物品
  208. $rewardArr = array_merge($rewardArr, self::SetRewards($req, $rwdstr)); # 通关奖励
  209. UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $gold); # 发金币
  210. UserGameModel::Add_Exp($req, $exp); # 给玩家(指挥官)增加经验
  211. UserProc::updateUserInfo($req); # 回写玩家数据.
  212. $result = array(
  213. 'store' => $req->userInfo->game->store,
  214. 'heros' => $req->userInfo->game->heros,
  215. 'gates' => $req->userInfo->game->gates,
  216. 'tili' => $req->userInfo->game->tili,
  217. 'time' => $req->userInfo->game->privateState->TiliTime,
  218. 'gold' => $gold,
  219. 'exp' => $exp,
  220. 'rewardstr' => implode(';', $rewardArr)
  221. );
  222. return Resp::ok($result);
  223. }
  224. /**
  225. * 发放奖励串
  226. * @param Req $req
  227. * @param type $rewardStr
  228. */
  229. public static function SetRewards($req, $rewardStr) {
  230. $getedArr = array(); # 统计所获奖励物品
  231. $rewardsArr = explode(";", $rewardStr);
  232. foreach ($rewardsArr as $r) { #
  233. if (strlen($r) <= 0) { # 奖励串为空
  234. Err(ErrCode::err_innerfault);
  235. }
  236. $percentStr = explode(',', $r)[2];
  237. $percent = intval(trim($percentStr, "%")); # 剔除%
  238. if (CommUtil::randomPercent($percent)) {
  239. $err = StoreProc::AddMultiItemInStore($req, $r); # 发放奖励物品
  240. if ($err != ErrCode::ok) { # 出错了
  241. Err($err);
  242. }
  243. $getedArr[] = substr($r, 0, strrpos($r, ',')); # 剔除最后一段概率字符串
  244. }
  245. }
  246. return $getedArr;
  247. }
  248. /**
  249. * 更新战斗记录
  250. * @param req $req
  251. * @param type $gateId
  252. * @param type $difficulty
  253. * @param type $star
  254. */
  255. private static function recordFight($req, $gateId, $difficulty, $star, &$isFirst = false) {
  256. $userGates = $req->userInfo->game->gates;
  257. if ($difficulty == 0) { # 按照难度查找
  258. $diffCult = $userGates->normal;
  259. } else if ($difficulty == 1) {
  260. $diffCult = $userGates->hard;
  261. } else if ($difficulty == 2) {
  262. $diffCult = $userGates->elite;
  263. } else {
  264. Err(ErrCode::err_arenas_difficulty); # 找不到难度类型
  265. }
  266. $typeId = substr($diffCult->highest, 0, 3); # 防御: 分类头不对
  267. if ($typeId != '503') {
  268. $diffCult->highest = 503000; # 设置为关卡第一关
  269. }
  270. if ($gateId > $diffCult->highest + 1) { # 不能跳关
  271. Err(ErrCode::err_arenasgate_indexillegal);
  272. }
  273. if ($gateId == $diffCult->highest + 1 && $star > 0) { # 星级大于等于0,才可以推关
  274. $diffCult->highest += 1; # 更新最高记录
  275. }
  276. $diffCult->latest = $gateId; # 记录上次挑战关卡id
  277. $uGate = new UGateModel(); # 当前关卡的记录数据
  278. if (isset($diffCult->gates->$gateId)) {
  279. $uGate = $diffCult->gates->$gateId;
  280. }
  281. $uGate->challengeTimes++; # 当前关卡挑战次数
  282. if ($uGate->star < $star) { # 当前关卡得分评星
  283. $uGate->star = $star;
  284. }
  285. // CLog::err($uGate);
  286. if (!$uGate->cleared) {
  287. $uGate->cleared = 1; # 当前关卡是否已通关
  288. $isFirst = true;
  289. // CLog::err($uGate);
  290. }
  291. $diffCult->gates->$gateId = $uGate; # 回写关卡记录
  292. $userGates->TotalNum++; # 总战斗次数+1
  293. $userGates->Times++;
  294. $req->userInfo->game->gates = $userGates; # 回写数据
  295. }
  296. /**
  297. * 清理每个难度副本的每日战斗次数
  298. * @param Req $req
  299. */
  300. public static function ClearGateTimes($req) {
  301. $req->userInfo->game->gates->Times = 0;
  302. }
  303. //
  304. // <editor-fold defaultstate="collapsed" desc=" 扫荡 ">
  305. // /**
  306. // * 关卡-扫荡
  307. // * @param RequestVo $req
  308. // */
  309. // public static function Arenas_SweepFight($req)
  310. // {
  311. // $resp = ResponseVo::err($req, ErrCode::msg_methodnotimplement);
  312. // # 提取参数
  313. // # 0. 扫荡的关卡Id
  314. // # 1. 扫荡次数
  315. // # 2. 挑战记录 // 验证之用.
  316. // $gateId = $req->paras[0];
  317. // $iNum = $req->paras[1];
  318. // $fightLog = $req->paras[2];
  319. // $isNewbieGuideGate = false;
  320. // $gates = $req->userInfo->game->gates;
  321. // if ($gateId == 504001) {
  322. // $isNewbieGuideGate = true;
  323. // }
  324. // if ($iNum && !$fightLog) {# 检查挑战记录
  325. // return ResponseVo::err($req, ErrCode::err_arenas_logillegal);
  326. // }
  327. // if (!$isNewbieGuideGate) {
  328. // if ($gateId > $gates->highest + 1) { # 不能跳关
  329. // return ResponseVo::err($req, ErrCode::err_arenasgate_indexillegal);
  330. // }
  331. // }
  332. // #记录数据
  333. // $uGate = new UGateModel();
  334. // if (isset($gates->gates->$gateId)) {
  335. // $uGate = $gates->gates->$gateId;
  336. // }
  337. // $uGate->challengeTimes += $iNum;
  338. // $gates->gates->$gateId = $uGate;
  339. // UserProc::updateUserInfo($req);
  340. // $resp = ResponseVo::ok($req, array()); // 返回成功,以及奖励数据
  341. //
  342. // return $resp;
  343. // }
  344. /**
  345. * [6802]新扫荡
  346. * @param req $req
  347. */
  348. public static function Arenas_NewSweepFight($req) {
  349. $gateId = $req->paras[0];
  350. $difficulty = $req->paras[1]; # 关卡难度 difficulty
  351. $costItemId = $req->paras[2]; #扫荡券id
  352. $smGate = GameConfig::gate_getItem($gateId);
  353. if (!CommUtil::isPropertyExists($req->userInfo->game->gates, "newGateRecord")) {
  354. $req->userInfo->game->gates->newGateRecord = ObjectInit(); # 防御未初始化的变量
  355. }
  356. $gatesRecord = $req->userInfo->game->gates->newGateRecord;
  357. if (!CommUtil::isPropertyExists($gatesRecord, "record")) {
  358. $gatesRecord->record = ObjectInit(); # 防御未初始化的变量
  359. }
  360. ///按 三个难度取不同的值.
  361. $i = $difficulty + 1;
  362. $tili = self::getProperty_n($smGate, "tili", $i);
  363. $reward = self::getProperty_n($smGate, "reward", $i);
  364. $gold = self::getProperty_n($smGate, "gold", $i);
  365. $exp = self::getProperty_n($smGate, "exp", $i);
  366. $err = StoreProc::removeItemFromStore($req->userInfo->game->store, $costItemId, 1);
  367. if ($err) { # 扣除失败
  368. return Resp::err($err);
  369. }
  370. #补充战斗记录
  371. $canfighterr = SweepGatesProc::CanFight($req, $gateId, $difficulty);
  372. if ($canfighterr) {#不能符合战斗要求
  373. return $canfighterr;
  374. }
  375. //
  376. $req->userInfo->game->gates->newGateRecord = $gatesRecord; # 回写数据
  377. ActiveProc::ChangeTili(- $tili, $req); # 扣减体力
  378. $req->userInfo->game->gates->TotalNum++; # 更新战斗次数统计
  379. $req->userInfo->game->gates->Times++;
  380. // 按照概率规则发放奖品
  381. $rewardsArr = explode(";", $reward);
  382. $rwds = array();
  383. foreach ($rewardsArr as $r) {
  384. $arr = explode(',', $r);
  385. $itemid = intval($arr[0]);
  386. $num = intval($arr[1]);
  387. $probability = intval($arr[2]);
  388. if (CommUtil::randomPercent($probability)) { # 投色子
  389. $err = StoreProc::AddMultiItemInStore($req, "$itemid,$num");
  390. if ($err) {
  391. return Resp::err($err);
  392. }
  393. $rwds[] = "$itemid,$num";
  394. }
  395. }
  396. UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $gold); # 发放金币奖励
  397. if ($err) {
  398. return Resp::err($err);
  399. }
  400. UserGameModel::Add_Exp($req, $exp); # 发放经验奖励
  401. UserProc::updateUserInfo($req); # 在获取战利品哪里已经update了.
  402. $result = array(
  403. 'store' => $req->userInfo->game->store,
  404. 'heros' => $req->userInfo->game->heros,
  405. 'gates' => $req->userInfo->game->gates,
  406. 'tili' => $req->userInfo->game->tili,
  407. 'time' => $req->userInfo->game->privateState->TiliTime,
  408. 'gold' => $gold,
  409. 'exp' => $exp,
  410. 'rewardstr' => implode(';', $rwds)
  411. );
  412. return Resp::ok($result);
  413. }
  414. /**
  415. * 是否可以战斗
  416. * @param type $req
  417. * @param $gateId
  418. * @param $difficulty
  419. * @return type
  420. */
  421. static function CanFight($req, $gateId, $difficulty) {
  422. $gatesRecord = $req->userInfo->game->gates->newGateRecord;
  423. $smGate = GameConfig::gate_getItem($gateId);
  424. if (!CommUtil::isPropertyExists($gatesRecord->record, $gateId)) {
  425. $gatesRecord->record->$gateId = ObjectInit();
  426. }
  427. if ($difficulty > 2) {
  428. return Resp::err(ErrCode::err_arenasgate_indexillegal);
  429. }
  430. if ($difficulty == 0) {
  431. if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "normal")) {
  432. return Resp::err(ErrCode::err_arenas_normalgate_numno);
  433. }
  434. if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "normalToday")) {
  435. return Resp::err(ErrCode::err_arenas_normalgate_numno);
  436. }
  437. if ($smGate->cishu1 - $gatesRecord->record->$gateId->normalToday < 1) {
  438. return Resp::err(ErrCode::err_arenas_normalgate_numno);
  439. }
  440. $gatesRecord->record->$gateId->normalToday += 1;
  441. } else if ($difficulty == 1) {
  442. if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "hard")) {
  443. return Resp::err(ErrCode::err_arenas_normalgate_numno);
  444. }
  445. if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "hardToday")) {
  446. return Resp::err(ErrCode::err_arenas_normalgate_numno);
  447. }
  448. if ($smGate->cishu2 - $gatesRecord->record->$gateId->hardToday < 1) {
  449. return Resp::err(ErrCode::err_arenas_normalgate_numno);
  450. }
  451. $gatesRecord->record->$gateId->hardToday += 1;
  452. } else if ($difficulty == 2) {
  453. if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "elite")) {
  454. return Resp::err(ErrCode::err_arenas_normalgate_numno);
  455. }
  456. if (!CommUtil::isPropertyExists($gatesRecord->record->$gateId, "eliteToday")) {
  457. return Resp::err(ErrCode::err_arenas_normalgate_numno);
  458. }
  459. if ($smGate->cishu3 - $gatesRecord->record->$gateId->eliteToday < 1) {
  460. return Resp::err(ErrCode::err_arenas_normalgate_numno);
  461. }
  462. $gatesRecord->record->$gateId->eliteToday += 1;
  463. }
  464. return null; // false
  465. }
  466. // </editor-fold>
  467. //
  468. /**
  469. * [6803] 关卡—————— 根据星星数量获得对应奖励
  470. * @param type $req
  471. * @deprecated since version 0 用新版
  472. */
  473. public static function GetArenasStarReward($req) {
  474. return Resp::err(ErrCode::err_method_notimplement); # 屏蔽此方法
  475. $rewardID = $req->paras[0]; //奖励的数据ID
  476. $rewardCfg = GameConfig::gate_starreward_getItem($rewardID);
  477. if (!$rewardCfg) { //1.检查奖励数据是否存在
  478. return Resp::err(ErrCode::err_arenas_starreward_const_no);
  479. }
  480. $gates = $req->userInfo->game->gates;
  481. $getStarRewardRecord = ArrayInit();
  482. if (CommUtil::isPropertyExists($gates, "starRewards")) { //2.检查玩家是否已经领取了
  483. $getStarRewardRecord = $gates->starRewards;
  484. }
  485. if (CommUtil::isInArray($getStarRewardRecord, $rewardID)) {
  486. return Resp::err(ErrCode::err_arenas_hasgetstarreward);
  487. }
  488. $totalStarNum = 0; # 总得星数
  489. $normalRecord = $gates->normal;
  490. foreach ($normalRecord->gates as $key => $gate) {
  491. $totalStarNum += $gate->star;
  492. }
  493. $hardRecord = $gates->hard;
  494. foreach ($hardRecord->gates as $key => $gate) {
  495. $totalStarNum += $gate->star;
  496. }
  497. $eliteRecord = $gates->elite;
  498. foreach ($eliteRecord->gates as $key => $gate) {
  499. $totalStarNum += $gate->star;
  500. }
  501. DebugHelper::var_dump($totalStarNum);
  502. if ($totalStarNum < $rewardCfg->star) { //3.检查玩家的当前星星数是否满足数量要求
  503. return Resp::err(ErrCode::err_arenas_starreward_starNotEnough);
  504. }
  505. $rewardStr = $rewardCfg->reward;
  506. $arr_reward = explode(",", $rewardStr);
  507. $itemId = $arr_reward[0];
  508. $itemNum = $arr_reward[1];
  509. $str1 = substr($itemId, 0, 3);
  510. switch ($str1) {
  511. case "101": ///怪物卡或者英雄卡牌获取
  512. case "201":
  513. // HeroProc::AddHeroTFromStore($req, $itemId);
  514. break;
  515. case "301": ///装备物品的获取.
  516. case "302":
  517. case "303":
  518. StoreProc::PutEquipInStore($itemId, $req);
  519. break;
  520. case "304": // 宝石的获取
  521. StoreProc:: PutOverlyingItemInStore($itemId, $itemNum, $req);
  522. break;
  523. case "399":
  524. if ($itemId == "399002") { // 金币的获取
  525. UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $itemNum);
  526. }
  527. break;
  528. default:
  529. break;
  530. }
  531. $getStarRewardRecord[] = $rewardID; // 保存记录
  532. $req->userInfo->game->gates->starRewards = $getStarRewardRecord;
  533. UserProc::updateUserInfo($req); // 更新数据库数据
  534. $result = array(
  535. "getreward" => true
  536. );
  537. return Resp::ok($result);
  538. }
  539. //
  540. // <editor-fold defaultstate="collapsed" desc=" 好友租借 ">
  541. // /**
  542. // * [6805] 查询租借好友记录
  543. // * @param Req $req
  544. // */
  545. // public static function GetBorrowedFriends($req) {
  546. //// 查询好友借用记录中的数据
  547. // $rentedfriends = $req->userInfo->game->privateState->rentedFriends;
  548. // if (!$rentedfriends || !is_array($rentedfriends)) {
  549. // $rentedfriends = ArrayInit();
  550. // }
  551. // return Resp::ok(array('ret' => $rentedfriends));
  552. // }
  553. //
  554. // /**
  555. // * 清理战斗租借好友记录
  556. // *
  557. // */
  558. // public static function ClearFightRentRecord($req) {
  559. // $req->userInfo->game->privateState->rentedFriends = ArrayInit();
  560. // }
  561. //
  562. // /**
  563. // * [6806] 扣除借用好友费用
  564. // * @param Req $req
  565. // */
  566. // public static function ConsumeBorrowFriend($req) {
  567. //// 提取参数:好友id
  568. // $friend_uid = $req->paras[0];
  569. //// 验证好友关系
  570. // if (!FriendProc::isFriendship($req->zoneid, $req->uid, $friend_uid)) {
  571. // return Resp::err(ErrCode::friend_no_err);
  572. // }
  573. //// 验证尚未租借过
  574. // $rentedfriends = $req->userInfo->game->privateState->rentedFriends;
  575. // if (!$rentedfriends || !is_array($rentedfriends)) {
  576. // $rentedfriends = ArrayInit();
  577. // }
  578. // if (in_array($friend_uid, $rentedfriends)) {
  579. // return Resp::err(array('err' => -1, 'msg' => 'has rented this player today!'));
  580. // }
  581. //// 验证好友出借英雄
  582. // $friend_info = UserProc::getUserInfo(gMem(), $req->zoneid, $friend_uid);
  583. // if (!$friend_info) {
  584. // return Resp::err(ErrCode::user_no_err, '找不到好友的游戏数据!');
  585. // }
  586. //// todo:啦啦啦... 先不写了,管它用的是哪个英雄呢
  587. ////
  588. //// 扣除费用,失败->金币不足
  589. // $arr = explode(',', glc()->User_Friends_HireFriendForBattle_Cost);
  590. // if (count($arr) < 2) {
  591. // return Resp::err(ErrCode::err_const_no);
  592. // }
  593. // $itemid = $arr[0]; # 道具id
  594. // $amt = $arr[1]; # 数量
  595. // if ($itemid == META_GOLD_ITEMID) {
  596. // $user = $req->userInfo->game;
  597. // if ($user->gold < $amt) {
  598. // return Resp::err(array('err' => -2, 'msg' => 'gold not enough!'));
  599. // }
  600. // UserGameModel::Consume_Gold($user, $amt);
  601. //// todo: 给好友发送金币 邮件
  602. // EmailProc::SendHireCoinFromFight($req->zoneid, $friend_uid, #
  603. // $req->userInfo->game->name, $req->uid, $amt); # 好友收益需要扣除系统税率.
  604. // } else {
  605. // return Resp::err(ErrCode::err_const_no);
  606. // }
  607. //// 添加借用记录
  608. // $rentedfriends[] = $friend_uid;
  609. // $req->userInfo->game->privateState->rentedFriends = $rentedfriends;
  610. //// 回写数据
  611. // UserProc::updateUserInfo($req); // 玩家数据
  612. //// UserProc::setUserInfo(global_mem(), $friend_info); // 好友数据
  613. //// 返回
  614. // return Resp::ok(array('err' => 0, 'curgold' => $user->gold));
  615. // }
  616. // </editor-fold>
  617. //
  618. // <editor-fold defaultstate="collapsed" desc="黄金挑战">
  619. // /**
  620. // * [6804] 扣除买buffer的费用
  621. // * @param type $req
  622. // * @return type
  623. // */
  624. // public static function ConsumeBufferGold($req) {
  625. // $user = $req->userInfo->game; # user引用
  626. // $money = $req->paras[0]; //需要的手工费
  627. //// echo var_dump($money);
  628. // $bDeal = UserGameModel::Consume_Gold($user, $money);
  629. // if ($bDeal) {
  630. // $result = array(
  631. // 'resp' => "succeed!"
  632. // );
  633. //// 更新数据库数据
  634. //
  635. // $resp = Resp::ok($result);
  636. // } else {
  637. //
  638. //// $user->gold=0;
  639. // $result = array(
  640. // 'resp' => "succeed!"
  641. // );
  642. //// 更新数据库数据
  643. //
  644. // $resp = Resp::ok($result);
  645. // }
  646. // UserProc::updateUserInfo($req);
  647. // return $resp;
  648. // }
  649. // /**
  650. // * [6807] 挑战黄金 无穷无尽战斗模式
  651. // * @param type $req
  652. // */
  653. // public static function ChallengeEndlessFightMode_Gold($req) {
  654. // $gateForeverId = $req->paras[0];
  655. // $difficuty = $req->paras[1];
  656. // $bociCount = $req->paras[2];
  657. ////判断是否已经达到挑战的次数上限
  658. // $gates = $req->userInfo->game->gates;
  659. //
  660. // if (!CommUtil::isPropertyExists($gates, "forever_Gold_FightTimes")) {
  661. // $gates->forever_Gold_FightTimes = 0;
  662. // }
  663. //
  664. // if ($gates->forever_Gold_FightTimes >= glc()->Battle_Forever_MaxCountEveryDay) {
  665. // return Resp::err(ErrCode::err_gateForever_countIsFull, '挑战次数已经用尽!');
  666. // }
  667. ////1.取出无尽模式的关卡常量数据
  668. // $gateForeverConst = GameConfig::gateforever_getItem($gateForeverId); // ConstProc::getGold_GateForeverGoldConst($gateForeverId);
  669. // $gateBattleBociConst = GameConfig::gatecombat_getItem($gateForeverId);
  670. // if (!$gateForeverConst) {
  671. // return Resp::err(ErrCode::err_gateForever_const_no);
  672. // }
  673. ////判断次数是否合法
  674. // $bociArr = explode(",", $gateBattleBociConst->level);
  675. // if ($bociCount > count($bociArr)) {
  676. // return Resp::err(ErrCode::err_gateForever_countillegal);
  677. // }
  678. ////2.取出模式下的奖励数据
  679. // $rewardStr = $gateForeverConst->reward1;
  680. //
  681. // $arr_reward = explode(";", $rewardStr);
  682. // foreach ($arr_reward as $value) {
  683. // if (strlen($value) > 0) {
  684. //
  685. // $arr_RealReward = explode(",", $value);
  686. // $itemId = $arr_RealReward[0];
  687. // $itemNum = $arr_RealReward[1];
  688. //
  689. // $str1 = substr($itemId, 0, 3);
  690. ////3.根据挑战的波次数据,重复累计获得奖励
  691. // for ($i = 0; $i < $bociCount; $i++) {
  692. //
  693. // switch ($str1) {
  694. /////怪物卡或者英雄卡牌获取
  695. // case "101":
  696. // case "201":
  697. //// HeroProc::AddHeroTFromStore($req, $itemId);
  698. // break;
  699. /////装备物品的获取.
  700. // case "301":
  701. // case "302":
  702. // case "303":
  703. // StoreProc::PutEquipInStore($itemId, $req);
  704. // break;
  705. /////宝石的获取
  706. // case "304":
  707. // StoreProc:: PutOverlyingItemInStore($itemId, $itemNum, $req);
  708. // break;
  709. ////金币的获取
  710. // case "399":
  711. // if ($itemId == "399002") {
  712. // UserGameModel::Add_Gold($req->mem, $req->userInfo->game, $itemNum);
  713. // }
  714. // break;
  715. // default:
  716. // break;
  717. // }
  718. // }
  719. // }
  720. // }
  721. ////4、存储玩家的挑战次数
  722. // $gates->forever_Gold_FightTimes = $gates->forever_Gold_FightTimes + 1;
  723. //// 回写数据
  724. // UserProc::updateUserInfo($req);
  725. // $result = ObjectInit();
  726. // $result->result = "succeed";
  727. // $result->forever_Gold_FightTimes = $gates->forever_Gold_FightTimes;
  728. // $resp = Resp::ok($result);
  729. // return $resp;
  730. // }
  731. // /**
  732. // * 清理挑战无尽模式的 次数记录
  733. // *
  734. // */
  735. // public static function ClearGateForeverGold_FightCountEveryDay($req) {
  736. // $req->userInfo->game->gates->forever_Gold_FightTimes = 0;
  737. // }
  738. // </editor-fold>
  739. //
  740. // <editor-fold defaultstate="collapsed" desc=" 副本 ">
  741. //
  742. // /**
  743. // * [6801] 开启副本
  744. // * @param Req $req
  745. // * @deprecated since version 0
  746. // */
  747. // public static function OpenTheCarbon($req) {
  748. // $gates = $req->userInfo->game->gates;
  749. // $openedcarbons = $gates->carbons->openedCarbons;
  750. //# 提取参数
  751. // $carbonId = $req->paras[0]; # 副本ID
  752. // $difficulty = $req->paras[1]; # 难度等级 1,2,3
  753. // $key = "$carbonId-$difficulty"; # 键值
  754. // if (!($gates && $openedcarbons)) {
  755. // return Resp::err(ErrCode::err_innerfault);
  756. // }
  757. // if ($difficulty > 3 || $difficulty < 1) {
  758. // return Resp::err(ErrCode::carbon_wrongdifficult);
  759. // }
  760. //
  761. // if (CommUtil::isPropertyExists($openedcarbons, $key)) {
  762. // $carbon = $openedcarbons->$key;
  763. // } else {
  764. // $carbon = new CarbonModel();
  765. // }
  766. // if ($carbon->closeTs > now()) {
  767. // return Resp::err(ErrCode::carbon_opened);
  768. // }
  769. // $carbonModel = GameConfig::gate_carbon_getItem($carbonId); # 常量
  770. //# 扣除开启消耗的道具
  771. // $keyid = "keyId$difficulty";
  772. // $keynum = "keyNum$difficulty";
  773. // $costItemId = $carbonModel->$keyid;
  774. // $costItemNum = $carbonModel->$keynum;
  775. //
  776. // $err = StoreProc::removeItemFromStore($req->userInfo->game->store, $costItemId, $costItemNum);
  777. // if ($err) { # 扣除失败
  778. // return Resp::err($err);
  779. // }
  780. // $carbon->closeTs = now() + $carbonModel->duration; # 关闭倒计时
  781. // $carbon->curIndex = 0; # 索引重置为0
  782. // $openedcarbons->$key = $carbon;
  783. // $req->userInfo->game->gates->carbons->openedCarbons = $openedcarbons;
  784. // UserProc::updateUserInfo($req);
  785. // return Resp::ok(array('err' => 0, 'carbons' => $openedcarbons));
  786. // }
  787. // /**
  788. // * 挑战副本关卡
  789. // * @param Req $req
  790. // * @deprecated since version number
  791. // */
  792. // public static function ChallengeCarbon($req) {
  793. // $gates = $req->userInfo->game->gates;
  794. // $carbons = $gates->carbons->openedCarbons;
  795. //# 提取参数
  796. // $carbonId = $req->paras[0]; # 副本ID
  797. // $difficulty = $req->paras[1]; # 难度等级 1,2,3
  798. // $gateindex = $req->paras[2]; # 关卡索引 0,1,2,...
  799. // $star = $req->paras[3]; # 战斗评价(几星)
  800. // $TeamObj = $req->paras[4]; # 队伍信息
  801. //// $bossId = $req->paras[5]; # 本关消灭的bossid (<=0代表本关卡未出现boss)
  802. // if ($difficulty > 3 || $difficulty < 1) {
  803. // return Resp::err(ErrCode::carbon_wrongdifficult);
  804. // }
  805. // $key = "$carbonId-$difficulty"; # 键值
  806. //# 0 当前副本处于开启状态
  807. //# 1 当前关卡索引,不能跳着打,
  808. //# 2 记录下战斗评价(几星), 也许以后用得着,比如最后通关后,给个啥奖励
  809. //# 3 决定掉落物品, 发给客户端
  810. //# 4 发放对应的经验之类的东西
  811. //# 5 检查是否最后一个关卡, 是, 关闭副本
  812. //# 6 回存数据,返回
  813. //
  814. // isEditor() && $carbon = new CarbonModel;
  815. // if (CommUtil::isPropertyExists($carbons, $key)) {
  816. // $carbon = $carbons->$key;
  817. // } else {
  818. // $carbon = null;
  819. // }
  820. // if (!$carbon || $carbon->closeTs < now()) {
  821. // return Resp::err(ErrCode::carbon_closed);
  822. // }
  823. //
  824. // $carbonModel = GameConfig::gate_carbon_getItem($carbonId); # 副本常量数据
  825. // $gateIds = explode(',', $carbonModel->gateids);
  826. // if ($gateindex < 0 || $gateindex >= count($gateIds)) {
  827. // return Resp::err(ErrCode::carbon_gateIndex);
  828. // }
  829. // if ($carbon->curIndex == $gateindex || $gateindex == 0) {
  830. // $carbon->curIndex += 1; # 更新进度
  831. // } else { # 不能跳关
  832. // return Resp::err(ErrCode::carbon_gateIndex);
  833. // }
  834. //
  835. // $gateId = $gateIds[$gateindex]; # 通过索引获得关卡ID
  836. // $tl = "tili$difficulty"; # 体力难度
  837. // $rwd = "reward$difficulty"; # 奖励难度
  838. // $arr = array("normal", 'hard', 'elite'); # 难度名称
  839. // $gt = $arr[$difficulty - 1]; # 关卡分类
  840. // $gateModel = GameConfig::gate_carbon_content_getItem($gateId); # 副本关卡常量数据
  841. // $tili = $gateModel->$tl; # 扣除体力
  842. // $reward = $gateModel->$rwd; # 获得奖励
  843. //#
  844. //# 打副本呢也要扣除体力
  845. // ActiveProc::ChangeTili(-$tili, $req);
  846. //# 扣除多少体力就给账号增加多少经验 -by 李宁, reconfirmed by wg 20170519144109
  847. // UserGameModel::Add_Exp($req, $tili);
  848. //# 增加英雄经验(也是依据扣除的体力数)
  849. // foreach ($TeamObj as $heroUID) {
  850. // HeroProc::HeroAddEXP($heroUID, $tili, $req);
  851. // }
  852. //// $carbon->stars; 暂不记录了
  853. //# 掉落战利品->获取
  854. // $err = StoreProc::AddMultiItemInStore($req, $reward);
  855. // if ($err) {
  856. // return Resp::err($err);
  857. // }
  858. // if (count($gateIds) == $gateindex + 1) { # 最后一个关卡
  859. // unset($carbons->$key); # 关闭掉关卡,或者是直接删掉
  860. // } else {
  861. // $carbons->$key = $carbon; # 回存数据
  862. // }
  863. // $req->userInfo->game->gates->carbons->openedCarbons = $carbons;
  864. // UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
  865. // # Ps.备注,奖品是固定的,所以不必返回
  866. // $result = array(
  867. // 'store' => $req->userInfo->game->store,
  868. // 'heros' => $req->userInfo->game->heros,
  869. // 'gates' => $req->userInfo->game->gates,
  870. // 'tili' => $req->userInfo->game->tili,
  871. // 'time' => $req->userInfo->game->privateState->TiliTime
  872. // );
  873. // return Resp::ok($result);
  874. // }
  875. // /**
  876. // * [6809]新版本的挑战 副本胜利
  877. // * @param Req $req
  878. // * @deprecated since version 0
  879. // */
  880. // public static function NewChallengeCarbon($req) {
  881. // $gates = $req->userInfo->game->gates;
  882. // $carbons = $gates->carbons->openedCarbons;
  883. //# 提取参数
  884. // $carbonId = $req->paras[0]; # 副本ID
  885. // $gateId = $req->paras[1]; # 关卡ID
  886. // $difficulty = $req->paras[2]; # 难度等级 1,2,3
  887. //
  888. // $star = $req->paras[3]; # 战斗评价(几星)
  889. // $TeamObj = $req->paras[4]; # 队伍信息
  890. //
  891. // if ($difficulty > 3 || $difficulty < 1) {
  892. // return Resp::err(ErrCode::carbon_wrongdifficult);
  893. // }
  894. // $key = "$carbonId-$difficulty"; # 键值
  895. // # 0 当前副本处于开启状态
  896. // # 1 战斗胜利之后,副本直接关闭
  897. // # 2 记录下战斗评价(几星), 也许以后用得着,比如最后通关后,给个啥奖励
  898. // # 3 决定掉落物品, 发给客户端
  899. // # 4 发放对应的经验之类的东西
  900. // # 5 检查是否最后一个关卡, 是, 关闭副本
  901. // # 6 回存数据,返回
  902. //
  903. // isEditor() && $carbon = new CarbonModel;
  904. // if (CommUtil::isPropertyExists($carbons, $key)) {
  905. // $carbon = $carbons->$key;
  906. // } else {
  907. // $carbon = null;
  908. // }
  909. // if (!$carbon || $carbon->closeTs < now()) {
  910. // return Resp::err(ErrCode::carbon_closed);
  911. // }
  912. // unset($carbons->$key);
  913. // $tl = "tili$difficulty"; # 体力难度
  914. // $rwd = "reward$difficulty"; # 奖励难度
  915. //
  916. // $gateModel = GameConfig::gate_carbon_content_getItem($gateId); # 副本关卡常量数据
  917. // $tili = $gateModel->$tl; # 扣除体力
  918. // $reward = $gateModel->$rwd; # 获得奖励
  919. // #
  920. // # 打副本呢也要扣除体力
  921. // ActiveProc::ChangeTili(-$tili, $req);
  922. //
  923. // // 按照概率规则发放奖品
  924. // $rewardsArr = explode(";", $reward);
  925. // $rwds = array();
  926. // foreach ($rewardsArr as $r) {
  927. // $arr = explode(',', $r);
  928. // $itemid = intval($arr[0]);
  929. // $num = intval($arr[1]);
  930. // $probability = floatval($arr[2]); # 掉落概率精度精确到±0.01%
  931. // if (CommUtil::randomPercent($probability)) { # 投色子
  932. // $err = StoreProc::AddMultiItemInStore($req, "$itemid,$num");
  933. // if ($err) {
  934. // return Resp::err($err);
  935. // }
  936. // $rwds[] = "$itemid,$num";
  937. // }
  938. // }
  939. //
  940. // if ($err) {
  941. // return Resp::err($err);
  942. // }
  943. //
  944. // $req->userInfo->game->gates->carbons->openedCarbons = $carbons;
  945. // UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
  946. // # Ps.备注,奖品是固定的,所以不必返回
  947. // SystemProc::Carbon_Win($req->zoneid, $req->userInfo->game, $carbonId, $difficulty); # 插入通过副本消息
  948. // $result = array(
  949. // 'store' => $req->userInfo->game->store,
  950. // 'heros' => $req->userInfo->game->heros,
  951. // 'gates' => $req->userInfo->game->gates,
  952. // 'tili' => $req->userInfo->game->tili,
  953. // 'time' => $req->userInfo->game->privateState->TiliTime,
  954. // 'gold' => 0,
  955. // 'exp' => 0,
  956. // 'rewardstr' => implode(';', $rwds)
  957. // );
  958. // return Resp::ok($result);
  959. // }
  960. // /**
  961. // * [6816] 挑战剧情关卡
  962. // * @param type $req
  963. // * @deprecated since version 0
  964. // */
  965. // public static function ChallengeStoryGate($req) {
  966. // $gates = $req->userInfo->game->gates;
  967. //# 提取参数
  968. // $storyId = $req->paras[0]; # 剧情ID
  969. // $difficulty = $req->paras[1]; # 难度等级 1,2,3
  970. // $star = $req->paras[2]; # 战斗评价(几星)
  971. // $TeamObj = $req->paras[3]; # 队伍信息
  972. // $bossId = $req->paras[4]; # 本关消灭的bossid (<=0代表本关卡未出现boss)
  973. ////
  974. //#1. 判断是否有记录过剧情的战斗信息
  975. // if (!CommUtil::isPropertyExists($gates, "story")) {
  976. // $gates->story = ObjectInit();
  977. // $gates->story->lastFinishedStoryGateId = 0;
  978. // $gates->story->allFinishedStoryGateIdList = ArrayInit();
  979. // }
  980. // $storrRecord = $gates->story;
  981. //#2.取出模式下的奖励数据
  982. // $memStoryModel = GameConfig::gatestory_getItem($storyId);
  983. // $tili = 0;
  984. // $rewardStr = $memStoryModel->storyGateReward;
  985. //
  986. //#3 同步下剧情的推进进度数据
  987. // if ($storrRecord->lastFinishedStoryGateId == $storyId || in_array($storyId, $storrRecord->allFinishedStoryGateIdList)) {
  988. // return Resp::err(ErrCode::story_repeatfight); #剧情关卡不能重复战斗 只能打一次
  989. // } else {
  990. // $storrRecord->lastFinishedStoryGateId = $storyId;
  991. // $storrRecord->allFinishedStoryGateIdList[] = $storyId;
  992. // }
  993. //#
  994. //# 4 万一打剧情也扣除体力呢
  995. // if ($tili > 0) {
  996. // ActiveProc::ChangeTili(-$tili, $req);
  997. //# 扣除多少体力就给账号增加多少经验 -by 李宁, reconfirmed by wg 20170519144109
  998. // UserGameModel::Add_Exp($req, $tili);
  999. //# 增加英雄经验(也是依据扣除的体力数)
  1000. // foreach ($TeamObj as $heroUID) {
  1001. // HeroProc::HeroAddEXP($heroUID, $tili, $req);
  1002. // }
  1003. // }# 5 玩家获得 剧情的战斗奖励
  1004. // $err = StoreProc::AddMultiItemInStore($req, $rewardStr);
  1005. // if ($err) {
  1006. // return Resp::err($err);
  1007. // }# 6 回存玩家的战斗记录
  1008. // $req->userInfo->game->gates->story = $storrRecord;
  1009. // UserProc::updateUserInfo($req); //在获取战利品哪里已经update了.
  1010. // # Ps.备注,奖品是固定的,所以不必返回
  1011. // $result = array(
  1012. // 'store' => $req->userInfo->game->store,
  1013. // 'heros' => $req->userInfo->game->heros,
  1014. // 'gates' => $req->userInfo->game->gates,
  1015. // 'tili' => $req->userInfo->game->tili,
  1016. // 'time' => $req->userInfo->game->privateState->TiliTime
  1017. // );
  1018. // return Resp::ok($result);
  1019. // }
  1020. //
  1021. // </editor-fold>
  1022. //
  1023. }