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