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