SweepGatesProc.php 44 KB

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