StoreProc.php 43 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203
  1. <?php
  2. /*
  3. * To change this license header, choose License Headers in Project Properties.
  4. * To change this template file, choose Tools | Templates
  5. * and open the template in the editor.
  6. */
  7. namespace loyalsoft;
  8. /**
  9. * Description of StoreProc
  10. *
  11. * @author c'y'zhao
  12. */
  13. class StoreProc {
  14. /**
  15. * 逻辑分发
  16. * 所有的Proc中必须有这样一个方法
  17. * @param Req $req
  18. */
  19. public static function procMain($req) {
  20. switch ($req->cmd) {
  21. case CmdCode::cmd_store_put: # 6401 放入仓库
  22. return StoreProc::AddItemInStore();
  23. case CmdCode::cmd_store_gemSet: # 6402 装备宝石
  24. return StoreProc::GemSet();
  25. case CmdCode::cmd_store_gemRemove: # 6403 卸下装备宝石
  26. return StoreProc::GemRemove();
  27. case CmdCode::cmd_store_equipUpgrade: # 6404 装备升级
  28. return StoreProc::EquipUpgrade();
  29. case CmdCode::cmd_store_equipUpgrade_MaxLv: # 6405 一键升级(装备)
  30. return StoreProc::EquipUpgrade_MaxLv();
  31. case CmdCode::store_gemCompose: # 6406 宝石合成
  32. return StoreProc::GemCompose();
  33. case CmdCode::store_switchEquipPag: # 6408 切换装备分页
  34. return StoreProc::SwitchEquipPag();
  35. case CmdCode::store_gemLockState: # 6409 宝石开锁解锁
  36. return StoreProc::GemLockState();
  37. case CmdCode::store_equip_removeEquipUpgradeTip: # 6410 移除装备可以升级绿点提示 -------废弃
  38. return StoreProc::RemoveEquipUpgradeTip();
  39. case CmdCode::store_equip_removeNewGemTip: # 6411 移除是新宝石绿点提示
  40. return StoreProc::RemoveNewGemTip();
  41. case CmdCode::store_allEquipUpgrade: # 6412 所有装备的一键升级-----------废弃
  42. return StoreProc::AllEquipUpgrade();
  43. case CmdCode::store_gemXiLian: # 6413 洗练
  44. return StoreProc::GemXiLian();
  45. case CmdCode::store_equiped: # 6413 装备
  46. return StoreProc::Equiped();
  47. case CmdCode::store_remove_equip: # 6413 卸下装备
  48. return StoreProc::RemoveEquip();
  49. case CmdCode::store_equip_gemSlotBuy: # 6416 购买装备宝石槽
  50. return StoreProc::Gem_BuySlot();
  51. case CmdCode::store_equip_compose: # 6417 装备合成
  52. return StoreProc::Equip_Compose();
  53. case CmdCode::store_equip_OnekeyCompose: # 6418 装备一键合成
  54. return StoreProc::Equip_OnekeyCompose();
  55. default:
  56. Err(ErrCode::cmd_err);
  57. }
  58. }
  59. /**
  60. * 6417 装备合成
  61. * @return type
  62. */
  63. public static function Equip_Compose() {
  64. list($uid, $equipUids_cost) = req()->paras;
  65. $equipDic = ctx()->store->equip;
  66. my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
  67. $ins_equip = new Ins_Equip($equipDic->$uid);
  68. $composeMo = GameConfig::equip_compose_getItem($ins_equip->qual);
  69. my_Assert(null != $composeMo, ErrCode::err_const_no);
  70. $arr = explode(',', $composeMo->compose_condition);
  71. $type = $arr[0];
  72. $costQual = $arr[1];
  73. $num = $arr[2];
  74. $costEquipsArr = explode(',', $equipUids_cost);
  75. my_Assert(count($costEquipsArr) == $num, ErrCode::user_store_equipMaterialNumErr);
  76. foreach ($costEquipsArr as $eqUid) {
  77. my_Assert(StlUtil::dictHasProperty($equipDic, $eqUid), ErrCode::user_store_NotExistEquip);
  78. $costIns_Equip = new Ins_Equip($equipDic->$eqUid);
  79. my_Assert($costIns_Equip->qual == $costQual, ErrCode::user_store_equipMaterialQualErr);
  80. if ($type == 1) {//本体
  81. my_Assert($costIns_Equip->typeId == $ins_equip->typeId, ErrCode::user_store_equipMaterialTypeErr);
  82. } else {
  83. my_Assert($costIns_Equip->mo()->position == $ins_equip->mo()->position, ErrCode::user_store_equipMaterialTypeErr);
  84. }
  85. }
  86. ctx()->store(true)->equip->$uid = self::ComposeNewEquip($ins_equip);
  87. //消耗的装备 回收
  88. foreach ($costEquipsArr as $eqUid) {
  89. $costIns_Equip = new Ins_Equip($equipDic->$eqUid);
  90. self::equipLevelUp_Material_Recovery($costIns_Equip->mo()->rarity, $costIns_Equip->qual, $costIns_Equip->mo()->position, $costIns_Equip->level);
  91. StlUtil::dictRemove(ctx()->store(true)->equip, $eqUid);
  92. }
  93. UserProc::updateUserInfo();
  94. return Resp::ok(array(
  95. 'gold' => ctx()->baseInfo->gold,
  96. 'store' => ctx()->store,
  97. ));
  98. }
  99. /**
  100. * 装备等级提升 消耗的金币图纸回收
  101. * @param type $rarity
  102. * @param type $qual
  103. * @param type $posId
  104. * @param type $level
  105. */
  106. public static function equipLevelUp_Material_Recovery($rarity, $qual, $posId, $level) {
  107. $gold = 0;
  108. $tuzhi = 0;
  109. $tuzhiId = GameConfig::equip_position_getItem($posId)->costTuzhiId;
  110. for ($i = 1; $i <= $level - 1; $i++) {
  111. $mo = GameConfig::equip_levelupgrade_getItem($rarity, $qual, $posId, $i);
  112. $gold += $mo->needGold;
  113. $tuzhi += $mo->needItemNum;
  114. }
  115. if ($gold > 0) {
  116. StoreProc::AddMultiItemInStore("1," . $gold);
  117. StoreProc::AddMultiItemInStore($tuzhiId . ',' . $tuzhi);
  118. }
  119. }
  120. /**
  121. * 合成一个新的装备
  122. * @param type Ins_Equip
  123. */
  124. public static function ComposeNewEquip(&$ins_equip) {
  125. $newEquipTypeId = $ins_equip->typeId;
  126. $qual = $ins_equip->qual + 1;
  127. if ($ins_equip->qual < 4) {
  128. $newEquipTypeId = substr($ins_equip->typeId, 0, strlen($ins_equip->typeId) - 6);
  129. $qual = GameConfig::equip_compose_getItem($newEquipTypeId)->qual;
  130. }
  131. $ins_equip->typeId = $newEquipTypeId;
  132. $ins_equip->qual = $qual;
  133. return $ins_equip;
  134. }
  135. public static function initEquip($typeId, $uid = 0) {
  136. if ($uid == 0) {
  137. $uid = count((array) ctx()->store->equip) + 1;
  138. }
  139. $ins_equip = new Ins_Equip();
  140. $ins_equip->uid = $uid;
  141. $ins_equip->typeId = $typeId;
  142. $ins_equip->qual = GameConfig::equip_compose_getItem($typeId)->qual;
  143. return $ins_equip;
  144. }
  145. /**
  146. * 6418 装备一键合成
  147. * @return type
  148. */
  149. public static function Equip_OnekeyCompose() {
  150. list() = req()->paras;
  151. $equipDic = ctx()->store->equip;
  152. $arr = array();
  153. foreach ($equipDic as $uid => $equip) {
  154. $ins_equip = new Ins_Equip($equip);
  155. if ($ins_equip->qual > 4) {
  156. continue;
  157. }
  158. $arr[] = $ins_equip;
  159. }
  160. //等级从大到小
  161. $len = count($arr);
  162. for ($i = 0; $i < $len - 1; $i++) {
  163. for ($j = $len - 1; $j > $i; $j--) {
  164. if ($arr[$j]->level > $arr[$j - 1]->level) {
  165. $temp = $arr[$j];
  166. $arr[$j] = $arr[$j - 1];
  167. $arr[$j - 1] = $temp;
  168. }
  169. }
  170. }
  171. $composeEquip = array();
  172. if ($len > 0) {
  173. while (true) {
  174. $equip_compose = $arr[0];
  175. $str = explode(',', GameConfig::equip_compose_getItem($equip_compose->qual)->compose_condition);
  176. $type = $str[0];
  177. $costQual = $str[1];
  178. $num = $str[2];
  179. $n = count($arr);
  180. $composeArr = array();
  181. $tag = false;
  182. $ing_compose = false;
  183. for ($k = $n - 1; $k >= 0; $k--) {
  184. if ($arr[$k]->uid == $equip_compose->uid) {
  185. continue;
  186. }
  187. if ($type == 1 && $arr[$k]->qual == $costQual && $arr[$k]->typeId == $equip_compose->typeId) {
  188. $tag = true;
  189. } else if ($type == 2 && $arr[$k]->qual == $costQual && $arr[$k]->mo()->position == $equip_compose->mo()->position) {
  190. $tag = true;
  191. }
  192. if ($tag) {
  193. $composeArr[] = $arr[$k];
  194. if (count($composeArr) >= $num) {
  195. break;
  196. }
  197. }
  198. }
  199. if(count($composeArr) >= $num){
  200. $newEquip = self::ComposeNewEquip($equip_compose);
  201. $uid = $newEquip->uid;
  202. ctx()->store(true)->equip->$uid = $newEquip;
  203. $composeEquip[] = $uid;
  204. $ing_compose = true;
  205. }
  206. //合成的 材料不够不能合成的都要删除
  207. foreach ($composeArr as $val) {
  208. if($ing_compose){//合成的回收 不合成的可不能给回收了
  209. self::equipLevelUp_Material_Recovery($val->mo()->rarity, $val->qual,$val->mo()->position, $val->level);
  210. }
  211. StlUtil::arrayRemove($arr, $val);
  212. }
  213. StlUtil::arrayRemove($arr, $equip_compose);
  214. if (count($arr) <= 0) {
  215. break;
  216. }
  217. }
  218. }
  219. UserProc::updateUserInfo();
  220. return Resp::ok(array(
  221. 'gold' => ctx()->baseInfo->gold,
  222. 'store' => ctx()->store,
  223. 'composeEquip'=>$composeEquip,
  224. ));
  225. }
  226. /**
  227. * 6416 购买装备宝石槽
  228. * @return type
  229. */
  230. public static function Gem_BuySlot() {
  231. list($uid) = req()->paras;
  232. $equipDic = ctx()->store->equip;
  233. my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
  234. $ins_equip = new Ins_Equip($equipDic->$uid);
  235. $mo = GameConfig::gem_slotposition_getItem($ins_equip->qual);
  236. my_Assert(null != $mo, ErrCode::err_const_no);
  237. $initNum = $mo->initNum_slot;
  238. $buyNum = $mo->buyNum_slot;
  239. $unlockIndex = 0;
  240. if ($buyNum > 0) {
  241. for ($i = $initNum + 1; $i <= $initNum + $buyNum; $i++) {
  242. if (!StlUtil::dictHasProperty($ins_equip->gemSetSlot, $i)) {
  243. $ins_equip->gemSetSlot->$i = 0;
  244. break;
  245. }
  246. $unlockIndex += 1;
  247. }
  248. }
  249. $costArr = explode(';', $mo->cost);
  250. $cash = explode(',', $costArr[$unlockIndex]);
  251. my_Assert(ctx()->base(true)->cash >= $cash[1], ErrCode::notenough_cash_msg);
  252. ctx()->base(true)->Consume_Cash($unlockIndex);
  253. ctx()->store(true)->equip->$uid = $ins_equip;
  254. UserProc::updateUserInfo();
  255. return Resp::ok(array(
  256. 'cash' => ctx()->baseInfo->cash,
  257. 'store' => ctx()->store,
  258. ));
  259. }
  260. /**
  261. * 6413 装备
  262. * @return type
  263. */
  264. public static function Equiped() {
  265. list($uid) = req()->paras;
  266. $equipDic = ctx()->store->equip;
  267. my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
  268. $ins_equip = new Ins_Equip($equipDic->$uid);
  269. $posId = $ins_equip->mo()->position;
  270. ctx()->store(true)->equipLocation->$posId = $uid;
  271. UserProc::updateUserInfo();
  272. return Resp::ok(array());
  273. }
  274. /**
  275. * 6413 卸下装备
  276. * @return type
  277. */
  278. public static function RemoveEquip() {
  279. list($uid) = req()->paras;
  280. $equipDic = ctx()->store->equip;
  281. my_Assert(StlUtil::dictHasProperty($equipDic, $uid), ErrCode::user_store_NotExistEquip);
  282. $ins_equip = new Ins_Equip($equipDic->$uid);
  283. $posId = $ins_equip->mo()->position;
  284. StlUtil::dictRemove(ctx()->store(true)->equipLocation, $posId);
  285. UserProc::updateUserInfo();
  286. return Resp::ok(array());
  287. }
  288. /**
  289. * 洗练
  290. * @return Resp
  291. */
  292. public static function GemXiLian() {
  293. list($uid) = req()->paras;
  294. //把 qual pos u一样的宝石开锁关锁
  295. $gemStore = ctx()->store->gemStore;
  296. my_Assert(StlUtil::dictHasProperty($gemStore, $uid), ErrCode::user_store_NotExistGem);
  297. $gem = new Ins_Gem($gemStore->$uid);
  298. my_Assert($gem->mo()->qual >= 5, ErrCode::user_store_XilianStoneNoEnough);
  299. $arr = explode(';', glc()->XILianGemlNeedXILianStone);
  300. $needStone = 0;
  301. $xilianStoneId = 0;
  302. foreach ($arr as $val) {
  303. $str = explode(':', $val);
  304. if ($str[0] == $gem->mo()->qual) {
  305. $s = explode(',', $str[1]);
  306. $needStone = $s[1];
  307. $xilianStoneId = $s[0];
  308. break;
  309. }
  310. }
  311. my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $xilianStoneId) && ctx()->store->items->$xilianStoneId >= $needStone, ErrCode::user_store_XilianStoneNoEnough);
  312. $dic = GameConfig::predicate();
  313. $pList = array();
  314. foreach ($dic as $id => $pMo) {
  315. if ($pMo->positions != null && $pMo->qual != null) {
  316. $list = explode(',', $pMo->positions);
  317. if ($pMo->id != $gem->predicateId && $pMo->qual == $gem->mo()->qual && in_array($gem->mo()->position, $list) && $pMo->attachTarget == "gem") {
  318. $pList[] = $pMo->id;
  319. }
  320. }
  321. }
  322. my_Assert(count($pList) > 0, ErrCode::user_store_NoFindPredicate);
  323. $rand = random_int(0, count($pList) - 1);
  324. $pId = $pList[$rand];
  325. ctx()->store->gemStore->$uid->predicateId = $pId;
  326. ctx()->store->removeItem($xilianStoneId, $needStone);
  327. $xilianStoneNum = 0;
  328. if (StlUtil::dictHasProperty(ctx()->store->items, $xilianStoneId)) {
  329. $xilianStoneNum = ctx()->store->items->$xilianStoneId;
  330. }
  331. UserProc::updateUserInfo();
  332. return Resp::ok(array(
  333. 'xilianStoneId' => $xilianStoneId,
  334. 'xilianStone' => $xilianStoneNum,
  335. 'predicateId' => $pId,
  336. ));
  337. }
  338. /**
  339. * 宝石开锁解锁
  340. * @return Resp
  341. */
  342. public static function GemLockState() {
  343. list($uid) = req()->paras;
  344. $user = ctx();
  345. //把 qual pos u一样的宝石开锁关锁
  346. $gemStore = $user->store->gemStore;
  347. $gem = $gemStore->$uid;
  348. $tag = 0;
  349. if ($gem->isUnlock == 0) {
  350. $gem->isUnlock = 1;
  351. $tag = 1;
  352. } else {
  353. $gem->isUnlock = 0;
  354. $tag = 0;
  355. }
  356. $gemStore->$uid = $gem;
  357. foreach ($gemStore as $k => $ins_gem) {
  358. if ($ins_gem->typeId == $gem->typeId && $ins_gem->predicateId == $gem->predicateId) {
  359. $gemStore->$k->isUnlock = $tag;
  360. }
  361. }
  362. $user->store->gemStore = $gemStore;
  363. ctx($user);
  364. UserProc::updateUserInfo();
  365. return Resp::ok(array(
  366. 'gold' => 0,
  367. 'store' => $user->store,
  368. ));
  369. }
  370. /**
  371. * 切换装备分页
  372. * @return Resp
  373. */
  374. public static function SwitchEquipPag() {
  375. list($index) = req()->paras;
  376. $user = ctx();
  377. $user->store->equipPag = $index;
  378. ctx($user);
  379. UserProc::updateUserInfo();
  380. return Resp::ok(array());
  381. }
  382. /**
  383. * 所有装备的一键升级
  384. * 规则:等级不同从等级小到大,等级一样按照部位顺序
  385. *
  386. * @return Resp
  387. */
  388. public static function AllEquipUpgrade() {
  389. //list() = req()->paras;
  390. //$user = ctx();
  391. // $equipDic = $user->store->equipPosition;
  392. //
  393. // $equip_levelDic = GameConfig::equip_levelupgrade();
  394. // $maxLv = count(StlUtil::dictToArray($equip_levelDic));
  395. // $arr = array();
  396. // if ($equipDic != null) {
  397. // foreach ($equipDic as $k => &$equip) {
  398. // $equip = new Ins_EquipPosition($equip);
  399. //
  400. // if ($equip->level >= $maxLv) {
  401. // continue;
  402. // }
  403. //
  404. // $lvMo = GameConfig::equip_levelupgrade_getItem($equip->level);
  405. // $needGold = $lvMo->needGold;
  406. // $needItemNum = $lvMo->needItemNum;
  407. // $neeItemId = $equip->mo()->costTuzhiId;
  408. //
  409. // if ($user->baseInfo->gold >= $needGold && StlUtil::dictHasProperty($user->store->items, $neeItemId) && $user->store->items->$neeItemId >= $needItemNum) {
  410. // $arr[] = $equip;
  411. // }
  412. // }
  413. // }
  414. // $upLevelArr = array();
  415. // if (count($arr) > 0) {
  416. // //进行排序
  417. // $len = count($arr);
  418. // for ($i = 0; $i < $len - 1; $i++) {
  419. // for ($j = 0; $j < $len - $i - 1; $j++) {
  420. // if ($arr[$j]->level > $arr[$j + 1]->level) {//从小到大
  421. // $temp = $arr[$j];
  422. // $arr[$j] = $arr[$j + 1];
  423. // $arr[$j + 1] = $temp;
  424. // } elseif ($arr[$j]->level == $arr[$j + 1]->level) {
  425. // $j_equip = new Ins_EquipPosition($arr[$j]);
  426. // $jj_equip = new Ins_EquipPosition($arr[$j + 1]);
  427. // if ($j_equip->mo()->position > $jj_equip->mo()->position) {
  428. // $temp = $arr[$j];
  429. // $arr[$j] = $arr[$j + 1];
  430. // $arr[$j + 1] = $temp;
  431. // }
  432. // }
  433. // }
  434. // }
  435. //升级,扣除金币和图纸
  436. // while (true) {
  437. // $tag = 9999;
  438. // foreach ($arr as $index => &$equip) {
  439. // $ins_equip = new Ins_EquipPosition($equip);
  440. // $lvMo = GameConfig::equip_levelupgrade_getItem($ins_equip->level);
  441. // $needGold = $lvMo->needGold;
  442. // $needItemNum = $lvMo->needItemNum;
  443. // $neeItemId = $ins_equip->mo()->costTuzhiId;
  444. // if ($user->baseInfo->gold >= $needGold && StlUtil::dictHasProperty($user->store->items, $neeItemId) && $user->store->items->$neeItemId >= $needItemNum) {
  445. // $id = $ins_equip->typeId;
  446. // if (!in_array($id, $upLevelArr)) {
  447. // $upLevelArr[] = $id;
  448. // }
  449. //
  450. // $ins_equip->level += 1;
  451. // $equipDic->$id->level += 1;
  452. // $user->baseInfo->Consume_Gold($needGold);
  453. // $user->store->removeItem($neeItemId, $needItemNum);
  454. // if ($ins_equip->level >= 99) {
  455. // $tag = $index;
  456. // break;
  457. // }
  458. // } else {
  459. // $tag = $index;
  460. // break;
  461. // }
  462. // }
  463. // if ($tag != 9999) {
  464. // if (array_key_exists($tag, $arr)) {
  465. // StlUtil::arrayRemoveAt($arr, $tag);
  466. // }
  467. // }
  468. //
  469. // if (count($arr) <= 0) {
  470. // break;
  471. // }
  472. // }
  473. // }
  474. // TaskProc::OnAnyEquipUpLevel_X();
  475. // TaskProc::OnAllEquipUpLevel_X();
  476. // TaskProc::OnEquipLevelUpNum();
  477. // ctx($user);
  478. //
  479. // FightProc::Ranking_FightPower();
  480. UserProc::updateUserInfo();
  481. return Resp::ok(array(
  482. 'upLevelArr' => $upLevelArr,
  483. 'gold' => $user->baseInfo->gold,
  484. 'store' => $user->store,
  485. 'task' => $user->task,
  486. ));
  487. }
  488. /**
  489. * 6411 移除是新宝石绿点提示
  490. * @return Resp
  491. */
  492. public static function RemoveNewGemTip() {
  493. list($uid) = req()->paras; //宝石uid
  494. my_Assert(StlUtil::dictHasProperty(ctx()->store->gemStore, $uid), ErrCode::user_store_NoItem);
  495. ctx()->store(true)->gemStore->$uid->isNew = 0;
  496. UserProc::updateUserInfo();
  497. return Resp::ok(array());
  498. }
  499. /**
  500. * 移除装备可以升级绿点提示 -------废弃
  501. * @return Resp
  502. */
  503. public static function RemoveEquipUpgradeTip() {
  504. // list($posId) = req()->paras; //装备部位
  505. // $user = ctx();
  506. //
  507. // my_Assert(StlUtil::dictHasProperty($user->store->equipPosition, $posId), ErrCode::user_store_NoEquip);
  508. //
  509. // $user->store->equipPosition->$posId->tip = 0;
  510. //
  511. // ctx($user);
  512. // UserProc::updateUserInfo();
  513. // return Resp::ok(array(
  514. // 'gold' => 0,
  515. // 'store' => $user->store,));
  516. }
  517. /**
  518. * 6406 合成
  519. * @return type
  520. */
  521. public static function GemCompose() {
  522. list($gemIds) = req()->paras;
  523. $list = explode(';', $gemIds);
  524. $gemStore = ctx()->store->gemStore;
  525. $composeArr = array();
  526. foreach ($list as $gems) {
  527. $gemArr = explode('-', $gems);
  528. $length1 = strlen($gemArr[0]);
  529. $length2 = strlen($gemArr[1]);
  530. $gem_composeCost = explode(',', substr($gemArr[0], 1, $length1 - 1)); //去掉逗号
  531. $gem_composeIds = explode(',', substr($gemArr[1], 1, $length2 - 1)); //去掉逗号
  532. $gemMo = GameConfig::gem_getItem($gem_composeIds[0]);
  533. my_Assert(null != $gemMo, ErrCode::err_const_no);
  534. $isCompose = true;
  535. foreach ($gem_composeCost as $gemUid) {
  536. if (!StlUtil::dictHasProperty($gemStore, $gemUid)) {
  537. $isCompose = false;
  538. break;
  539. }
  540. $ins_gem = new Ins_Gem($gemStore->$gemUid);
  541. if ($ins_gem->mo()->qual + 1 != $gemMo->qual || $ins_gem->mo()->position == $gemMo->position) {
  542. $isCompose = false;
  543. break;
  544. }
  545. if (!self::GemIsCanCompose($gemUid)) {
  546. $isCompose = false;
  547. break;
  548. }
  549. }
  550. my_Assert($isCompose == true, ErrCode::user_store_GemCanotCompose);
  551. foreach ($gem_composeCost as $gemUid) {
  552. self::RemoveGemInStore($gemUid);
  553. }
  554. foreach ($gem_composeIds as $gemTypeId) {
  555. $composeGem = self::initGem($gemTypeId);
  556. self::PutGemInStore($composeGem);
  557. $composeArr[] = $composeGem->uid; //临时放这
  558. }
  559. }
  560. TaskProc::OnComposeNumGem();
  561. TaskProc::OnComposeNumGem_state();
  562. UserProc::updateUserInfo();
  563. return Resp::ok(array(
  564. 'composeGemIds' => $composeArr,
  565. 'store' => ctx()->store,
  566. 'task' => ctx()->task,
  567. ));
  568. }
  569. /**
  570. * 该宝石是否可以参与合成,其他页镶嵌的,已经被锁的都不能参与
  571. * @param type $uid
  572. * @return bool
  573. */
  574. private static function GemIsCanCompose($uid) {
  575. $ins_gem = new Ins_Gem($uid);
  576. if ($ins_gem->isUnlock == 1) {
  577. return false;
  578. }
  579. $isExist = true;
  580. $equip = ctx()->store->equip;
  581. foreach ($equip as $uid => $item) {
  582. $arr = get_object_vars($item->gemSetSlot);
  583. $values = array_values($arr);
  584. if (in_array($uid, $values)) {
  585. $isExist = false;
  586. break;
  587. }
  588. }
  589. return $isExist;
  590. }
  591. /**
  592. * 装备宝石
  593. * @return type
  594. */
  595. public static function GemSet() {
  596. list($equipUid, $uid, $type, $replaceUId) = req()->paras; //宝石uid 手动的时候记得校验u $replaceUId宝石槽坑位id
  597. my_Assert(StlUtil::dictHasProperty(ctx()->store->gemStore, $uid), ErrCode::user_store_NoItem);
  598. my_Assert(StlUtil::dictHasProperty(ctx()->store->equip, $equipUid), ErrCode::user_store_NoEquip);
  599. $ins_equip = new Ins_Equip(ctx()->store->equip->$equipUid);
  600. $ins_gem = new Ins_Gem(ctx()->store->gemStore->$uid);
  601. my_Assert($ins_equip->mo()->position == $ins_gem->mo()->qual, ErrCode::user_store_PositionNotFit);
  602. $gemSetSlotDic = $ins_equip->gemSetSlot;
  603. $tag_index = 0;
  604. $tag_gem = null;
  605. foreach ($gemSetSlotDic as $slotId => $gemUid) {
  606. $gem = new Ins_Gem(ctx()->store->gemStore->$gemUid);
  607. if ($gem->predicateMo()->uniqueKey == $ins_gem->predicateMo()->uniqueKey) {
  608. $tag_index = $slotId;
  609. $tag_gem = $gem;
  610. break;
  611. }
  612. }
  613. $mo = GameConfig::gem_slotposition_getItem($ins_equip->qual);
  614. my_Assert(null != $mo, ErrCode::err_const_no);
  615. switch ($type) {
  616. case 1://镶嵌
  617. my_Assert($tag_gem == null, ErrCode::user_store_GemCanotSet);
  618. for ($i = 1; $i <= $mo->initNum_slot + $mo->buyNum_slot; $i++) {
  619. if (!StlUtil::dictHasProperty($gemSetSlotDic, $i)) {
  620. $gemSetSlotDic->$i = $ins_gem;
  621. break;
  622. }
  623. }
  624. break;
  625. case 2://替换
  626. //满不满都高替低品阶
  627. my_Assert(StlUtil::dictHasProperty($gemSetSlotDic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
  628. $gUid = $gemSetSlotDic->$replaceUId;
  629. $replace_ins_Gem = new Ins_Gem(ctx()->store->gemStore->$gUid); //这个$replaceUId是坑位的index id
  630. my_Assert($replace_ins_Gem->mo()->qual < $ins_gem->mo()->qual, ErrCode::user_store_NoExistGemReplace);
  631. $gemSetSlotDic->$replaceUId = $ins_gem;
  632. break;
  633. case 3://手动
  634. my_Assert(count((array) $gemSetSlotDic) >= $mo->initNum_slot + $mo->buyNum_slot, ErrCode::user_store_GemCanotSet);
  635. $gUid = $gemSetSlotDic->$replaceUId;
  636. my_Assert(StlUtil::dictHasProperty($gemSetSlotDic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
  637. $replace_ins_Gem = new Ins_Gem(ctx()->store->gemStore->$gUid);
  638. //$id = $replace_ins_Gem->uid;
  639. if ($tag_gem != null) {//如果有u那
  640. my_Assert($replace_ins_Gem->uid == $tag_gem->uid, ErrCode::user_store_SameGemCanotEquip); //点的不是u一样的,则提示同一件装备无法镶嵌多个技能相同的宝石 【错误】
  641. //有U一样的,则点击正好是这个直接替换
  642. //$user->store->gemStore->$id = $replace_ins_Gem;
  643. $gemSetSlotDic->$tag_index = $ins_gem;
  644. } else {
  645. $go_index = 0;
  646. foreach ($gemSetSlotDic as $slotId => $gUid) {
  647. if ($gUid == $replaceUId) {
  648. $go_index = $slotId;
  649. break;
  650. }
  651. }
  652. my_Assert($go_index > 0, ErrCode::user_store_NoExistGemReplace);
  653. $gemSetSlotDic->$go_index = $ins_gem;
  654. }
  655. break;
  656. case 4://不能
  657. //1.小品阶替大品阶 或是 相等的,在不满的时候不允许 2. //满的 相等不允许替
  658. my_Assert($uid == 0, ErrCode::user_store_SameGemCanotEquip); //点的不是u一样的,则提示同一件装备无法镶嵌多个技能相同的宝石 【错误】
  659. break;
  660. default:
  661. break;
  662. }
  663. $ins_equip->gemSetSlot = $gemSetSlotDic;
  664. ctx()->store(true)->equip->$equipUid = $ins_equip;
  665. TaskProc::OnSetSpecialQualGem();
  666. FightProc::Ranking_FightPower();
  667. UserProc::updateUserInfo();
  668. return Resp::ok(array(
  669. 'gold' => 0,
  670. 'store' => ctx()->store,
  671. 'task' => ctx()->task,
  672. ));
  673. }
  674. /**
  675. * 卸下装备
  676. * @return type
  677. */
  678. public static function GemRemove() {
  679. list($uid) = req()->paras; //装备宝石id
  680. $equips = ctx()->store->equip;
  681. foreach ($equips as $eUid => $ins_equip) {
  682. $dic = $ins_equip->gemSetSlot;
  683. foreach ($dic as $slotId => $gemUid) {
  684. if ($uid == $gemUid) {
  685. ctx()->store->equip->$eUid->gemSetSlot->$slotId = 0;
  686. }
  687. break 2;
  688. }
  689. }
  690. FightProc::Ranking_FightPower();
  691. UserProc::updateUserInfo();
  692. return Resp::ok(array(
  693. 'gold' => 0,
  694. 'store' => ctx()->store,));
  695. }
  696. /**
  697. * 6404 升级装备
  698. * @return type
  699. */
  700. public static function EquipUpgrade() {
  701. list($uid) = req()->paras; //装备uid
  702. my_Assert(StlUtil::dictHasProperty(ctx()->store->equip, $uid), ErrCode::user_store_NoEquip);
  703. $ins_equip = new Ins_Equip(ctx()->store->equip->$uid);
  704. my_Assert($ins_equip->level < $ins_equip->Equip_MaxLevel(), ErrCode::user_store_equipLevelLimit);
  705. $mo = GameConfig::equip_levelupgrade_getItem($ins_equip->mo()->rarity, $ins_equip->qual, $ins_equip->mo()->position, $ins_equip->level);
  706. my_Assert(null != $mo, ErrCode::err_const_no);
  707. my_Assert(ctx()->baseInfo->gold >= $mo->needGold, ErrCode::notenough_gold_msg);
  708. $costTuzhiId = GameConfig::equip_position_getItem($ins_equip->mo()->position)->costTuzhiId;
  709. $tuzhiNum = 0;
  710. if (StlUtil::dictHasProperty(ctx()->store->items, $costTuzhiId)) {
  711. $tuzhiNum = ctx()->store->items->$costTuzhiId;
  712. }
  713. my_Assert($tuzhiNum >= $mo->needItemNum, ErrCode::notenough_item);
  714. ctx()->store(true)->removeItem($costTuzhiId, $mo->needItemNum);
  715. ctx()->base(true)->Consume_Gold($mo->needGold);
  716. TaskProc::OnAnyEquipUpLevel_X();
  717. TaskProc::OnAllEquipUpLevel_X();
  718. TaskProc::OnEquipLevelUpNum();
  719. FightProc::Ranking_FightPower();
  720. UserProc::updateUserInfo();
  721. return Resp::ok(array(
  722. 'gold' => $user->baseInfo->gold,
  723. 'store' => $user->store,
  724. 'task' => $user->task,
  725. ));
  726. }
  727. /**
  728. * 6405 单个装备部位一键升级
  729. * @return type
  730. */
  731. public static function EquipUpgrade_MaxLv() {
  732. list($uid) = req()->paras;
  733. my_Assert(StlUtil::dictHasProperty(ctx()->store->equip, $uid), ErrCode::user_store_NoEquip);
  734. $ins_equip = new Ins_Equip(ctx()->store->equip->$uid);
  735. $maxLevel = $ins_equip->Equip_MaxLevel();
  736. my_Assert($ins_equip->level < $ins_equip->Equip_MaxLevel(), ErrCode::user_store_equipLevelLimit);
  737. $tuzhiId = GameConfig::equip_position_getItem($ins_equip->mo()->position)->costTuzhiId;
  738. $itemNum_store = 0;
  739. if (StlUtil::dictHasProperty(ctx()->store->items, $tuzhiId)) {
  740. $itemNum_store = ctx()->store->items->$tuzhiId;
  741. }
  742. $up_Gold = 0;
  743. $up_needItem = 0;
  744. $up_lv = 0;
  745. $noUp_gold = false;
  746. $noUp_item = false;
  747. for ($i = $ins_equip->level; $i <= $maxLevel; $i++) {
  748. $up_Gold += GameConfig::equip_levelupgrade_getItem($ins_equip->mo()->rarity, $ins_equip->qual, $ins_equip->mo()->position, $i)->needGold;
  749. $up_needItem += GameConfig::equip_levelupgrade_getItem($ins_equip->mo()->rarity, $ins_equip->qual, $ins_equip->mo()->position, $i)->needItemNum;
  750. if (ctx()->baseInfo->gold >= $up_Gold) {
  751. $noUp_gold = true;
  752. }
  753. if ($itemNum_store >= $up_needItem) {
  754. $noUp_item = true;
  755. }
  756. if (ctx()->baseInfo->gold >= $up_Gold && $itemNum_store >= $up_needItem) {
  757. //$need_gold = $up_Gold;
  758. //$need_item = $up_needItem;
  759. $up_lv = $i;
  760. continue;
  761. }
  762. break;
  763. }
  764. if ($up_lv == 0) {
  765. my_Assert($noUp_gold, ErrCode::notenough_gold_msg);
  766. my_Assert($noUp_item, ErrCode::notenough_item);
  767. }
  768. ctx()->base(true)->Consume_Gold($up_Gold);
  769. ctx()->store(true)->removeItem($tuzhiId, $up_needItem);
  770. if ($up_lv > 0) {
  771. ctx()->store->equip->$uid->level = $up_lv;
  772. }
  773. TaskProc::OnAnyEquipUpLevel_X();
  774. TaskProc::OnAllEquipUpLevel_X();
  775. TaskProc::OnEquipLevelUpNum();
  776. FightProc::Ranking_FightPower();
  777. UserProc::updateUserInfo();
  778. return Resp::ok(array(
  779. 'gold' => ctx()->baseInfo->gold,
  780. 'store' => ctx()->store,
  781. 'task' => ctx()->task,
  782. ));
  783. }
  784. public static function AddItemInStore() {
  785. list($rwdStr) = req()->paras; //mask = 1:表示战斗中掉落
  786. $user = ctx();
  787. $err = self::AddMultiItemInStore($rwdStr);
  788. my_Assert(ErrCode::ok == $err, $err);
  789. UserProc::updateUserInfo();
  790. return Resp::ok(array(
  791. //'gold' => $user->baseInfo->gold,
  792. //'tili' => $user->baseInfo->tili,
  793. //'cash' => $user->baseInfo->cash,
  794. 'store' => $user->store));
  795. }
  796. static $reward = array();
  797. static $reward_Gem = array();
  798. //static $reward_hero = array();
  799. /**
  800. * 具体奖励存入背包
  801. * @param type $goodsStr
  802. * @param type $src
  803. */
  804. public static function AddMultiItemInStore($goodsStr, $src = 0) {
  805. if ($goodsStr == null) {
  806. return;
  807. }
  808. $ary = explode(";", $goodsStr);
  809. foreach ($ary as $value) {
  810. $val = explode(",", $value);
  811. my_Assert(count($val) > 1, "解析奖励字符串出错");
  812. list($itemId, $num) = $val; # ID, 数量
  813. $itemMo = GameConfig::item_getItem($itemId);
  814. if ($itemMo->itemType != 701 && $itemMo->itemType != 201 && $itemMo->itemType != 502 && $src != 1) {
  815. self::$reward[] = $value;
  816. }
  817. switch ($itemMo->itemType) {
  818. case 1:
  819. ctx()->baseInfo->Add_Gold($num);
  820. //self::checkEquipUpgradeTip();//废弃
  821. break;
  822. case 2:
  823. ctx()->baseInfo->Add_Cash($num);
  824. break;
  825. case 3:
  826. ctx()->baseInfo->Add_tili($num);
  827. break;
  828. case 4:
  829. ctx()->baseInfo->Add_Exp($num);
  830. break;
  831. case 100://图纸
  832. case 103://钥匙
  833. case 401://启灵石
  834. case 301://洗练石
  835. case 501://人物碎片
  836. case 601://人身果
  837. case 801://寻宝券
  838. self::PutItemsInStore($itemId, $num);
  839. // if ($itemMo->itemType == 100) {//图纸
  840. // self::checkEquipUpgradeTip();//废弃
  841. // }
  842. break;
  843. case 502://角色卡
  844. HeroProc::RoleCardUnlockHero($itemId, $num);
  845. break;
  846. case 201://宝石
  847. for ($i = 0; $i < $num; $i++) {
  848. $gem = self::initGem($itemId);
  849. if ($src != 1) {
  850. self::$reward_Gem[] = $gem->uid;
  851. }
  852. self::PutGemInStore($gem);
  853. if ($src == Enum_StoreSourceType::ShopBox) {
  854. SystemProc::GetGem_GreaterOrangeQual_ShopBox(req()->zoneid, ctx()->baseInfo->name, $gem->typeId);
  855. }
  856. }
  857. break;
  858. case 701://道具宝箱
  859. for ($i = 0; $i < $num; $i++) {
  860. self::DistributeItemsBox($itemId);
  861. }
  862. break;
  863. default:
  864. break;
  865. }
  866. }
  867. }
  868. public static function PutItemsInStore($itemId, $num) {
  869. $items = ctx()->store->items;
  870. if (StlUtil::dictHasProperty($items, $itemId)) {
  871. $items->$itemId += $num;
  872. } else {
  873. $items->$itemId = $num;
  874. }
  875. ctx()->store->items = $items;
  876. }
  877. /**
  878. * 拆分宝箱盒子
  879. * @param type $reward
  880. */
  881. public static function DistributeItemsBox($itemId) {
  882. $itemBoxMo = GameConfig::item_2023_box_getItem($itemId);
  883. my_Assert($itemBoxMo != null, ErrCode::err_const_no);
  884. if ($itemBoxMo->type == 1) {
  885. $strList = explode(';', $itemBoxMo->contents);
  886. $numList = explode('-', $strList[0]);
  887. $randNum = rand($numList[0], $numList[1]);
  888. $ctxList = explode(',', $strList[1]);
  889. $per = 0;
  890. foreach ($ctxList as $value) {
  891. $ctx = explode(':', $value);
  892. $per += $ctx[1];
  893. }
  894. $reward = "";
  895. for ($i = 0; $i < $randNum; $i++) {
  896. $ctxPer = rand(1, $per);
  897. $start = 0;
  898. $end = 0;
  899. $id = 0;
  900. foreach ($ctxList as $value) {
  901. $ctx = explode(':', $value);
  902. $end += $ctx[1];
  903. if ($ctxPer > $start && $ctxPer <= $end) {
  904. $id = $ctx[0];
  905. break;
  906. }
  907. $start = $end;
  908. }
  909. if ($id != 0) {
  910. $str = $id . ',1';
  911. if ($reward == "") {
  912. $reward = $str;
  913. } else {
  914. $reward = $reward . ';' . $str;
  915. }
  916. }
  917. }
  918. self::AddMultiItemInStore($reward);
  919. } else {
  920. self::AddMultiItemInStore($itemBoxMo->contents);
  921. }
  922. }
  923. // public static function PutEquipInStore($equipId, $num) {
  924. // if ($equipId == 0) {
  925. // return;
  926. // }
  927. // $n = count((array) ctx()->store->equip) + 1;
  928. //
  929. // for ($index = 0; $index < $num; $index++) {
  930. // $Equip = new Ins_Equip();
  931. // $Equip->uid = $n;
  932. // $Equip->typeId = $equipId;
  933. // $Equip->qual = GameConfig::equip_getItem($equipId)->qual;
  934. // ctx()->store->equip->$n = $Equip;
  935. // $n += 1;
  936. // }
  937. // }
  938. /**
  939. * 得到金币或是图纸的时候校验下,是否满足装备升级条件,满足则tip字段设置为1 废弃
  940. */
  941. // public static function checkEquipUpgradeTip() {
  942. // $equipDic = ctx()->store->equipPosition;
  943. // if ($equipDic != null) {
  944. // foreach ($equipDic as $k => &$equip) {
  945. // $equip = new Ins_EquipPosition($equip);
  946. // $lvMo = GameConfig::equip_levelupgrade_getItem($equip->level);
  947. // $needGold = $lvMo->needGold;
  948. // $needItemNum = $lvMo->needItemNum;
  949. // $neeItemId = $equip->mo()->costTuzhiId;
  950. //
  951. // if (ctx()->baseInfo->gold >= $needGold && StlUtil::dictHasProperty(ctx()->store->items, $neeItemId) && ctx()->store->items->$neeItemId >= $needItemNum) {
  952. // $equipDic->$k->tip = 1; //绿点是每次得到金币或是图纸了,只要满足升级条件都变绿
  953. // }
  954. // }
  955. // }
  956. // ctx()->store->equipPosition = $equipDic;
  957. // }
  958. /**
  959. * 新宝石入库
  960. */
  961. public static function PutGemIdInStore($id, $num = 1) {
  962. for ($i = 0; $i < $num; $i++) {
  963. $gem = self::initGem($id);
  964. $length = $gem->uid;
  965. ctx()->store->gemStore->$length = $gem;
  966. }
  967. }
  968. public static function PutGemInStore($gem, $num = 1) {
  969. for ($i = 0; $i < $num; $i++) {
  970. $length = $gem->uid;
  971. ctx()->store->gemStore->$length = $gem;
  972. }
  973. }
  974. public static function initGem($id) {
  975. $length = ctx()->store->gemLength;
  976. $length += 1;
  977. $gem = new Ins_Gem();
  978. $gem->uid = $length;
  979. $gem->typeId = $id;
  980. $gem->predicateId = self::RandomGemPredicateId($id);
  981. $tag = self::CheckNewGemTip($gem);
  982. $gem->isNew = $tag;
  983. ctx()->store->gemLength = $length;
  984. return $gem;
  985. }
  986. /**
  987. * 从仓库移除宝石
  988. */
  989. public static function RemoveGemInStore($uid) {
  990. if (StlUtil::dictHasProperty(ctx()->store->gemStore, $uid)) {
  991. StlUtil::dictRemove(ctx()->store->gemStore, $uid);
  992. }
  993. return 0;
  994. }
  995. /**
  996. * 新宝石随机词条 临时等刚哥
  997. */
  998. public static function RandomGemPredicateId($id) {
  999. $mo = GameConfig::gem_getItem($id);
  1000. my_Assert(null != $mo, "找不到宝石{$id}的配置数据");
  1001. if ($mo->isfixed_predicateId == 1) {
  1002. return $mo->predicateId;
  1003. }
  1004. $posId = $mo->position;
  1005. $qual = $mo->qual;
  1006. $arr = array();
  1007. $predicateMo = GameConfig::predicate();
  1008. foreach ($predicateMo as $key => $value) {
  1009. if ($value->positions != null) {
  1010. $list = explode(',', $value->positions);
  1011. if ($value->qual == $qual && in_array($posId, $list) && $value->attachTarget == "gem") {
  1012. $arr[] = $value->id;
  1013. }
  1014. }
  1015. }
  1016. if (count($arr) <= 0) {
  1017. return 40;
  1018. }
  1019. my_Assert(count($arr) > 0, "宝石没有对应词条信息");
  1020. $n = mt_rand(0, count($arr) - 1);
  1021. return $arr[$n];
  1022. //return 40;
  1023. }
  1024. /**
  1025. * 新宝石提示
  1026. */
  1027. public static function CheckNewGemTip($gem) {
  1028. $gemStore = ctx()->store->gemStore;
  1029. $tag = false;
  1030. foreach ($gemStore as $k => $ins_gem) {
  1031. if ($ins_gem->typeId == $gem->typeId && $ins_gem->predicateId == $gem->predicateId) {
  1032. $tag = true;
  1033. break;
  1034. }
  1035. }
  1036. return $tag == true ? 0 : 1;
  1037. }
  1038. //临时代码
  1039. // public static function InitGemInfo() {
  1040. // if(count((array)ctx()->store->gemStore) > 0){
  1041. // return;
  1042. // }
  1043. //
  1044. // $index = 0;
  1045. // $gem = GameConfig::gem();
  1046. //
  1047. // for ($i = 1; $i <=21; $i++) {
  1048. // foreach ($gem as $key => $value) {
  1049. // if($value->id == $i){
  1050. // self::PutGemInStore($value->typeId);
  1051. // }
  1052. //
  1053. // }
  1054. // }
  1055. //
  1056. //
  1057. //
  1058. //
  1059. // }
  1060. }