SweepGatesProc.php 45 KB

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