StoreProc.php 92 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098
  1. <?php
  2. //
  3. //namespace loyalsoft;
  4. //
  5. ///**
  6. // * Description of StoreProc
  7. // * 仓库/背包 处理流程
  8. // * ===========================
  9. // * 尚待处理的流程:道具售出时貌似存在多种格式....
  10. // * @author
  11. // */
  12. //class StoreProc {
  13. //
  14. // /**
  15. // * 逻辑分发
  16. // * 所有的Proc中必须有这样一个方法
  17. // */
  18. // static function procMain() {
  19. // switch (req()->cmd) {
  20. // case CmdCode::cmd_store_put: # 6401 放入仓库
  21. // return StoreProc::AddItemInStore();
  22. // case CmdCode::cmd_store_singleSell: # 6402 出售单个道具
  23. // return StoreProc::sellItem();
  24. // case CmdCode::cmd_store_mutliSell: # 6403 批量出售 卖掉
  25. // return StoreProc::sellMultiItemFromStore();
  26. // case CmdCode::cmd_store_use: # 6404 使用道具
  27. // return StoreProc::useItem();
  28. // case CmdCode::cmd_store_refresh: # 6405 获取最新的仓库数据
  29. // return StoreProc::refreshStore();
  30. // case CmdCode::cmd_store_delItem: # 6406 从仓库删除道具
  31. // return StoreProc::delItemFromStore();
  32. // case CmdCode::cmd_store_Testcmd: # 6407 测试方法
  33. // return StoreProc::Test();
  34. //// case CmdCode::cmd_store_ItemUpgrade: # 6408 装备升级
  35. //// return StoreProc::ItemUpgrade($req);
  36. //// case CmdCode::cmd_store_GemCompose: # 6408 装备合成
  37. //// return StoreProc::composeItem($req);
  38. ////
  39. // case CmdCode::cmd_store_WearEquip: # 6410 给英雄穿装备
  40. // return StoreProc::WearEquipToHero();
  41. // case CmdCode::cmd_store_UnWieldEquip: # 6411 将该装备从指定英雄上脱下
  42. // return StoreProc::UnWieldEquip();
  43. //
  44. ////
  45. // case CmdCode::cmd_store_AddMaxPacketNum: # 6412 扩展包裹格子数量
  46. // return StoreProc::AddPacketNum();
  47. //// case CmdCode::cmd_store_MeltEquip: # 6413 装备融合
  48. //// Err(ErrCode::err_method_obsoleted);
  49. ////// return StoreProc::MeltEquip($req);
  50. //// case CmdCode::cmd_store_PiecesCompose: # 6415 碎片合成
  51. //// return StoreProc::composePieces($req);
  52. // case CmdCode::cmd_store_WearYanling: # 6416 装备言灵
  53. // return StoreProc::WearYanlingToHero();
  54. // case CmdCode::cmd_store_UnWieldYanling: # 6417 卸下言灵
  55. // return StoreProc::UnWieldYanling();
  56. // case CmdCode::cmd_store_mergeYanlingbook: # 6418 利用言灵召唤书碎片合成召唤书
  57. // return self::MergeYanlingBook();
  58. // case CmdCode::cmd_store_callyanling: # 6419 利用言灵召唤书召唤言灵
  59. // return self::CallYanlingByBook();
  60. // case CmdCode::cmd_store_yanling_upgrade: # 6420 言灵进阶
  61. // return self::YanlingUpgrade();
  62. // case CmdCode::cmd_store__weapon_upgrade: # 6421武器升级
  63. // return self::weaponUpgrade();
  64. // case CmdCode::cmd_store__weapon_tupo: # 6422武器突破
  65. // return self::weaponTupo();
  66. // case CmdCode::cmd_store_weaponReplace: # 6423武器替换
  67. // return self::weaponReplace();
  68. // case CmdCode::cmd_store_GemCompose: #6424
  69. // return StoreProc::GemComposeItem();
  70. // case CmdCode::cmd_store_GemResearchLvUp: # 6425
  71. // return StoreProc::GemResearchLvUp();
  72. // case CmdCode::cmd_store_GemSet: #6426 宝石镶嵌
  73. // return StoreProc::GemSetYanLing();
  74. // case CmdCode::cmd_store_GemRemove:
  75. // return StoreProc::GemRemoveYanLing();
  76. // case CmdCode::cmd_store_unlockStore:
  77. // return StoreProc::unlockStore();
  78. // case CmdCode::cmd_store_buyWeapon: #6429
  79. // return self::buyWeapon();
  80. // case CmdCode::cmd_store_getShopWeapon: # 6430
  81. // return self::getShopWeapon();
  82. // case CmdCode::cmd_store_buySupplies: #6431 购买补给品
  83. // return self::buySupplies();
  84. // case CmdCode::cmd_store_expandStorage: # 6432
  85. // return self::expandStorage();
  86. // case CmdCode::cmd_store_changeStorage: # 6433
  87. // return self::changeStorage();
  88. // case CmdCode::cmd_store_changeBettleItem: # 6434
  89. // return self::changeBettleItem();
  90. // case CmdCode::cmd_store_useBettleItem: # 6435
  91. // return self::useBettleItem();
  92. // case CmdCode::cmd_store_setBettleItemUseVal: # 6436cmd_store_removeItem
  93. // return self::setBettleItemUseVal();
  94. // case CmdCode::cmd_store_removeItem: # 6437 删除所有类型道具cmd_store_killMosterAddData
  95. // return self::removeItem();
  96. // case CmdCode::cmd_store_killMosterAddData: # 6438 击杀怪,唤灵师获得的信息加成,暂时是经验
  97. // return self::killMosterAddData();
  98. //
  99. // case CmdCode::cmd_store_refreshItem: # 6439
  100. // return self::refreshItem();
  101. // case CmdCode::cmd_store_yanlingEvolve: #6440 言灵进化
  102. // return self::yanlingEvolve();
  103. // case CmdCode::cmd_store_yanlingEvolve_overall: #6441 一键进化
  104. // return self::yanlingEvolveCompose();
  105. // case CmdCode::cmd_store_setBettleItemAutoVal: #6442
  106. // return self::setBettleItemAutoVal();
  107. // case CmdCode::cmd_store_UpdateFightPower: #6443
  108. // return self::UpdateFightPower();
  109. // default:
  110. // Err(ErrCode::cmd_err);
  111. // }
  112. // }
  113. //
  114. // public static function UpdateFightPower() {
  115. // $fightPower = req()->paras[0];
  116. //
  117. // self::GetFightPower(req()->zoneid, req()->uid, $fightPower);
  118. //
  119. // RankProc::recordPlayerLevelInfo(req()->uid, req()->game->baseInfo->level, req()->zoneid);
  120. //
  121. // return Resp::ok(array("ret" => 'ok',));
  122. // }
  123. //
  124. // static function GetFightPower($zoneid,$uid,$fightPower) {
  125. // $key_fp = MemKey_GameRun::Game_FightPowerRank_zset($zoneid); # 战力榜
  126. // gMem()->zadd($key_fp, array($uid => $fightPower));
  127. // }
  128. //
  129. //
  130. // /**
  131. // * 一键进化
  132. // * @return type
  133. // */
  134. // public static function yanlingEvolveCompose() {
  135. // $comList = req()->paras[0];
  136. //
  137. // $yanling = ctx()->store->yanling;
  138. // foreach ($comList as $str) {
  139. // $list = explode(',', $str);
  140. // $index = 0;
  141. // $firstYanlingUId = $list[0];
  142. // $yanlingMo = GameConfig::item_yanling_getItem($yanling->$firstYanlingUId->typeId);
  143. // $yanlingQualityMo = GameConfig::yanlingQuality_getItem($yanlingMo->type, $yanling->$firstYanlingUId->quality);
  144. //
  145. // $weekType = $yanlingMo->weakType;
  146. // $arr = explode(',', $yanlingQualityMo->evolveCost);
  147. // $qly = $arr[0];
  148. // $type = $arr[1];
  149. // $num = $arr[2];
  150. // $n = 0;
  151. //
  152. // foreach ($list as $uid) {
  153. // my_Assert(StlUtil::dictHasProperty($yanling, $uid), ErrCode::hero_yanling_notfound);
  154. //
  155. // if ($index == 0) {
  156. // $index += 1;
  157. // continue;
  158. // }
  159. //
  160. // my_Assert($yanling->$uid->herouid == 0, ErrCode::yanling_canotconsume);
  161. // $costYanlingMo = GameConfig::item_yanling_getItem($yanling->$uid->typeId);
  162. // if ($type == 1) {
  163. // if ($uid != $firstYanlingUId && $costYanlingMo->type == $yanlingMo->type && $yanling->$uid->quality == $qly) {
  164. // $n += 1;
  165. // }
  166. // } elseif ($type == 2) {
  167. // $w = $costYanlingMo->weakType;
  168. // $q = $yanling->$uid->quality;
  169. // if ($uid != $firstYanlingUId && $w == $weekType && $q == $qly) {
  170. // $n += 1;
  171. // }
  172. // }
  173. // }
  174. //
  175. // my_Assert($n >= $num, ErrCode::yanling_canotevolve);
  176. // }
  177. //
  178. // $retList = array();
  179. // //进化
  180. // foreach ($comList as $str) {
  181. // $list = explode(',', $str);
  182. //
  183. // $firstYanlingUId = $list[0];
  184. // $yanling->$firstYanlingUId->quality += 1;
  185. // $retList[] = $firstYanlingUId;
  186. // array_shift($list);
  187. // self::YanlingCost($list, $yanling);
  188. // }
  189. //
  190. // ctx()->store->yanling = $yanling;
  191. //
  192. // UserProc::updateUserInfo();
  193. //
  194. // return Resp::ok(array("store" => ctx()->store(), "gold" => ctx()->baseInfo->gold, "evolveYanling" => $retList,));
  195. // }
  196. //
  197. // /**
  198. // * 6440 言灵进化
  199. // */
  200. // public static function yanlingEvolve() {
  201. // $evolveYanlingUId = req()->paras[0];
  202. // $ids = req()->paras[1];
  203. //
  204. // my_Assert(StlUtil::dictHasProperty(ctx()->store->yanling, $evolveYanlingUId), ErrCode::hero_yanling_notfound);
  205. // $yanling = ctx()->store->yanling;
  206. // $evolveYanlingId = $yanling->$evolveYanlingUId->typeId;
  207. // $itemMo = GameConfig::item_base_getItem($evolveYanlingId);
  208. // my_Assert($itemMo != null, ErrCode::err_const_no);
  209. // if (!StlUtil::dictHasProperty($yanling->$evolveYanlingUId, 'quality')) {
  210. // $yanling->$evolveYanlingUId->quality = $itemMo->quality;
  211. // }
  212. //
  213. // $mo = GameConfig::item_yanling_getItem($evolveYanlingId);
  214. // my_Assert($mo != null, ErrCode::err_const_no);
  215. //
  216. // $yanlingQualityMo = GameConfig::yanlingQuality_getItem($mo->type, $yanling->$evolveYanlingUId->quality);
  217. // my_Assert($yanlingQualityMo != null, ErrCode::err_const_no);
  218. //
  219. // $arr = explode(',', $yanlingQualityMo->evolveCost);
  220. // $qly = $arr[0];
  221. // $type = $arr[1];
  222. // $num = $arr[2];
  223. //
  224. // $n = 0;
  225. // $list = explode(',', $ids);
  226. // foreach ($list as $uid) {
  227. // $tId = $yanling->$uid->typeId;
  228. // my_Assert($yanling->$uid->herouid == 0, ErrCode::yanling_canotconsume);
  229. //
  230. // $costYanlingMo = GameConfig::item_yanling_getItem($tId);
  231. // if ($type == 1) {//本体 同type 同$qly
  232. // if ($uid != $evolveYanlingUId && $costYanlingMo->type == $mo->type && $yanling->$uid->quality == $qly) {
  233. // $n += 1;
  234. // }
  235. // } elseif ($type == 2) {//同元素 同品阶
  236. // $weekType = $mo->weakType;
  237. // //$quality = $yanling->$evolveYanlingUId->quality;
  238. // $w = $costYanlingMo->weakType;
  239. // $q = $yanling->$uid->quality;
  240. // if ($uid != $evolveYanlingUId && $w == $weekType && $q == $qly) {
  241. // $n += 1;
  242. // }
  243. // }
  244. // }
  245. // my_Assert($n >= $num, ErrCode::yanling_canotevolve);
  246. //
  247. // self::YanlingCost($list, $yanling);
  248. //
  249. // $yanling->$evolveYanlingUId->quality += 1;
  250. //
  251. // ctx()->store->yanling = $yanling;
  252. // UserProc::updateUserInfo();
  253. //
  254. // return Resp::ok(array("store" => ctx()->store(), "gold" => ctx()->baseInfo->gold,));
  255. // }
  256. //
  257. // public static function YanlingCost($list, &$yanling) {
  258. // foreach ($list as $uid) {
  259. // $curExp = $yanling->$uid->curStarExp;
  260. // //经验 金币突破材料
  261. // if ($yanling->$uid->starLv > 0) {
  262. // $starlv = $yanling->$uid->starLv;
  263. // for ($i = 1; $i <= $starlv; $i++) {
  264. // $goodsStr = GameConfig::yanlingextra_level_getItem($yanling->$uid->typeId, $starlv)->costItems;
  265. // $gold = GameConfig::yanlingextra_level_getItem($yanling->$uid->typeId, $starlv)->gold;
  266. // ctx()->base(true)->Add_Gold($gold);
  267. // StoreProc::AddMultiItemInStore($goodsStr);
  268. // }
  269. // }
  270. //
  271. // self::giveBackYanlingDevelopMaterialDeal($curExp);
  272. //
  273. // //删除言灵
  274. // StlUtil::dictRemove($yanling, $uid);
  275. // }
  276. // }
  277. //
  278. // public static function giveBackYanlingDevelopMaterialDeal($curExp) {
  279. // if ($curExp < 100) {
  280. // return "";
  281. // }
  282. // $stoneList = GameConfig::item_stones_type_getItemArray(2);
  283. // $retArr = array();
  284. // foreach ($stoneList as $stone) {
  285. // $typeId = $stone->typeId;
  286. // $exp = $stone->baseExp;
  287. // $retArr[] = $typeId . '-' . $exp;
  288. // }
  289. // krsort($retArr);
  290. //
  291. // $dic = new \stdClass();
  292. // foreach ($stoneList as $stone) {
  293. // $typeId = $stone->typeId;
  294. // $exp = $stone->baseExp;
  295. // $dic->$typeId = $exp;
  296. // }
  297. //
  298. // $tempExp = $curExp;
  299. // foreach ($retArr as $val) {
  300. // $valList = explode('-', $val);
  301. // $itemId = $valList[0];
  302. // $exp = $valList[1];
  303. // $addNum = intval($tempExp / $exp);
  304. // if ($addNum == 0) {//说明自己的经验比强化符的小
  305. // continue;
  306. // } else {
  307. // $ctx = $itemId . ',' . $addNum;
  308. // //$prizeArr[] = $ctx;
  309. // StoreProc::AddMultiItemInStore($ctx);
  310. // $stoneExp = $dic->$itemId;
  311. // $tempExp = $tempExp - $addNum * $stoneExp;
  312. // }
  313. // }
  314. // }
  315. //
  316. // /**
  317. // * 背包里新标志道具查看 0 系统 1武器,2碎片,3材料, 4 言灵, 5 礼包
  318. // */
  319. // public static function refreshItem() {
  320. // $type = req()->paras[0];
  321. // $uid = req()->paras[1];
  322. //
  323. // if ($type == 101 && in_array($uid, ctx()->store->weaponRecord)) {
  324. // StlUtil::arrayRemove(ctx()->store->weaponRecord, $uid);
  325. // } elseif ($type == 401 && in_array($uid, ctx()->store->yanlingRecord)) {
  326. // StlUtil::arrayRemove(ctx()->store->yanlingRecord, $uid);
  327. // } else {
  328. // if (in_array($uid, ctx()->store->itemRecord)) {
  329. // StlUtil::arrayRemove(ctx()->store->itemRecord, $uid);
  330. // }
  331. // }
  332. //
  333. //
  334. // UserProc::updateUserInfo();
  335. //
  336. // return Resp::ok(array('store' => ctx()->store,));
  337. // }
  338. //
  339. // /**
  340. // * 6438 击杀怪,唤灵师获得的信息加成,暂时是经验
  341. // */
  342. // public static function killMosterAddData() {
  343. // $heroUID = req()->paras[0];
  344. // $mosterId = req()->paras[1]; # 提取参数
  345. //
  346. // $hero = ctx()->heros(true);
  347. //
  348. // $mo = GameConfig::hero_getItem($mosterId);
  349. // my_Assert($mo != null, ErrCode::err_const_no);
  350. //
  351. // //经验修正率=1 + 0.05 × (怪物等级 - 角色(唤灵师)等级)
  352. // //角色所得经验 = 怪物经验 * 经验修正率
  353. //
  354. // $lv = substr($mo->heroId, -2);
  355. // $n = substr($lv, 0, 1);
  356. // if ($n == 0) {
  357. // $lv = substr($lv, 1, 1);
  358. // }
  359. // $collectHeros = $hero->collectHeros;
  360. // my_default_Obj($collectHeros);
  361. // my_Assert(CommUtil::isPropertyExists($collectHeros, $heroUID), ErrCode::hero_no); # 要升级的英雄不存在
  362. // $targetHero = new Ins_UserHero($collectHeros->$heroUID); # 英雄对象
  363. // $heroLv = $targetHero->level;
  364. // $per = 1 + 0.05 * ($lv - $heroLv);
  365. //
  366. // $totalExp = intval($mo->exp * $per);
  367. // if ($totalExp < 0) {
  368. // $totalExp = 0;
  369. // }
  370. //
  371. // $targetHero = HeroProc::HeroAddEXP($heroUID, $totalExp);
  372. //
  373. // UserProc::updateUserInfo();
  374. //
  375. // return Resp::ok(array('hero' => $targetHero, 'exp' => $mo->exp,));
  376. // }
  377. //
  378. // /**
  379. // * 删除所有类型道具
  380. // */
  381. // public static function removeItem() {
  382. // $str = req()->paras[0]; # 提取参数
  383. //
  384. // $list = explode(';', $str);
  385. // foreach ($list as $k => $val) {
  386. // $slist = explode('-', $val);
  387. // $itemType = $slist[0]; # 提取参数
  388. // $uid = $slist[1]; # 提取参数
  389. // $typeId = $slist[2];
  390. // $num = $slist[3]; # 提取参数
  391. //
  392. // self::removeStoreItem($itemType, $uid, $typeId, $num);
  393. // }
  394. //
  395. // UserProc::updateUserInfo();
  396. //
  397. // return Resp::ok(array("store" => ctx()->store(),));
  398. // }
  399. //
  400. // public static function removeStoreItem($itemType, $uid, $typeId, $num) {
  401. // $store = ctx()->store(true);
  402. // switch ($itemType) {//物品大归类 0 系统 1武器,2碎片,3材料, 4 言灵, 5 礼包,6 宝石道具 7任务卡
  403. // case 1:
  404. // StoreProc::removeEquipFromStore($uid, $typeId);
  405. // break;
  406. // case 2:
  407. // case 3:
  408. // case 7:
  409. // case 6:
  410. // StoreProc::removeItemFromStore($store, $typeId, $num);
  411. // break;
  412. // case 4:
  413. // StoreProc::removeYanlingFromStore($uid, $typeId);
  414. // break;
  415. // default:
  416. // break;
  417. // }
  418. // }
  419. //
  420. // /**
  421. // * 6436
  422. // * @return type
  423. // */
  424. // public static function setBettleItemUseVal() {
  425. // $index = req()->paras[0]; # 提取参数
  426. // $val = req()->paras[1]; # 提取参数
  427. //
  428. // $store = ctx()->store(true);
  429. //
  430. // //my_Assert($store->battleItem->$index->num >= 1, ErrCode::store_bettleitemNumNotEnough);
  431. // //$store->battleItem->$index->isAuto = 1;
  432. // $store->battleItem->$index->attrVal = $val;
  433. //
  434. // UserProc::updateUserInfo();
  435. //
  436. // return Resp::ok(array("store" => ctx()->store(),));
  437. // }
  438. //
  439. // /**
  440. // * 6436
  441. // * @return type
  442. // */
  443. // public static function setBettleItemAutoVal() {
  444. // $index = req()->paras[0]; # 提取参数
  445. // $val = req()->paras[1]; # 提取参数
  446. //
  447. // $store = ctx()->store(true);
  448. //
  449. // //my_Assert($store->battleItem->$index->num >= 1, ErrCode::store_bettleitemNumNotEnough);
  450. // $store->battleItem->$index->isAuto = $val;
  451. //
  452. // UserProc::updateUserInfo();
  453. //
  454. // return Resp::ok(array("store" => ctx()->store(),));
  455. // }
  456. //
  457. // /**
  458. // * 6435
  459. // * @return type
  460. // */
  461. // public static function useBettleItem() {
  462. // $index = req()->paras[0]; # 提取参数
  463. //
  464. // $store = ctx()->store(true);
  465. //
  466. // //my_Assert($store->battleItem->$index->num >= 1, ErrCode::store_bettleitemNumNotEnough);
  467. // $id = $store->battleItem->$index->id;
  468. //
  469. // //$store->battleItem->$index->num -= 1;
  470. // StoreProc::removeItemFromStore($store, $id);
  471. //// if(StlUtil::dictHasProperty($store->items,$id)){
  472. //// $store->items->$id -= 1;
  473. //// if($store->items->$id <= 0){
  474. //// unset($store->items->$id);
  475. //// }
  476. //// }
  477. //// if ($store->battleItem->$index->num <= 0) {
  478. //// unset($store->battleItem->$index);
  479. //// }
  480. //
  481. // UserProc::updateUserInfo();
  482. //
  483. // return Resp::ok(array("store" => ctx()->store(),));
  484. // }
  485. //
  486. // /**
  487. // * 6434
  488. // * @return type
  489. // */
  490. // public static function changeBettleItem() {
  491. // $type = req()->paras[0]; # 提取参数
  492. // $index = req()->paras[1]; # 提取参数
  493. // $itemid = req()->paras[2]; # 提取参数
  494. //
  495. // $store = ctx()->store(true);
  496. //
  497. // $str = GameConfig::globalsettings()->YaoPingAttrInitVal;
  498. // $slist = explode(';', $str);
  499. // $hp = explode(',', $slist[0])[1];
  500. // $mp = explode(',', $slist[1])[1];
  501. //
  502. // if ($type == 0) {//添加
  503. // $item = new Ins_battleItem();
  504. // $item->index = $index;
  505. // $item->id = $itemid;
  506. // $item->num = $store->items->$itemid;
  507. //
  508. // $subType = GameConfig::item_base_getItem($itemid)->subType;
  509. // if ($subType == 341) {
  510. // $item->attrVal = $hp;
  511. // } else {
  512. // $item->attrVal = $mp;
  513. // }
  514. //
  515. // $store->battleItem->$index = $item;
  516. // } else {
  517. // unset($store->battleItem->$index);
  518. // }
  519. // UserProc::updateUserInfo();
  520. // return Resp::ok(array("store" => ctx()->store(),));
  521. // }
  522. //
  523. // /**
  524. // * 6432
  525. // * @return type
  526. // */
  527. // public static function changeStorage() {
  528. // $index = req()->paras[0]; # 选中的第几个格子
  529. // $type = req()->paras[1]; # 1:放入 2移除到背包
  530. // $itemType = req()->paras[2]; # 道具类型
  531. // $uid = req()->paras[3]; # 道具的uid
  532. //
  533. // $store = ctx()->store(true);
  534. // my_Assert(StlUtil::dictHasProperty($store->storage, $index), ErrCode::store_NotHaveStorage);
  535. //
  536. // $storage = $store->storage->$index;
  537. // $num = 0;
  538. // foreach ($storage as $k => $dic) {
  539. // $num += count((array) $dic);
  540. // }
  541. //
  542. // switch ($itemType) {
  543. // case 101://武器
  544. // if ($type == 1) {
  545. // my_Assert($num < 50, ErrCode::store_StorageEnough);
  546. // $equipVo = $store->equipment->$uid;
  547. // $storage->equipment->$uid = $equipVo; //添加
  548. //
  549. // StoreProc::removeEquipFromStore($uid, $equipVo->typeId); //移除
  550. // } else {
  551. // $equipVo = $storage->equipment->$uid;
  552. // $store->equipment->$uid = $equipVo;
  553. //
  554. // unset($storage->equipment->$uid);
  555. // }
  556. //
  557. // break;
  558. // case 401://言灵
  559. // if ($type == 1) {
  560. // my_Assert($num < 50, ErrCode::store_StorageEnough);
  561. // $yanlingVo = $store->yanling->$uid;
  562. // $storage->yanling->$uid = $yanlingVo; //添加
  563. //
  564. // StoreProc::removeYanlingFromStore($uid, $yanlingVo->typeId); //移除
  565. // } else {
  566. // $yanlingVo = $storage->yanling->$uid;
  567. // $store->yanling->$uid = $yanlingVo;
  568. //
  569. // unset($storage->yanling->$uid);
  570. // }
  571. //
  572. // break;
  573. // default://其他道具
  574. // if ($type == 1) {
  575. // my_Assert($num < 50, ErrCode::store_StorageEnough);
  576. // $itemNum = $store->items->$uid;
  577. // if (!StlUtil::dictHasProperty($storage->itemDic, $uid)) {
  578. // $storage->itemDic->$uid = 0;
  579. // }
  580. // $storage->itemDic->$uid += $itemNum; //添加
  581. // StoreProc::removeItemFromStore($store, $uid, $itemNum);
  582. // } else {
  583. // $itemNum = $storage->itemDic->$uid;
  584. // $goodsStr = $uid . "," . $itemNum;
  585. // StoreProc::AddMultiItemInStore($goodsStr);
  586. //
  587. // unset($storage->itemDic->$uid);
  588. // }
  589. //
  590. // break;
  591. // }
  592. //
  593. // $store->storage->$index = $storage;
  594. //
  595. // //ctx()->store(true) = $store;
  596. // UserProc::updateUserInfo();
  597. //
  598. // return Resp::ok(array("store" => $store,));
  599. // }
  600. //
  601. // /**
  602. // * 储物间扩容
  603. // * @return type
  604. // */
  605. // public static function expandStorage() {
  606. // $cost = GameConfig::globalsettings()->expandStorageCost;
  607. // $list = explode(',', $cost);
  608. //
  609. // $key = 3;
  610. // my_Assert(!StlUtil::dictHasProperty(ctx()->store(true)->storage, $key), ErrCode::store_expandStorage);
  611. //
  612. // if ($list[0] == 1) {
  613. // my_Assert(ctx()->base(true)->gold >= $list[1], ErrCode::notenough_gold_msg);
  614. // ctx()->base(true)->Consume_Gold($list[1]);
  615. // } elseif ($list[0] == 2) {
  616. // my_Assert(ctx()->base(true)->cash >= $list[1], ErrCode::notenough_cash_msg);
  617. // ctx()->base(true)->Consume_Cash($list[1]);
  618. // }
  619. // $str = $list[0] . "," . $list[1];
  620. // ctx()->store(true)->storage->$key = new Ins_storage();
  621. //
  622. // UserProc::updateUserInfo();
  623. //
  624. // return Resp::ok(array("storage" => ctx()->store(true)->storage, "cost" => $str,));
  625. // }
  626. //
  627. // /**
  628. // * 6431 购买补给品
  629. // */
  630. // public static function buySupplies() {
  631. // $npcid = req()->paras[0]; # 提取参数
  632. // $itemid = req()->paras[1]; # 提取参数
  633. // $num = req()->paras[2]; # 提取参数
  634. // //补充shop_supplies的mo
  635. // $mo = GameConfig::shop_supplies_getItem($npcid, $itemid);
  636. // my_Assert($mo != null, ErrCode::err_const_no);
  637. //
  638. // $cost = $mo->cost * $num;
  639. // my_Assert($num <= $mo->num, ErrCode::err_const_no);
  640. //
  641. // my_Assert(ctx()->base(true)->gold >= $cost, ErrCode::notenough_gold_msg);
  642. //
  643. // ctx()->base(true)->Consume_Gold($cost);
  644. // $goodsStr = $itemid . ',' . $num;
  645. //
  646. // StoreProc::AddMultiItemInStore($goodsStr);
  647. //
  648. // UserProc::updateUserInfo();
  649. //
  650. // return Resp::ok(array("store" => ctx()->store(), "cost" => $cost,));
  651. // }
  652. //
  653. // /**
  654. // *
  655. // */
  656. // public static function getShopWeapon() {
  657. // $npcid = req()->paras[0]; # 提取参数
  658. //
  659. // self::DailyRefreshWeapon($npcid);
  660. //
  661. // UserProc::updateUserInfo();
  662. //
  663. // return Resp::ok(array(
  664. // "store" => ctx()->store(), #
  665. // ));
  666. // }
  667. //
  668. // /**
  669. // *
  670. // * @return type
  671. // */
  672. // public static function buyWeapon() {
  673. // $npcid = req()->paras[0]; # 提取参数
  674. // $weaponId = req()->paras[1]; # 提取参数
  675. //
  676. // $store = ctx()->store(true);
  677. // $type = 0;
  678. //
  679. // $tag = true;
  680. // if (StlUtil::dictHasProperty($store->weaponReward, $npcid)) {
  681. // $dic = $store->weaponReward->$npcid;
  682. // foreach ($dic as $k => $list) {
  683. // if (in_array($weaponId, $list)) {
  684. // $tag = false;
  685. // break;
  686. // }
  687. // }
  688. // }
  689. //
  690. // my_Assert($tag == true, ErrCode::store_weaponCantBuy);
  691. //
  692. // $list = GameConfig::shop_weapon_getItemArray($npcid);
  693. // $cost = 0;
  694. // foreach ($list as $item) {
  695. // $weaponList = explode(';', $item->weaponlist);
  696. // foreach ($weaponList as $value) {
  697. // $pList = explode(',', $value);
  698. // if (in_array($weaponId, $pList)) {
  699. // $type = $item->id;
  700. // $cost = $item->cost;
  701. // break 2;
  702. // }
  703. // }
  704. // }
  705. //
  706. // my_Assert(ctx()->base(true)->gold >= $cost, ErrCode::notenough_gold_msg);
  707. // ctx()->base(true)->Consume_Gold($cost);
  708. //
  709. // if (!StlUtil::dictHasProperty($store->weaponReward, $npcid)) {
  710. // $store->weaponReward->$npcid = new \stdClass();
  711. // }
  712. // $store->weaponReward->$npcid->$type[] = $weaponId;
  713. //
  714. // self::PutEquipInStore($weaponId);
  715. //
  716. // ctx()->store = $store;
  717. //
  718. // UserProc::updateUserInfo();
  719. // return Resp::ok(array(
  720. // "store" => $store,
  721. // "cost" => $cost,
  722. // ));
  723. // }
  724. //
  725. // /*
  726. // * 每日刷新武器
  727. // */
  728. //
  729. // public static function DailyRefreshWeapon($npcid = null) {
  730. // //没有数据初始化,有数据不在管
  731. // if ($npcid != null && !StlUtil::dictHasProperty(ctx()->store()->weaponPool, $npcid)) {
  732. // $list = GameConfig::shop_weapon_getItemArray($npcid);
  733. //
  734. // foreach ($list as $value) {
  735. // $ret = new \stdClass();
  736. // $arr = explode(';', $value->weaponlist);
  737. // foreach ($arr as $item) {
  738. // $itemList = explode(',', $item);
  739. // $id = $itemList[0];
  740. // $per = $itemList[1];
  741. // $ret->$id = $per;
  742. // }
  743. // $retArr = array();
  744. // $type = $value->id;
  745. // $pArr = self::randweapon($ret, $value->num);
  746. // //数组合并
  747. // $retArr = array_merge($retArr, $pArr);
  748. // if (!StlUtil::dictHasProperty(ctx()->store()->weaponPool, $npcid)) {
  749. // ctx()->store()->weaponPool->$npcid = new \stdClass();
  750. // }
  751. // ctx()->store()->weaponPool->$npcid->$type = $retArr;
  752. // }
  753. // } else if ($npcid == null) {
  754. // //每日登录刷新,刷新的时候把已经购买过的武器去掉;
  755. // $dic = ctx()->store()->weaponPool;
  756. // foreach ($dic as $npcid => $val) {
  757. // $list = GameConfig::shop_weapon_getItemArray($npcid);
  758. // foreach ($list as $value) {
  759. // $ret = new \stdClass();
  760. // $arr = explode(';', $value->weaponlist);
  761. // foreach ($arr as $item) {
  762. // $itemList = explode(',', $item);
  763. // $id = $itemList[0];
  764. // $per = $itemList[1];
  765. // $ret->$id = $per;
  766. // }
  767. //
  768. // $ret2 = $ret;
  769. // $type = $value->id;
  770. // if (StlUtil::dictHasProperty(ctx()->store()->weaponReward, $npcid)) {
  771. // $weaponList = ctx()->store()->weaponReward->$npcid->$type;
  772. // foreach ($weaponList as $wid) {
  773. // if (StlUtil::dictHasProperty($ret, $wid)) {
  774. // StlUtil::dictRemove($ret, $wid);
  775. // }
  776. // }
  777. // }
  778. //
  779. // $temp = $ret;
  780. // if (count((array) $ret) < $value->num) {//一旦所有的武器或是不够刷新数量了,重置当前档位
  781. // $temp = $ret2;
  782. // ctx()->store()->weaponReward->$npcid->$type = array();
  783. // }
  784. // $retArr = array();
  785. //
  786. // $pArr = self::randweapon($temp, $value->num);
  787. //
  788. // $retArr = array_merge($retArr, $pArr);
  789. // ctx()->store()->weaponPool->$npcid->$type = $retArr;
  790. // }
  791. // }
  792. // }
  793. // }
  794. //
  795. // static function randweapon($temp, $limit) {
  796. // $resultArr = array();
  797. // $num = 0;
  798. // while (true) {
  799. // $total = 0;
  800. // foreach ($temp as $k => $v) {
  801. // $total += $v;
  802. // }
  803. //
  804. // $n = rand(1, $total);
  805. // $start = 0;
  806. // foreach ($temp as $id => $per) {
  807. // $start += $per;
  808. // if ($n <= $start) {
  809. // if (in_array($id, $resultArr)) {
  810. // StlUtil::dictRemove($temp, $id);
  811. // break;
  812. // } else {
  813. // $resultArr[] = $id;
  814. // $num += 1;
  815. // break;
  816. // }
  817. // }
  818. // }
  819. //
  820. // if ($num >= $limit) {
  821. // break;
  822. // }
  823. // }
  824. //
  825. // return $resultArr;
  826. // }
  827. //
  828. // /**
  829. // * 扩容
  830. // * @return type
  831. // */
  832. // static function unlockStore() {
  833. // //list() = req()->paras;
  834. // $user = ctx();
  835. //
  836. // $mo = GameConfig::expandStoreNum_getItem($user->privateState->expandNum + 1);
  837. // my_Assert($mo != null, ErrCode::err_const_no);
  838. // my_Assert($user->baseInfo->gold >= $mo->cost, ErrCode::notenough_gold_msg);
  839. //
  840. // $user->base(true)->Consume_Gold($mo->cost);
  841. // $user->privateState->expandNum += 1;
  842. // ctx($user);
  843. //
  844. // UserProc::updateUserInfo(); # 回写玩家数据
  845. // return Resp::ok(array(
  846. // "gold" => $user->baseInfo->gold,
  847. // "expandNum" => $user->privateState->expandNum,
  848. // ));
  849. // }
  850. //
  851. // /**
  852. // * 宝石镶嵌
  853. // */
  854. // static function GemSetYanLing() {
  855. // list($gemId, $yanlingUid) = req()->paras;
  856. // $user = ctx();
  857. //
  858. // $yanling = $user->store->yanling;
  859. // my_Assert(CommUtil::isPropertyExists($yanling, $yanlingUid), ErrCode::hero_yanling_errorYanling);
  860. // my_Assert(CommUtil::isPropertyExists($user->store->items, $gemId) && $user->store->items->$gemId > 0, ErrCode::store_itemno_err);
  861. //
  862. // if (!StlUtil::dictHasProperty($yanling->$yanlingUid, "gemId")) {//临时
  863. // $yanling->$yanlingUid->gemId = 0;
  864. // }
  865. //
  866. // my_Assert($yanling->$yanlingUid->gemId == 0, ErrCode::store_YanLingHaveGem);
  867. //
  868. // StoreProc::removeItemFromStore($user->store, $gemId);
  869. // $yanling->$yanlingUid->gemId = $gemId;
  870. //
  871. // $user->store->yanling = $yanling;
  872. // ctx($user);
  873. //
  874. // UserProc::updateUserInfo(); # 回写玩家数据
  875. // return Resp::ok(array(
  876. // "store" => $user->store, # # 目前来看只涉及到items变化
  877. // ));
  878. // }
  879. //
  880. // /**
  881. // * 从严灵上卸下宝石
  882. // */
  883. // static function GemRemoveYanLing() {
  884. // list($yanlingUid) = req()->paras;
  885. // $user = ctx();
  886. // my_Assert(CommUtil::isPropertyExists($user->store->yanling, $yanlingUid), ErrCode::hero_yanling_errorYanling);
  887. // $gemId = $user->store->yanling->$yanlingUid->gemId;
  888. //
  889. // my_Assert($gemId != 0, ErrCode::store_YanLingNotGem);
  890. //
  891. // $goodsStr = $gemId . ",1";
  892. // StoreProc::AddMultiItemInStore($goodsStr);
  893. // $user->store->yanling->$yanlingUid->gemId = 0;
  894. //
  895. // ctx($user);
  896. //
  897. // UserProc::updateUserInfo(); # 回写玩家数据
  898. // return Resp::ok(array(
  899. // "store" => $user->store, # # 目前来看只涉及到items变化
  900. // ));
  901. // }
  902. //
  903. // /**
  904. // * 宝石合成
  905. // */
  906. // static function GemComposeItem() {
  907. // list($gemId, $num) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
  908. // $user = ctx();
  909. // //my_Assert(CommUtil::isPropertyExists($myPacketItems, $costItemId), ErrCode::store_itemnotenough); #
  910. //
  911. // $mo = GameConfig::gem_formula_getItem($gemId);
  912. // my_Assert($mo != null, ErrCode::err_const_no); #
  913. // my_Assert($mo->levellimit <= $user->Gem->level, ErrCode::store_GemComplose_ResearchLevelLimit); #
  914. // $itemId = $mo->drawItem;
  915. // if ($itemId != "") {
  916. // my_Assert(StlUtil::dictHasProperty($user->store->items, $itemId) && $user->store->items->$itemId > 0, ErrCode::store_GemComploseTuZhiNotEnough); #
  917. // }
  918. //
  919. // if ($mo->composeMaterial != "") {
  920. // $mList = explode(',', $mo->composeMaterial);
  921. // $itemId = $mList[0];
  922. // $num = $mList[1];
  923. // my_Assert(StlUtil::dictHasProperty($user->store->items, $itemId) && $user->store->items->$itemId > $num, ErrCode::store_GemComploseMaterialNotEnough);
  924. //
  925. // //扣除材料
  926. // StoreProc::removeItemFromStore($user->store, $itemId, $num);
  927. // }
  928. //
  929. // $gList = explode(',', $mo->composeGem);
  930. // $itemId = $gList[0];
  931. // my_Assert(StlUtil::dictHasProperty($user->store->items, $itemId) && $user->store->items->$itemId > $gList[1], ErrCode::store_ComploseGemNotEnough);
  932. // my_Assert($user->baseInfo->gold >= $mo->composeGold, ErrCode::notenough_gold_msg);
  933. //
  934. // //扣除配方金币 宝石
  935. // $user->base(true)->Consume_Gold($mo->composeGold);
  936. // StoreProc::removeItemFromStore($user->store, $gList[0], $gList[1]);
  937. // $goodsStr = $gemId . ',1';
  938. // StoreProc::AddMultiItemInStore($goodsStr);
  939. // ctx($user);
  940. //
  941. // UserProc::updateUserInfo(); # 回写玩家数据
  942. // return Resp::ok(array(
  943. // "store" => $user->store, # # 目前来看只涉及到items变化
  944. // 'gold' => $user->baseInfo->gold,
  945. // ));
  946. // }
  947. //
  948. // /**
  949. // * 宝石合成的研究等级提升
  950. // */
  951. // static function GemResearchLvUp() {
  952. // //list() = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
  953. // $user = ctx();
  954. // $researchLevel = $user->Gem->level; //研究等级
  955. //
  956. // $mo = GameConfig::gem_researchlevel_getItem($researchLevel + 1);
  957. //
  958. // my_Assert($mo != null, ErrCode::err_const_no);
  959. // my_Assert($mo->userlevelLimit <= $user->baseInfo->level, ErrCode::store_GemResearchLvUp_UserLevelLimit);
  960. // //$list = explode(',',$mo->unlockLevelGoldCost);
  961. //
  962. // my_Assert($mo->unlockLevelGoldCost <= $user->baseInfo->gold, ErrCode::notenough_gold_msg);
  963. //
  964. // $user->base(true)->Consume_Gold($mo->unlockLevelGoldCost);
  965. // $user->Gem->level += 1;
  966. // ctx($user);
  967. //
  968. // UserProc::updateUserInfo(); # 回写玩家数据
  969. // return Resp::ok(array(
  970. // "lv" => $user->Gem->level, # # 目前来看只涉及到items变化
  971. // 'gold' => $user->baseInfo->gold,
  972. // ));
  973. // }
  974. //
  975. // /**
  976. // * 武器升级
  977. // */
  978. // static function weaponUpgrade() {
  979. // list($uid, $wuqiList, $items) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
  980. // $user = ctx();
  981. // $equipment = $user->store->equipment;
  982. //
  983. // my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
  984. // $myPacketItems = $user->store->items;
  985. // //消耗材料道具
  986. // $total = 0;
  987. // $totalGold = 0;
  988. // foreach ($items as $costItemId => $costNumber) {
  989. // my_Assert(CommUtil::isPropertyExists($myPacketItems, $costItemId), ErrCode::store_itemnotenough); #
  990. // my_Assert($myPacketItems->$costItemId >= $costNumber, ErrCode::store_itemnotenough); # 检查道具的数量,在背包中是否充足
  991. // $mo = GameConfig::item_stones_getItem($costItemId);
  992. // my_Assert($mo != null, ErrCode::err_const_no);
  993. //
  994. // StoreProc::removeItemFromStore($user->store, $costItemId, $costNumber);
  995. // $total += $mo->baseExp * $costNumber;
  996. // $totalGold += $mo->costGold * $costNumber;
  997. // }
  998. //
  999. // $wuqiExp = 0;
  1000. // //消耗武器
  1001. // foreach ($wuqiList as $wuqiId) {
  1002. // my_Assert(CommUtil::isPropertyExists($equipment, $wuqiId), ErrCode::store_weapon_err); # 玩家拥有此英雄
  1003. // my_Assert($equipment->$wuqiId->herouid == 0, ErrCode::store_WeaponCanotConsume); # 该言灵已经被装备不能在消耗
  1004. // $mo = GameConfig::item_weapon_getItem($equipment->$wuqiId->typeId);
  1005. // $baseExp = $mo->baseExp;
  1006. // //$needExp = GameConfig::weapon_levelexp_getItem(GameConfig::item_base_getItem($equipment->$wuqiId->typeId)->quality,$equipment->$wuqiId->level)->needExp;
  1007. // $wuqiExp += $baseExp + $equipment->$wuqiId->exp * 0.75;
  1008. // $totalGold += $mo->costGold;
  1009. // StlUtil::dictRemove($user->store->equipment, $wuqiId);
  1010. // }
  1011. // my_Assert($user->baseInfo->gold >= $totalGold, ErrCode::notenough_gold_msg);
  1012. //
  1013. // $equipVo = new Ins_Weapon($equipment->$uid);
  1014. // $initLevel = $equipVo->level;
  1015. //
  1016. // $equipVo->exp += $total + (int) $wuqiExp;
  1017. // $curlevel = self::Upgrade($equipVo->exp, GameConfig::item_base_getItem($equipVo->typeId)->quality, Enum_UpgradeType::Wuqi);
  1018. // $curStar = $equipVo->starLevel; #当前星级
  1019. // $equipVo->level = $curlevel;
  1020. //
  1021. // $num = 0;
  1022. // $dic = GameConfig::weaponextra_level();
  1023. // foreach ($dic as $tId => $val) {
  1024. // if ($tId == $equipVo->typeId) {
  1025. // foreach ($val as $k => $v) {
  1026. // $num += 1;
  1027. // }
  1028. // break;
  1029. // }
  1030. // }
  1031. // if ($curStar < $num - 1) {
  1032. // $starlimitLv = GameConfig::weaponextra_level_getItem($equipVo->typeId, $curStar + 1)->starlimitLv;
  1033. // if ($starlimitLv <= $curlevel) {
  1034. // $equipVo->level = $starlimitLv;
  1035. // $equipVo->exp = GameConfig::weapon_levelexp_getItem(GameConfig::item_base_getItem($equipVo->typeId)->quality, $starlimitLv)->requiredExp;
  1036. // }
  1037. // }
  1038. //
  1039. // $user->store->equipment->$uid = $equipVo;
  1040. //
  1041. // TaskProc::OnWeaponLevelUp($equipVo->typeId, $equipVo->level);
  1042. // UserProc::CollectUserBaseParam(req()->cmd, 2, $user->baseInfo->gold, $totalGold, $user->baseInfo->gold - $totalGold, "");
  1043. // $user->baseInfo->gold -= $totalGold;
  1044. // ctx($user);
  1045. // ctx()->store->items = $myPacketItems; # 更新背包数据
  1046. // if ($equipVo->level != $initLevel) {
  1047. // NormalEventProc::OnWeaponLvlUp($uid, $equipVo->level); # 广播英雄升级事件
  1048. // StatisticsProc::TargetStatistics(Enum_TargetStatistics::WeaponIdLevel_UserNum, $equipVo->typeId, "$equipVo->level", $initLevel);
  1049. // }
  1050. //
  1051. // UserProc::updateUserInfo(); # 回写玩家数据
  1052. // return Resp::ok(array(
  1053. // "store" => $user->store, # # 目前来看只涉及到items变化
  1054. // 'gold' => $user->baseInfo->gold,
  1055. // ));
  1056. // }
  1057. //
  1058. // /**
  1059. // * 武器升级计算
  1060. // * @param type $xp
  1061. // * @param type $type
  1062. // * @return type
  1063. // */
  1064. // static function Upgrade($xp, $qual, $type) {
  1065. // $curLv = 0;
  1066. // if ($type == Enum_UpgradeType::Wuqi) {
  1067. // $heroLvDic = GameConfig::weapon_levelexp()->$qual;
  1068. // } else {
  1069. // $heroLvDic = GameConfig::yanlingLevel_type()->$qual;
  1070. // }
  1071. //
  1072. // $f = (array) $heroLvDic;
  1073. // ksort($f);
  1074. // foreach ($f as $lv => $mo) {
  1075. // if ($xp < $mo->requiredExp) {
  1076. // $curLv = $lv - 1;
  1077. // break;
  1078. // }
  1079. //
  1080. //// if($lv>=glc()->Weapon_Upgrade_BasicMaxLevel){
  1081. //// $curLv = glc()->Weapon_Upgrade_BasicMaxLevel;
  1082. //// break;
  1083. //// }
  1084. // }
  1085. //
  1086. // return $curLv;
  1087. // }
  1088. //
  1089. // /**
  1090. // * 武器突破
  1091. // */
  1092. // static function weaponTupo() {
  1093. // list($uid) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
  1094. // $user = ctx();
  1095. // $equipment = $user->store->equipment;
  1096. // my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
  1097. //
  1098. // $typeId = $equipment->$uid->typeId;
  1099. // $curStar = $equipment->$uid->starLevel;
  1100. //
  1101. // $num = 0;
  1102. // $dic = GameConfig::weaponextra_level();
  1103. // foreach ($dic as $tId => $val) {
  1104. // if ($tId == $typeId) {
  1105. // foreach ($val as $k => $v) {
  1106. // $num += 1;
  1107. // }
  1108. // break;
  1109. // }
  1110. // }
  1111. // my_Assert($curStar < $num - 1, ErrCode::hero_yanling_canotTupo);
  1112. //
  1113. // $mo = GameConfig::weaponextra_level_getItem($typeId, $curStar + 1);
  1114. // my_Assert($mo != null, ErrCode::err_const_no);
  1115. //
  1116. // my_Assert($equipment->$uid->level >= $mo->starlimitLv, ErrCode::hero_yanling_canotTupo);
  1117. // my_Assert($user->baseInfo->level >= $mo->userlvLimit, ErrCode::hero_yanling_canotTupo);
  1118. // my_Assert($user->baseInfo->gold >= $mo->gold, ErrCode::notenough_gold_msg);
  1119. //// $segID = $mo->segID;
  1120. //// my_Assert(StlUtil::dictHasProperty($user->store->items,$segID) , ErrCode::store_itemnotenough);
  1121. //// my_Assert($user->store->items->$segID>=$mo->segNum , ErrCode::store_itemnotenough);
  1122. //
  1123. // $costItemsList = explode(';', $mo->costItems);
  1124. // foreach ($costItemsList as $value) {
  1125. // $list = explode(',', $value);
  1126. // StoreProc::removeItemFromStore($user->store, $list[0], $list[1]);
  1127. // }
  1128. //
  1129. // UserProc::CollectUserBaseParam(req()->cmd, 2, $user->baseInfo->gold, $mo->gold, $user->baseInfo->gold - $mo->gold, "");
  1130. // $user->baseInfo->gold -= $mo->gold;
  1131. // $equipment->$uid->starLevel += 1;
  1132. //
  1133. // NormalEventProc::OnWeaponLvTuPo($uid, $equipment->$uid->starLevel); # 广播英雄升级事件
  1134. // TaskProc::OnWeaponStarUp($equipment->$uid->starLevel);
  1135. //
  1136. // $user->store->equipment = $equipment;
  1137. // ctx($user);
  1138. //
  1139. // UserProc::updateUserInfo(); # 回写玩家数据
  1140. // return Resp::ok(array(
  1141. // "store" => $user->store, # # 目前来看只涉及到items变化
  1142. // 'gold' => $user->baseInfo->gold,
  1143. // ));
  1144. // }
  1145. //
  1146. // /**
  1147. // * 武器替换
  1148. // * @return type
  1149. // */
  1150. // static function weaponReplace() {
  1151. // list($uid, $replaceId) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
  1152. // $user = ctx();
  1153. // $equipment = $user->store->equipment;
  1154. // my_Assert(property_exists($equipment, $uid), "找不到这个言灵");
  1155. // my_Assert(property_exists($equipment, $replaceId), "找不到这个言灵");
  1156. //
  1157. // $herouid = $equipment->$uid->herouid;
  1158. // $herouid_replace = $equipment->$replaceId->herouid;
  1159. // $equipment->$replaceId->herouid = $herouid;
  1160. // $equipment->$uid->herouid = $herouid_replace;
  1161. // $user->store->equipment = $equipment;
  1162. // ctx($user);
  1163. //
  1164. // UserProc::updateUserInfo(); # 回写玩家数据
  1165. // return Resp::ok(array(
  1166. // "store" => $user->store, # # 目前来看只涉及到items变化
  1167. // ));
  1168. // }
  1169. //
  1170. // /**
  1171. // * [6420] 言灵进阶
  1172. // */
  1173. // static function YanlingUpgrade() {
  1174. // list($yanlingUid) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
  1175. // $user = ctx();
  1176. // my_Assert(property_exists($user->store->yanling, $yanlingUid), "找不到这个言灵");
  1177. // $yanlingObj = $user->store->yanling->$yanlingUid;
  1178. // $yanlingMoId = $yanlingObj->typeId;
  1179. // $curGrade = property_exists($yanlingObj, "grade") ? $yanlingObj->grade : 1; # 当前等阶
  1180. // $toGrade = $curGrade + 1; # 下一等阶
  1181. // my_Assert($toGrade <= 5, ErrCode::store_yanlingGrade_max); # 已经进阶到最高
  1182. // $toGradeCfg = GameConfig::yanling_upgrade_getItem($yanlingMoId, $toGrade); # 下一阶配置
  1183. // my_Assert(null != $toGradeCfg, ErrCode::err_const_no); # 找不到言灵进阶常量
  1184. // $costs = explode(';', $toGradeCfg->cost_materials);
  1185. // my_Assert(count($costs) > 0, ErrCode::store_yanlingGrade_cfg); # 言灵进阶数据有误
  1186. // foreach ($costs as $c) {
  1187. // list($itemId, $num) = explode(',', $c); # 解析材料
  1188. // $err = self::removeItemFromStore($user->store, $itemId, $num); # 扣除 材料
  1189. // my_Assert(ErrCode::ok == $err, $err); # 防御扣除材料失败
  1190. // }
  1191. // $yanlingObj->grade = $toGrade; # 修改进阶
  1192. // $user->store->yanling->$yanlingUid = $yanlingObj; # 回写言灵数据
  1193. // UserProc::updateUserInfo(); # 回写玩家数据
  1194. // return Resp::ok(array(
  1195. // "store" => $user->store, # # 目前来看只涉及到items变化
  1196. // ));
  1197. // }
  1198. //
  1199. // /**
  1200. // * [6418] 利用言灵召唤书碎片合成召唤书
  1201. // */
  1202. // static function MergeYanlingBook() {
  1203. // list($bookId) = req()->paras; # 参数 言灵召唤书id
  1204. // $user = ctx();
  1205. // $bookIdCfg = GameConfig::item_yanlingbook_getItem($bookId);
  1206. // my_Assert(null != $bookIdCfg, ErrCode::err_const_no); # 找不到言灵书常量
  1207. // list($segId, $num) = explode(',', $bookIdCfg->seg_num); # 解析所需碎片信息
  1208. // $err = self::removeItemFromStore($user->store, $segId, $num); # 扣除 碎片
  1209. // my_Assert(ErrCode::ok == $err, $err); # 防御扣除碎片失败
  1210. // self::PutOverlyingItemInStore($bookId); # 添加召唤书
  1211. // UserProc::updateUserInfo(); # 回写数据
  1212. // return Resp::ok(array(
  1213. // "store" => $user->store, # # 目前来看只涉及到items变化
  1214. // ));
  1215. // }
  1216. //
  1217. // /**
  1218. // * [6419] 利用言灵召唤书召唤言灵
  1219. // */
  1220. // static function CallYanlingByBook() {
  1221. // list($bookId) = req()->paras; # 参数 利用的言灵召唤书id
  1222. // $user = ctx();
  1223. // $bookIdCfg = GameConfig::item_yanlingbook_getItem($bookId);
  1224. // my_Assert(null != $bookIdCfg, ErrCode::err_const_no); # 找不到言灵书常量
  1225. // $err = self::removeItemFromStore($user->store, $bookId); # 扣除 召唤书
  1226. // my_Assert(ErrCode::ok == $err, $err); # 防御扣除召唤书失败
  1227. // $costs = explode(';', $bookIdCfg->cost_materials);
  1228. // my_Assert(count($costs) > 0, ErrCode::store_book_info); # 召唤书数据有误
  1229. // foreach ($costs as $c) {
  1230. // list($itemId, $num) = explode(',', $c); # 解析材料
  1231. // $err = self::removeItemFromStore($user->store, $itemId, $num); # 扣除 材料
  1232. // my_Assert(ErrCode::ok == $err, $err); # 防御扣除材料失败
  1233. // }
  1234. // self::PutYanLingInStore($bookIdCfg->yanling_id); # 添加言灵
  1235. // UserProc::updateUserInfo(); # 回写数据
  1236. // return Resp::ok(array(
  1237. // "store" => $user->store, # # 目前来看只涉及到items变化
  1238. // ));
  1239. // }
  1240. //
  1241. // /**
  1242. // * 测试方法
  1243. // * @return type
  1244. // */
  1245. // static public function Test() {
  1246. // Err(ErrCode::msg_method_obsoleted, "代码需更新");
  1247. // }
  1248. //
  1249. // /**
  1250. // * [6404] 使用仓库道具
  1251. // */
  1252. // static function useItem() {
  1253. // list($itemType, $num) = req()->paras; # 提取参数
  1254. // $mo = GameConfig::item_base_getItem($itemType);
  1255. // my_Assert(null != $mo, ErrCode::err_const_no);
  1256. // $store = ctx()->store();
  1257. // $err = $store->RemoveItemFromStore($itemType, $num); # 扣除道具
  1258. // my_Assert(ErrCode::ok == $err, $err);
  1259. // switch ($mo->subType) {
  1260. // case 601: # 任务卡
  1261. // my_Assert($num == 1, "任务卡一次只能使用一张!");
  1262. // StoreProc::PutTaskCardInStore($itemType); # 任务卡放入任务卡
  1263. // ctx()->store = $store;
  1264. // break;
  1265. // case 303: # 体力药水
  1266. // $pillMo = GameConfig::item_pills_getItem($itemType);
  1267. // ctx()->base()->Add_tili($pillMo->number * $num); # 加体力
  1268. // break;
  1269. // default :
  1270. // break;
  1271. // }
  1272. // UserProc::updateUserInfo();
  1273. // return Resp::ok(array(
  1274. // 'priv' => ctx()->privateState,
  1275. // 'store' => ctx()->store,
  1276. // 'tili' => ctx()->base()->tili,
  1277. // ));
  1278. //
  1279. //// Err(ErrCode::msg_method_obsoleted, "代码需更新");
  1280. // }
  1281. //
  1282. // /**
  1283. // * [6405] 刷新仓库列表
  1284. // */
  1285. // static function refreshStore() {
  1286. // StoreProc::CheckItemNum();
  1287. // return Resp::ok(array('store' => ctx()->store));
  1288. // }
  1289. //
  1290. // /**
  1291. // * [6406] 从仓库删除道具
  1292. // */
  1293. // static function delItemFromStore() {
  1294. // list($itemId, $num) = req()->paras;
  1295. // $err = self::removeItemFromStore(ctx()->store, $itemId, $num);
  1296. // my_Assert(ErrCode::ok == $err, $err);
  1297. // UserProc::updateUserInfo();
  1298. // return Resp::ok(array('store' => ctx()->store));
  1299. // }
  1300. //
  1301. // /**
  1302. // * [6409] 合成道具
  1303. // */
  1304. // static public function composeItem() {
  1305. // Err(ErrCode::err_method_notimplement);
  1306. // }
  1307. //
  1308. // /**
  1309. // * [6409] 合成碎片(几个碎片合成获得同品质或者更高品质的新碎片)
  1310. // */
  1311. // static public function composePieces() {
  1312. // Err(ErrCode::err_method_notimplement);
  1313. // }
  1314. //
  1315. //// </editor-fold>
  1316. //// --------------- 以下为辅助方法 ------------------
  1317. ////
  1318. //// <editor-fold defaultstate="collapsed" desc=" 移除物品 ">
  1319. //
  1320. // /**
  1321. // * 从仓库中移除指定数量的物品
  1322. // * @param Info_Store $store
  1323. // * @param type $itemId
  1324. // * @param type $itemcount
  1325. // * @return type
  1326. // */
  1327. // static function removeItemFromStore($store, $itemId, $itemcount = 1) {
  1328. // my_Assert(CommUtil::isPropertyExists($store->items, $itemId), ErrCode::store_itemno_err); # 没有这个道具
  1329. // my_Assert($store->items->$itemId >= $itemcount, ErrCode::store_itemnotenough); # 数量不足
  1330. // $store->items->$itemId -= $itemcount;
  1331. // if ($store->items->$itemId == 0) {
  1332. // unset($store->items->$itemId);
  1333. // if (in_array($itemId, ctx()->store->itemRecord)) {
  1334. // StlUtil::arrayRemove(ctx()->store->itemRecord, $itemId);
  1335. // }
  1336. // }
  1337. //
  1338. // if (GameConfig::item_base_getItem($itemId)->subType == 341 || GameConfig::item_base_getItem($itemId)->subType == 342) {//血瓶/蓝瓶
  1339. // foreach (ctx()->store->battleItem as $index => $val) {
  1340. // if ($val->id == $itemId) {
  1341. // if (!isset($store->items->$itemId) || $store->items->$itemId == 0) {
  1342. // unset(ctx()->store->battleItem->$index);
  1343. // } else {
  1344. // ctx()->store->battleItem->$index->num = $store->items->$itemId;
  1345. // }
  1346. // }
  1347. // }
  1348. // }
  1349. //
  1350. // NormalEventProc::OnBag_Remove_Item($itemId, $itemcount); # 插入事件
  1351. // return ErrCode::ok;
  1352. // }
  1353. //
  1354. // /**
  1355. // * 从仓库移出装备
  1356. // * @param type $itemId uid
  1357. // * @param Info_Store $store
  1358. // * @return boolean
  1359. // */
  1360. // static function removeEquipFromStore($uid, $typeId) {
  1361. // $ok = false;
  1362. // if (CommUtil::isPropertyExists(ctx()->store->equipment, $uid)) {
  1363. // my_Assert($typeId == ctx()->store->equipment->$uid->typeId, "typeid检验错误"); // typeid相同;
  1364. // my_Assert(ctx()->store->equipment->$uid->herouid == 0, "该武器被装备无法删除"); // typeid相同;
  1365. // unset(ctx()->store->equipment->$uid);
  1366. // if (in_array($uid, ctx()->store->weaponRecord)) {
  1367. // StlUtil::arrayRemove(ctx()->store->weaponRecord, $uid);
  1368. // }
  1369. //
  1370. //
  1371. // $ok = true;
  1372. // }
  1373. // return $ok;
  1374. // }
  1375. //
  1376. // static function removeYanlingFromStore($uid, $typeId) {
  1377. // $ok = false;
  1378. // if (CommUtil::isPropertyExists(ctx()->store->yanling, $uid)) {
  1379. // my_Assert($typeId == ctx()->store->yanling->$uid->typeId, "typeid检验错误"); // typeid相同;
  1380. // unset(ctx()->store->yanling->$uid);
  1381. //
  1382. // if (in_array($uid, ctx()->store->yanlingRecord)) {
  1383. // StlUtil::arrayRemove(ctx()->store->yanlingRecord, $uid);
  1384. // }
  1385. // $ok = true;
  1386. // }
  1387. // return $ok;
  1388. // }
  1389. //
  1390. // /**
  1391. // * 从仓库移除碎片
  1392. // * @param Info_Store $store
  1393. // * @param int $segmentId
  1394. // * @param int $num
  1395. // * @return bool 成功/失败
  1396. // */
  1397. // static function removeSegmetFromStore($store, $segmentId, $num = 1) {
  1398. // if (CommUtil::isPropertyExists($store->segement, $segmentId) #
  1399. // && $store->segement->$segmentId >= $num) {
  1400. // $store->segement->$segmentId -= $num;
  1401. // return TRUE;
  1402. // }
  1403. // return false;
  1404. // }
  1405. //
  1406. // /**
  1407. // * 向仓库添加碎片
  1408. // * @param Info_Store $store
  1409. // * @param int $segmentId
  1410. // * @param int $num
  1411. // */
  1412. // static function addSegmentIntoStore($store, $segmentId, $num = 1) {
  1413. // if (CommUtil::isPropertyExists($store->segement, $segmentId)) {
  1414. // $store->segement->$segmentId += $num;
  1415. // } else {
  1416. // $store->segement->$segmentId = $num;
  1417. // }
  1418. // $segMo = GameConfig::item_segment_getItem($segmentId);
  1419. // my_Assert($segMo != null, ErrCode::err_const_no);
  1420. // TaskProc::OnHeroSegmengNum($segMo->protoHeroID, $num);
  1421. // }
  1422. //
  1423. //// </editor-fold>
  1424. ////
  1425. //// <editor-fold defaultstate="collapsed" desc=" 放入物品 ">
  1426. //
  1427. // /**
  1428. // * 将其他物品放入仓库
  1429. // * @param type $itemId
  1430. // * @param Data_UserGame $game
  1431. // */
  1432. // static function PutItemInStore($itemId, &$game) {
  1433. // if (CommUtil::isPropertyExists($game->store->items, $itemId)) { // 如果仓库中已经有这种元素,则其数目+1
  1434. // $game->store->items->$itemId += 1;
  1435. // } else {// 如果仓库中没有这种元素,则其数目置1
  1436. // $game->store->items->$itemId = 1;
  1437. // }
  1438. // }
  1439. //
  1440. // /**
  1441. // * 解包多种物品到玩家身上 【警告】此函数的异常处理功能残废,不安全
  1442. // * 检测如果当前物品格子大于物品总数,则可以获取战利品,否则不可以
  1443. // * @param string $goodsStr itemid,num;itemid,num;...
  1444. // * @param int $src 1:战斗奖励, 2: 任务奖励, 3: 抽奖奖品, 4: 邮件领取, 5: 现金充值, 6: 活动领取
  1445. // * @deprecated since version 0
  1446. // * @return type
  1447. // */
  1448. // public static function AddMultiItemInStore($goodsStr, $src = 1, $mask = 0) {
  1449. // $user = ctx();
  1450. // $ary = explode(";", $goodsStr);
  1451. // //$unlockNum = $user->privateState->expandNum * 5;
  1452. // //$n = self::countStoreNum();
  1453. // foreach ($ary as $value) {
  1454. // $val = explode(",", $value);
  1455. // $cid = "";
  1456. // my_Assert(count($val) > 1, "解析奖励字符串出错");
  1457. //
  1458. // list( $itemId, $num) = $val; # ID, 数量
  1459. // $smItem = GameConfig::item_base_getItem($itemId); # 道具mo
  1460. // switch ($smItem->subType) { # 根据类型分别添加到容器中
  1461. // case META_EXP: # 指挥官经验
  1462. //// Data_UserGame::Add_Exp($user->baseInfo, $num);
  1463. // $user->base()->Add_Exp($num); # 加指挥官经验
  1464. // break;
  1465. // case META_GOLD_ITEMID: # 金币
  1466. //// Data_UserGame::Add_Gold($user->baseInfo, $num);
  1467. // $user->base()->Add_Gold($num, $mask); # 增加金币
  1468. // break;
  1469. // case META_CASH_ITEMID: # 钻石
  1470. //// Data_UserGame::Add_Cash($user->baseInfo, $num);
  1471. // $user->base()->Add_Cash($num, $mask); # 增加钻石
  1472. // break;
  1473. // case META_tili_ITEMID: # 体力
  1474. //// Data_UserGame::Add_tili($num);
  1475. // $user->base()->Add_tili($num); # 增加体力
  1476. // break;
  1477. // case META_FriendShipPoit_ItemId: # 友情值
  1478. //// Data_UserGame::Add_FriendPoint($user->baseInfo, $num);
  1479. // $user->base()->Add_FriendPoint($num); # 加友情点
  1480. // break;
  1481. // case META_PVPCOIN_ITEMID: # 竞技币
  1482. // $user->pvp->pvpCoins += $num;
  1483. // break;
  1484. // case META_ActivePoint_ITEMID:
  1485. //// $user->task->dailyActivePoint += $num; # 每日任务活跃点
  1486. // break;
  1487. // case META_RESPOINT_ITEMID:
  1488. // $user->base()->Add_resPoint($num); # 增加资源点
  1489. //// Data_UserGame::Add_resPoint($user->baseInfo, $num); # 资源点添加
  1490. // break;
  1491. // case 101: # 武器
  1492. // for ($n = 0; $n < $num; $n++) {
  1493. // $cid = StoreProc::PutEquipInStore($itemId);
  1494. // }
  1495. // CornerSignEventProc::OnBag_new_Weapon();
  1496. // CornerSignEventProc::OnRoleWeapon();
  1497. // break;
  1498. // case 401: # 言灵
  1499. // for ($n = 0; $n < $num; $n++) {
  1500. // $cid = StoreProc::PutYanLingInStore($itemId);
  1501. // }
  1502. // CornerSignEventProc::OnBag_new_Yanling();
  1503. // CornerSignEventProc::OnRoleYanling();
  1504. // break;
  1505. // case 501: # 限购礼包
  1506. // $itemMO = GameConfig::item_package_getItem($itemId);
  1507. // my_Assert(null != $itemMO, ErrCode::err_const_no);
  1508. // $err = StoreProc::AddMultiItemInStore($itemMO->contents); # 发放奖励
  1509. // my_Assert(ErrCode::ok == $err, $err);
  1510. // break;
  1511. // case 601: # 任务卡
  1512. // $cid = StoreProc::PutTaskCardInStore($itemId);
  1513. // CornerSignEventProc::OnBag_new_TaskCard();
  1514. // break;
  1515. // case 201: # 碎片
  1516. // $segMo = GameConfig::item_segment_getItem($itemId);
  1517. // my_Assert($segMo != null, ErrCode::err_const_no);
  1518. // TaskProc::OnHeroSegmengNum($segMo->protoHeroID, $num);
  1519. // CornerSignEventProc::OnBag_new_Fragment();
  1520. // StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
  1521. // break;
  1522. // case 202: # 召唤书碎片
  1523. // case 351: # 言灵召唤书
  1524. // StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
  1525. //// $book = GameConfig::item_yanlingbook_getItem($itemId);
  1526. //// my_Assert(null != $book, ErrCode::err_const_no);
  1527. //// $ylCfg = GameConfig::item_yanling_getItem($book->yanling_id);
  1528. //// my_Assert(null != $ylCfg, ErrCode::err_const_no);
  1529. //// switch ($ylCfg->career) { # 根据不同职业更新角标系统
  1530. //// case 1:
  1531. //// CornerSignEventProc::OnCall_Warrior_new(); # 战士
  1532. //// break;
  1533. //// case 2:
  1534. //// CornerSignEventProc::OnCall_Magician_new(); # 法师
  1535. //// break;
  1536. //// case 3:
  1537. //// CornerSignEventProc::OnCall_Archer_new(); # 射手
  1538. //// break;
  1539. //// default :
  1540. //// break;
  1541. //// }
  1542. // break;
  1543. // case 321: # 进阶材料
  1544. // case 322: # 进阶材料
  1545. // case 323: # 锻造材料
  1546. // case 324: # 魂器
  1547. //
  1548. // case 325: #元素突破材料
  1549. // case 326: #职业突破材料
  1550. // case 327: #言灵的突破石
  1551. // case 328: #言灵的突破材料
  1552. // case 329: #武器的突破石
  1553. // case 330: #武器的突破材料
  1554. // //
  1555. // case 701: #宝石
  1556. // case 702: #设计图纸
  1557. // case 703: #宝石辅助材料
  1558. // StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
  1559. // CornerSignEventProc::OnBag_new_Material();
  1560. // break;
  1561. //
  1562. // case 332: #普通祈愿券
  1563. // case 333: #活动祈愿券
  1564. // // 补给品
  1565. // case 341: # 血瓶
  1566. // case 342: # 能量瓶
  1567. // case 343: #
  1568. // case 344: # 回城券 -2022.4.13 海哥
  1569. // case 303: # 体力药水 - 2023.3.15 海哥
  1570. // StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
  1571. // CornerSignEventProc::OnBag_new_Consume();
  1572. // break;
  1573. // case 311: # 基因(经验丹)
  1574. // case 312: # 强化道具
  1575. // case 313:
  1576. // StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
  1577. // break;
  1578. // case 801:
  1579. // case 802:
  1580. // //头像款,不入背包。直接解锁
  1581. // self::HeadImgFrameUnLock($itemId, $num);
  1582. // break;
  1583. //
  1584. // default :
  1585. // Err(ErrCode::err_innerfault, "落入包裹时,出现了非法物品($itemId)");
  1586. // }
  1587. // TaskProc::OnGainItem($itemId, $num); // 检查获得道具的任务进度
  1588. // NormalEventProc::OnBag_new_Item($itemId, $num, $cid);
  1589. // }
  1590. // return ErrCode::ok; // 返回
  1591. // }
  1592. //
  1593. // public static function HeadImgFrameUnLock($itemId, $num) {
  1594. // if(!StlUtil::dictHasProperty(ctx()->baseInfo,'headImgFrameList')){
  1595. // ctx()->base(true)->headImgFrameList = array();
  1596. // }
  1597. // $list = ctx()->base(true)->headImgFrameList;
  1598. // if(!in_array($itemId,$list)){
  1599. // $list[] = $itemId;
  1600. // }
  1601. // ctx()->base(true)->headImgFrameList = $list;
  1602. // }
  1603. //
  1604. // public static function countStoreNum() {
  1605. // $user = ctx();
  1606. // //$num = 0;
  1607. // $itemDic = $user->store->items;
  1608. // //$num += count((array)$user->store->items);
  1609. // $itemNum = 0;
  1610. // foreach ($itemDic as $key => $num) {
  1611. // if ($num == 0) {
  1612. // continue;
  1613. // }
  1614. //
  1615. // if ($num > 99999) {
  1616. // $itemNum += 2;
  1617. // } else {
  1618. // $itemNum += 1;
  1619. // }
  1620. // }
  1621. //
  1622. // //var_dump($num);
  1623. // //var_dump('-----------------');
  1624. //
  1625. // $itemNum += count((array) $user->store->equipment);
  1626. // //var_dump($num);
  1627. // //var_dump('-----------------');
  1628. // $itemNum += count((array) $user->store->yanling);
  1629. // //var_dump($itemNum);
  1630. // return $itemNum;
  1631. // }
  1632. //
  1633. // /**
  1634. // * [6401]向包裹中添加物品
  1635. // */
  1636. // public static function AddItemInStore() {
  1637. // list($rwdStr, $mask) = req()->paras; //mask = 1:表示战斗中掉落
  1638. // $user = ctx();
  1639. //
  1640. // if ($mask == 1) {
  1641. // $err = self::AddMultiItemInStore($rwdStr, 1, 1);
  1642. // } else {
  1643. // $err = self::AddMultiItemInStore($rwdStr);
  1644. // }
  1645. //
  1646. // my_Assert(ErrCode::ok == $err, $err);
  1647. // UserProc::updateUserInfo();
  1648. // return Resp::ok(array(
  1649. // 'gold' => $user->baseInfo->gold,
  1650. // 'tili' => $user->baseInfo->tili,
  1651. // 'cash' => $user->baseInfo->cash,
  1652. // 'resPoint' => $user->baseInfo->resPoint,
  1653. // 'store' => $user->store));
  1654. // }
  1655. //
  1656. // /**
  1657. // * 将装备放入背包
  1658. // * @param type $itemId
  1659. // */
  1660. // static function PutEquipInStore($itemId) {
  1661. // $privateState = ctx()->privateState;
  1662. // $unlockNum = $privateState->expandNum * 5;
  1663. // //var_dump("wuqi==============");
  1664. // $n = self::countStoreNum();
  1665. // $initNum = GameConfig::globalsettings()->Item_Packet_InitNum_New;
  1666. // my_Assert($n < $unlockNum + $initNum, ErrCode::store_bagSpaceNotEnough);
  1667. //
  1668. // if (!CommUtil::isPropertyExists($privateState, "currentId")) { // 如果仓库中已经有这种元素,则其数目+1
  1669. // ctx()->privateState->currentId = 1;
  1670. // }
  1671. // $cid = ctx()->privateState->currentId++;
  1672. // //$equip = ObjectInit();
  1673. // $equip = new Ins_Weapon();
  1674. // $equip->typeId = $itemId;
  1675. // ctx()->store->equipment->$cid = $equip;
  1676. //
  1677. // ctx()->store->weaponRecord[] = $cid;
  1678. //
  1679. // SystemProc::GetSpecialQualityWeapon(req()->zoneid, ctx()->baseInfo->name, $itemId);
  1680. // //StatisticsProc::TargetStatistics(Enum_TargetStatistics::WeaponId_UserNum, $itemId);
  1681. // //StatisticsProc::TargetStatistics(Enum_TargetStatistics::WeaponIdLevel_UserNum, $itemId, "1");
  1682. // return $cid;
  1683. //// SystemProc::GetEquip($req->zoneid, $req->userInfo->game, $itemId); # 添加获得装备的消息
  1684. // }
  1685. //
  1686. // /**
  1687. // * 将言灵放入背包
  1688. // * @param type $itemId
  1689. // */
  1690. // static function PutYanLingInStore($itemId) {
  1691. // //my_Assert(count((array) ctx()->store->yanling) < 100, ErrCode::store_yanling_bagfull);
  1692. // $privateState = ctx()->privateState;
  1693. // $unlockNum = $privateState->expandNum * 5;
  1694. // //var_dump("yanling==============");
  1695. // $n = self::countStoreNum();
  1696. // $initNum = GameConfig::globalsettings()->Item_Packet_InitNum_New;
  1697. // my_Assert($n < $unlockNum + $initNum, ErrCode::store_bagSpaceNotEnough);
  1698. //
  1699. // if (!CommUtil::isPropertyExists($privateState, "currentId")) { # 如果仓库中已经有这种元素,则其数目+1
  1700. // ctx()->privateState->currentId = 1;
  1701. // }
  1702. // $cid = ctx()->privateState->currentId++;
  1703. // //$equip = ObjectInit();
  1704. // $equip = new Ins_YanLin();
  1705. // $equip->typeId = $itemId;
  1706. // $equip->quality = GameConfig::item_base_getItem($itemId)->quality; //品阶初始化
  1707. // ctx()->store->yanling->$cid = $equip;
  1708. //
  1709. // ctx()->store->yanlingRecord[] = $cid;
  1710. //
  1711. // TaskProc::autoRecoverStateMissions(); # 重新更新其它状态类的任务卡
  1712. // TaskProc::autoRecoverTaskTracingState(); # 更新任务追踪.
  1713. //
  1714. // SystemProc::GetSpecialQualityYanling(req()->zoneid, ctx()->baseInfo->name, $itemId);
  1715. // SystemProc::GetSpecialNumYanling(req()->zoneid, ctx()->baseInfo->name);
  1716. // StatisticsProc::TargetStatistics(Enum_TargetStatistics::YanLingId_UserNum, $itemId);
  1717. // StatisticsProc::TargetStatistics(Enum_TargetStatistics::YanLingIdLevel_UserNum, $itemId, "1");
  1718. // return $cid;
  1719. // }
  1720. //
  1721. // /**
  1722. // * 将任务卡放入背包
  1723. // * @param type $itemId
  1724. // */
  1725. // static function PutTaskCardInStore($itemId) {
  1726. // $privateState = ctx()->privateState;
  1727. // $unlockNum = $privateState->expandNum * 5;
  1728. // //var_dump("task==============");
  1729. // //$n = self::countStoreNum();
  1730. // //my_Assert($n<$unlockNum+50, ErrCode::store_StorageEnough);
  1731. //
  1732. // if (!CommUtil::isPropertyExists($privateState, "currentId")) { # 如果仓库中已经有这种元素,则其数目+1
  1733. // ctx()->privateState->currentId = 1;
  1734. // }
  1735. // $cid = ctx()->privateState->currentId++;
  1736. // $mo = GameConfig::item_taskcard_getItem($itemId); # 任务卡常量
  1737. //// var_dump($mo);
  1738. // my_Assert(null != $mo, ErrCode::err_const_no);
  1739. // $itembaseMo = GameConfig::item_base_getItem($itemId);
  1740. // my_Assert(null != $itembaseMo, ErrCode::err_const_no);
  1741. // if ($itembaseMo->pileNum > 0) { # 可叠加
  1742. // Err(ErrCode::taskCard_no_pile); # 不可堆叠!!! 我支持不了.gwang 2020年12月12日13:40:04
  1743. // // <editor-fold defaultstate="collapsed" desc=" 折叠 ">
  1744. //// $taskCard = null;
  1745. //// foreach ($req->userInfo->game->store->taskcards as $uuid => &$val) {
  1746. //// $val = new Ins_TaskCard($val);
  1747. //// if ($val->typeId == $itemId) {
  1748. //// $taskCard = $val;
  1749. //// break;
  1750. //// }
  1751. //// }
  1752. //// if (null == $taskCard) { # 原来么有
  1753. //// $taskCard = new Ins_TaskCard($itemId);
  1754. //// $taskCard->uid = $cid;
  1755. //// $req->userInfo->game->store->taskcards->$cid = $taskCard;
  1756. //// }
  1757. //// $taskCard->count += 1;
  1758. // // </editor-fold>
  1759. // } else {
  1760. // $taskCard = new Ins_TaskCard($itemId);
  1761. // $taskCard->uid = $cid;
  1762. // ctx()->store->taskcards->$cid = $taskCard;
  1763. // }
  1764. // NormalEventProc::OnTaskBag_new_Card($cid, 1); # 播放获得任务卡事件
  1765. // if (null != $taskCard) {
  1766. // $t = req()->paras;
  1767. // req()->paras = array($cid);
  1768. // TaskProc::OnTaskCard_active(); # 自动激活任务卡
  1769. // req()->paras = $t;
  1770. // }
  1771. // return $cid;
  1772. // }
  1773. //
  1774. // /**
  1775. // * 将可叠加物品放入背包
  1776. // * @param int $itemId
  1777. // * @param int $num
  1778. // */
  1779. // static function PutOverlyingItemInStore($itemId, $num = 1) {
  1780. // //var_dump("item==============".$itemId);
  1781. //
  1782. // $items = ctx()->store->items; # dic: itemid=>number
  1783. // if (CommUtil::isPropertyExists($items, $itemId)) { # 如果仓库中已经有这种元素,则其数目+=num
  1784. // $items->$itemId += $num;
  1785. // } else { # 如果仓库中没有这种元素,则其数目置为num
  1786. // $unlockNum = ctx()->privateState->expandNum * 5;
  1787. // $n = self::countStoreNum();
  1788. // $initNum = GameConfig::globalsettings()->Item_Packet_InitNum_New;
  1789. // my_Assert($n < $unlockNum + $initNum, ErrCode::store_bagSpaceNotEnough); # 没有的需要占用新的格子, 先判断下格子够不够用.
  1790. //
  1791. // $items->$itemId = $num;
  1792. // }
  1793. // if (!in_array($itemId, ctx()->store->itemRecord)) {
  1794. // ctx()->store->itemRecord[] = $itemId;
  1795. // }
  1796. //
  1797. // if (GameConfig::item_base_getItem($itemId)->subType == 341) {//血瓶
  1798. // foreach (ctx()->store->battleItem as $index => $val) {
  1799. // if ($val->id == $itemId) {
  1800. // ctx()->store->battleItem->$index->num = $items->$itemId;
  1801. // }
  1802. // }
  1803. // }
  1804. // }
  1805. //
  1806. // /**
  1807. // * 物品包裹打散成独立道具到仓库
  1808. // * @param GoodsItemModel $itemModel
  1809. // * @deprecated since version now
  1810. // */
  1811. // static function addSeprateItem($itemModel) {
  1812. // Err(ErrCode::err_method_obsoleted, "未更新包裹操作");
  1813. // }
  1814. //
  1815. // /**
  1816. // * [6416] 给英雄装上言灵
  1817. // */
  1818. // static function WearYanlingToHero() {
  1819. // $user = ctx(); # user引用
  1820. // list($itemtype, $yanling_uid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 英雄的UID
  1821. // my_Assert(CommUtil::isPropertyExists($user->store->yanling, $yanling_uid), ErrCode::store_itemno_err); # 检测是否存在该言灵
  1822. // $yanlingVo = new Ins_YanLin($user->store->yanling->$yanling_uid); # 取言灵对象
  1823. // if (isset($yanlingVo->herouid) && $yanlingVo->herouid > 0 #
  1824. // && $yanlingVo->herouid != $herouid) { # 检测该言灵是否装备到其他英雄身上
  1825. // Err(ErrCode::store_equipWeared_err);
  1826. // }
  1827. // $collectHeros = $user->heros->collectHeros; # 英雄集合
  1828. // my_Assert(null != $collectHeros, ErrCode::err_innerfault); # 防御对象为空
  1829. // my_Assert(CommUtil::isPropertyExists($collectHeros, $herouid), ErrCode::hero_no); # 检查英雄是否存在
  1830. //
  1831. // my_Assert($user->store->yanling->$yanling_uid->herouid == 0 || $user->store->yanling->$yanling_uid->herouid != $herouid, "该言灵不能重复装备");
  1832. // $hero = new Ins_UserHero($collectHeros->$herouid); # 取hero
  1833. // my_Assert($hero->level >= $yanlingVo->mo()->require_herolvl, "请提升唤灵师等级"); # 可装备的言灵等级受唤灵师等级限制.
  1834. // $user->store->yanling->$yanling_uid->herouid = $herouid; # 言灵上添加反向引用, 避免查询时的循环
  1835. // $oldYLid = $collectHeros->$herouid->yanling->$itemtype->itemuid; # 旧言灵id
  1836. // if ($oldYLid > 0) { # 代表替换操作
  1837. // $user->store->yanling->$oldYLid->herouid = 0; # 清理旧言灵的
  1838. // }
  1839. // $hero->yanling->$itemtype->itemuid = $yanling_uid; # 英雄身上添加言灵记录
  1840. // $collectHeros->$herouid = $hero;
  1841. // TaskProc::OnHeroWearYanling($collectHeros->$herouid->typeId, $user->store->yanling->$yanling_uid->typeId);
  1842. // UserProc::updateUserInfo(); # 5.回写数据
  1843. // $ret = array('resp' => "succeed!",
  1844. // 'store' => $user->store);
  1845. // $resp = Resp::ok($ret); // 返回
  1846. // HeroProc::CalcUserFightPower(req()->zoneid, req()->uid, $user); # 更新总战力榜
  1847. // return $resp;
  1848. // }
  1849. //
  1850. // /**
  1851. // * [6417] 给英雄卸下言灵
  1852. // * @deprecated since version 无法卸下,只能更换
  1853. // */
  1854. // static function UnWieldYanling() {
  1855. // $user = ctx(); # user引用
  1856. // list($itemtype, $yanling_uid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID
  1857. //
  1858. // $collectHeros = $user->heros->collectHeros;
  1859. // my_Assert(null != $collectHeros, ErrCode::err_innerfault); # 防御
  1860. // my_Assert(CommUtil::isPropertyExists($collectHeros, $herouid), ErrCode::hero_no); # 检测是否存在拥有该装备的英雄
  1861. // my_Assert(CommUtil::isPropertyExists($user->store->yanling, $yanling_uid), ErrCode::store_itemno_err); # 检测是否存在该装备
  1862. // if ($user->store->yanling->$yanling_uid->herouid == $herouid) { # 取装备对象
  1863. // $user->store->yanling->$yanling_uid->herouid = 0; # 清理反向引用
  1864. // }
  1865. //// $arr = $collectHeros->$herouid->yanling;
  1866. //// my_Assert(in_array($yanling_uid, $arr), ErrCode::hero_yanling_notfound); # 未装备此言灵
  1867. //// StlUtil::arrayRemove($arr, $yanling_uid);
  1868. //// $collectHeros->$herouid->yanling = $arr;
  1869. //
  1870. // my_Assert($collectHeros->$herouid->yanling->$itemtype->itemuid == $yanling_uid, ErrCode::store_noequip_err); # 防御
  1871. // $collectHeros->$herouid->yanling->$itemtype->itemuid = 0; # 卸下
  1872. //
  1873. // UserProc::updateUserInfo(); # 回写数据
  1874. // $resp = Resp::ok(array('resp' => "succeed!")); // 返回
  1875. //// StoreProc::CheckItemNum($req);
  1876. // return $resp;
  1877. // }
  1878. //
  1879. // /**
  1880. // * [6410] 给英雄穿装备
  1881. // */
  1882. // static function WearEquipToHero() {
  1883. // list($itemtype, $equipuid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 英雄的UID
  1884. // $user = ctx(); # user引用
  1885. // my_Assert(CommUtil::isPropertyExists($user->store->equipment, $equipuid), ErrCode::store_itemno_err); # 检测是否存在该装备
  1886. // $equipVo = new Ins_Weapon($user->store->equipment->$equipuid); # 取装备对象
  1887. // if ($equipVo->herouid > 0) { # 检测该装备是否装备到其他英雄身上
  1888. // my_Assert($equipVo->herouid == $herouid, ErrCode::store_equipWeared_err);
  1889. // $user->store->equipment->$equipuid->herouid = 0; # 清理原来已经装备的言灵的反指向
  1890. // }
  1891. // $collectHeros = $user->heros->collectHeros;
  1892. // my_default_Obj($collectHeros);
  1893. // my_Assert(CommUtil::isPropertyExists($collectHeros, $herouid), ErrCode::hero_no); # 检查是否存在需要装备的英雄
  1894. // $hero = new Ins_UserHero($collectHeros->$herouid); # 取hero
  1895. // my_Assert($hero->level >= $equipVo->mo()->require_herolvl, "请升级唤灵师."); # 检查武器要求的唤灵师等级, -gwang 2021.4.20
  1896. // $user->store->equipment->$equipuid->herouid = $herouid; # 装备上添加反向引用, 避免查询时的循环
  1897. // $oldEquipId = 0;
  1898. // switch ($itemtype) { # 添加或替换英雄该部位的装备
  1899. // case 1: # 武器
  1900. // $oldEquipId = $collectHeros->$herouid->equip->weapon->itemuid;
  1901. // $collectHeros->$herouid->equip->weapon->itemuid = $equipuid;
  1902. // break;
  1903. // case 2: # 防具
  1904. // $oldEquipId = $collectHeros->$herouid->equip->armor->itemuid;
  1905. // $collectHeros->$herouid->equip->armor->itemuid = $equipuid;
  1906. // break;
  1907. // case 3: # 饰品
  1908. // $oldEquipId = $collectHeros->$herouid->equip->ring->itemuid;
  1909. // $collectHeros->$herouid->equip->ring->itemuid = $equipuid;
  1910. // break;
  1911. // default :
  1912. // Err(ErrCode::store_equip_type);
  1913. // break;
  1914. // }
  1915. // if ($oldEquipId > 0 && $oldEquipId != $equipuid) {
  1916. // $user->store->equipment->$oldEquipId->herouid = 0;
  1917. // }
  1918. // UserProc::updateUserInfo(); // 5.回写数据
  1919. //// StoreProc::CheckItemNum($req);
  1920. // TaskProc::OnHeroWearWeapon($collectHeros->$herouid->typeId, $user->store->equipment->$equipuid->typeId);
  1921. // HeroProc::CalcUserFightPower(req()->zoneid, req()->uid, $user); # 更新总战力榜
  1922. // return Resp::ok(array('resp' => "succeed!",
  1923. // 'store' => $user->store)); // 返回
  1924. // }
  1925. //
  1926. // /**
  1927. // * [6411] 给英雄脱装备
  1928. // * @deprecated since version 不能卸下装备, 只能更换.
  1929. // */
  1930. // static function UnWieldEquip() {
  1931. // list($itemtype, $equipuid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID
  1932. // $user = ctx(); # user引用
  1933. //
  1934. // $collectHeros = $user->heros->collectHeros;
  1935. // my_default_Obj($collectHeros);
  1936. // my_Assert(CommUtil::isPropertyExists($collectHeros, $herouid), ErrCode::hero_no); # 检测是否存在拥有该装备的英雄
  1937. // my_Assert(CommUtil::isPropertyExists($user->store->equipment, $equipuid), ErrCode::store_itemno_err); # 检测是否存在该装备
  1938. // if ($user->store->equipment->$equipuid->herouid == $herouid) { # 取装备对象
  1939. // $user->store->equipment->$equipuid->herouid = 0;
  1940. // }
  1941. // switch ($itemtype) { # 检测该装备是否装备在该英雄身上
  1942. // case 1: # 武器
  1943. // if ($collectHeros->$herouid->equip->weapon->itemuid != $equipuid) {
  1944. // Err(ErrCode::store_noequip_err);
  1945. // }
  1946. // $collectHeros->$herouid->equip->weapon->itemuid = 0; # 卸下
  1947. // break;
  1948. // case 2: # 防具
  1949. // if ($collectHeros->$herouid->equip->armor->itemuid != $equipuid) {
  1950. // Err(ErrCode::store_noequip_err);
  1951. // }
  1952. // $collectHeros->$herouid->equip->armor->itemuid = 0;
  1953. // break;
  1954. // case 3: # 饰品
  1955. // if ($collectHeros->$herouid->equip->ring->itemuid != $equipuid) {
  1956. // Err(ErrCode::store_noequip_err);
  1957. // }
  1958. // $collectHeros->$herouid->equip->ring->itemuid = 0;
  1959. // break;
  1960. // default :
  1961. // Err(ErrCode::store_equip_type);
  1962. // }
  1963. // UserProc::updateUserInfo(); # 回写数据
  1964. // return Resp::ok(array('resp' => "succeed!")); // 返回
  1965. // }
  1966. //
  1967. //// </editor-fold>
  1968. ////
  1969. //// <editor-fold defaultstate="collapsed" desc=" 辅助方法 ">
  1970. ////
  1971. //
  1972. // /**
  1973. // * 检查背包中物品的个数
  1974. // * @return int
  1975. // */
  1976. // public static function CheckItemNum() {
  1977. // $ItemObj = ctx()->store->items;
  1978. // $EquipObj = ctx()->store->equipment;
  1979. // $SegementObj = ctx()->store->segement;
  1980. // $HeroObj = ctx()->heros->collectHeros;
  1981. // $ItemNum = 0;
  1982. // if ($ItemObj) {
  1983. // foreach ($ItemObj as $value) { ////检查宝石类可叠加物品的格子占用
  1984. // $ItemNum++;
  1985. // }
  1986. // }
  1987. // if ($SegementObj) {
  1988. // foreach ($SegementObj as $value) { # 碎片
  1989. // $ItemNum++;
  1990. // }
  1991. // }
  1992. // if ($EquipObj) {
  1993. // foreach ($EquipObj as $value) { // 检测装备类物品格子占用
  1994. // $ItemNum++;
  1995. // }
  1996. // }
  1997. // if ($HeroObj) {
  1998. // foreach ($HeroObj as $value) { // 检测英雄装备到身上的情况,装备到英雄身上不占格子,要减去.
  1999. // $HeroEquipId = $value->equip->weapon->itemuid;
  2000. // if ($HeroEquipId > 0) {
  2001. // $ItemNum--;
  2002. // }
  2003. // $HeroEquipId = $value->equip->armor->itemuid;
  2004. // if ($HeroEquipId > 0) {
  2005. // $ItemNum--;
  2006. // }
  2007. // $HeroEquipId = $value->equip->ring->itemuid;
  2008. // if ($HeroEquipId > 0) {
  2009. // $ItemNum--;
  2010. // }
  2011. // }
  2012. // }
  2013. // ctx()->privateState->ItemNum = $ItemNum;
  2014. // return $ItemNum;
  2015. // }
  2016. //
  2017. // /**
  2018. // * 获取物品格子的上限值---废弃了
  2019. // * @return int 上限数值
  2020. // */
  2021. //// public static function GetItemMaxNum() {
  2022. //// $user = ctx();
  2023. //// if (!CommUtil::isPropertyExists($user->privateState, "maxItemNum")) {
  2024. //// $user->privateState->maxItemNum = glc()->Item_Packet_MaxNum;
  2025. //// }
  2026. //// return $user->privateState->maxItemNum;
  2027. //// }
  2028. //
  2029. // /**
  2030. // * 6412 背包扩容
  2031. // */
  2032. // public static function AddPacketNum() {
  2033. // $user = ctx(); # user引用
  2034. // if (!CommUtil::isPropertyExists($user->privateState, "maxItemNum")) {
  2035. // $user->privateState->maxItemNum = glc()->Item_Packet_MaxNum;
  2036. // }
  2037. // $costCash = glc()->Item_Packet_NumCostCash; # 钻石花费
  2038. // my_Assert($costCash > 0, ErrCode::paras_err);
  2039. // my_Assert($user->base()->Consume_Cash($costCash), ErrCode::notenough_cash_msg); # 6.进行消耗
  2040. //
  2041. // $user->privateState->maxItemNum += 10; # 扩容
  2042. // UserProc::updateUserInfo(); # 保存玩家数据
  2043. // $resp = Resp::ok(array('maxItemNum' => $user->privateState->maxItemNum)); # 返回值
  2044. // StoreProc::CheckItemNum();
  2045. // return $resp;
  2046. // }
  2047. //
  2048. //// </editor-fold>
  2049. ////
  2050. //// <editor-fold defaultstate="collapsed" desc=" 出售 ">
  2051. ////
  2052. //
  2053. // /**
  2054. // * 出售单一的物品
  2055. // */
  2056. // static function sellItem() {
  2057. // Err(ErrCode::err_method_obsoleted, "代码需要更新");
  2058. // }
  2059. //
  2060. // /**
  2061. // * 卖出一堆物品时候,检测每个单个物品是否符合卖的条件
  2062. // */
  2063. // static function preSellSingleFromStore($type, $itemId, $count, $uid) {
  2064. // Err(ErrCode::err_method_obsoleted, "代码需要更新");
  2065. // }
  2066. //
  2067. // /**
  2068. // * 6403 从背包出售多个物品
  2069. // */
  2070. // static function sellMultiItemFromStore() {
  2071. // Err(ErrCode::err_method_obsoleted, "代码需要更新");
  2072. // $obj = req()->paras[0]; // 获取物品的结构数组
  2073. // foreach ($obj as $value) {
  2074. // $type = $value[0];
  2075. // $itemId = $value[1];
  2076. //
  2077. // if ($type > 3) {
  2078. // $count = intval($value[2]); // 数量
  2079. // $uid = 0;
  2080. // } else { ////先判断一下物品类型,如果是可叠加的,就按数量取值,如果是不可叠加的就按uid取值
  2081. // $count = 1;
  2082. // $uid = $value[2];
  2083. // }//物品的uid
  2084. // $resp = StoreProc:: preSellSingleFromStore($type, $itemId, $count, $uid);
  2085. // }
  2086. //
  2087. // if (0 == $resp->err) {
  2088. // UserProc::updateUserInfo();
  2089. // }
  2090. //
  2091. // StoreProc::CheckItemNum();
  2092. // return $resp;
  2093. // }
  2094. //
  2095. //// </editor-fold>
  2096. ////
  2097. //}