SweepGatesProc.php 45 KB

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