SweepGatesProc.php 45 KB

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