cmd) {
// case CmdCode::cmd_store_put: # 6401 放入仓库
// return StoreProc::AddItemInStore();
// case CmdCode::cmd_store_singleSell: # 6402 出售单个道具
// return StoreProc::sellItem();
// case CmdCode::cmd_store_mutliSell: # 6403 批量出售 卖掉
// return StoreProc::sellMultiItemFromStore();
// case CmdCode::cmd_store_use: # 6404 使用道具
// return StoreProc::useItem();
// case CmdCode::cmd_store_refresh: # 6405 获取最新的仓库数据
// return StoreProc::refreshStore();
// case CmdCode::cmd_store_delItem: # 6406 从仓库删除道具
// return StoreProc::delItemFromStore();
// case CmdCode::cmd_store_Testcmd: # 6407 测试方法
// return StoreProc::Test();
//// case CmdCode::cmd_store_ItemUpgrade: # 6408 装备升级
//// return StoreProc::ItemUpgrade($req);
//// case CmdCode::cmd_store_GemCompose: # 6408 装备合成
//// return StoreProc::composeItem($req);
////
// case CmdCode::cmd_store_WearEquip: # 6410 给英雄穿装备
// return StoreProc::WearEquipToHero();
// case CmdCode::cmd_store_UnWieldEquip: # 6411 将该装备从指定英雄上脱下
// return StoreProc::UnWieldEquip();
//
////
// case CmdCode::cmd_store_AddMaxPacketNum: # 6412 扩展包裹格子数量
// return StoreProc::AddPacketNum();
//// case CmdCode::cmd_store_MeltEquip: # 6413 装备融合
//// Err(ErrCode::err_method_obsoleted);
////// return StoreProc::MeltEquip($req);
//// case CmdCode::cmd_store_PiecesCompose: # 6415 碎片合成
//// return StoreProc::composePieces($req);
// case CmdCode::cmd_store_WearYanling: # 6416 装备言灵
// return StoreProc::WearYanlingToHero();
// case CmdCode::cmd_store_UnWieldYanling: # 6417 卸下言灵
// return StoreProc::UnWieldYanling();
// case CmdCode::cmd_store_mergeYanlingbook: # 6418 利用言灵召唤书碎片合成召唤书
// return self::MergeYanlingBook();
// case CmdCode::cmd_store_callyanling: # 6419 利用言灵召唤书召唤言灵
// return self::CallYanlingByBook();
// case CmdCode::cmd_store_yanling_upgrade: # 6420 言灵进阶
// return self::YanlingUpgrade();
// case CmdCode::cmd_store__weapon_upgrade: # 6421武器升级
// return self::weaponUpgrade();
// case CmdCode::cmd_store__weapon_tupo: # 6422武器突破
// return self::weaponTupo();
// case CmdCode::cmd_store_weaponReplace: # 6423武器替换
// return self::weaponReplace();
// case CmdCode::cmd_store_GemCompose: #6424
// return StoreProc::GemComposeItem();
// case CmdCode::cmd_store_GemResearchLvUp: # 6425
// return StoreProc::GemResearchLvUp();
// case CmdCode::cmd_store_GemSet: #6426 宝石镶嵌
// return StoreProc::GemSetYanLing();
// case CmdCode::cmd_store_GemRemove:
// return StoreProc::GemRemoveYanLing();
// case CmdCode::cmd_store_unlockStore:
// return StoreProc::unlockStore();
// case CmdCode::cmd_store_buyWeapon: #6429
// return self::buyWeapon();
// case CmdCode::cmd_store_getShopWeapon: # 6430
// return self::getShopWeapon();
// case CmdCode::cmd_store_buySupplies: #6431 购买补给品
// return self::buySupplies();
// case CmdCode::cmd_store_expandStorage: # 6432
// return self::expandStorage();
// case CmdCode::cmd_store_changeStorage: # 6433
// return self::changeStorage();
// case CmdCode::cmd_store_changeBettleItem: # 6434
// return self::changeBettleItem();
// case CmdCode::cmd_store_useBettleItem: # 6435
// return self::useBettleItem();
// case CmdCode::cmd_store_setBettleItemUseVal: # 6436cmd_store_removeItem
// return self::setBettleItemUseVal();
// case CmdCode::cmd_store_removeItem: # 6437 删除所有类型道具cmd_store_killMosterAddData
// return self::removeItem();
// case CmdCode::cmd_store_killMosterAddData: # 6438 击杀怪,唤灵师获得的信息加成,暂时是经验
// return self::killMosterAddData();
//
// case CmdCode::cmd_store_refreshItem: # 6439
// return self::refreshItem();
// case CmdCode::cmd_store_yanlingEvolve: #6440 言灵进化
// return self::yanlingEvolve();
// case CmdCode::cmd_store_yanlingEvolve_overall: #6441 一键进化
// return self::yanlingEvolveCompose();
// case CmdCode::cmd_store_setBettleItemAutoVal: #6442
// return self::setBettleItemAutoVal();
// case CmdCode::cmd_store_UpdateFightPower: #6443
// return self::UpdateFightPower();
// default:
// Err(ErrCode::cmd_err);
// }
// }
//
// public static function UpdateFightPower() {
// $fightPower = req()->paras[0];
//
// self::GetFightPower(req()->zoneid, req()->uid, $fightPower);
//
// RankProc::recordPlayerLevelInfo(req()->uid, req()->game->baseInfo->level, req()->zoneid);
//
// return Resp::ok(array("ret" => 'ok',));
// }
//
// static function GetFightPower($zoneid,$uid,$fightPower) {
// $key_fp = MemKey_GameRun::Game_FightPowerRank_zset($zoneid); # 战力榜
// gMem()->zadd($key_fp, array($uid => $fightPower));
// }
//
//
// /**
// * 一键进化
// * @return type
// */
// public static function yanlingEvolveCompose() {
// $comList = req()->paras[0];
//
// $yanling = ctx()->store->yanling;
// foreach ($comList as $str) {
// $list = explode(',', $str);
// $index = 0;
// $firstYanlingUId = $list[0];
// $yanlingMo = GameConfig::item_yanling_getItem($yanling->$firstYanlingUId->typeId);
// $yanlingQualityMo = GameConfig::yanlingQuality_getItem($yanlingMo->type, $yanling->$firstYanlingUId->quality);
//
// $weekType = $yanlingMo->weakType;
// $arr = explode(',', $yanlingQualityMo->evolveCost);
// $qly = $arr[0];
// $type = $arr[1];
// $num = $arr[2];
// $n = 0;
//
// foreach ($list as $uid) {
// my_Assert(StlUtil::dictHasProperty($yanling, $uid), ErrCode::hero_yanling_notfound);
//
// if ($index == 0) {
// $index += 1;
// continue;
// }
//
// my_Assert($yanling->$uid->herouid == 0, ErrCode::yanling_canotconsume);
// $costYanlingMo = GameConfig::item_yanling_getItem($yanling->$uid->typeId);
// if ($type == 1) {
// if ($uid != $firstYanlingUId && $costYanlingMo->type == $yanlingMo->type && $yanling->$uid->quality == $qly) {
// $n += 1;
// }
// } elseif ($type == 2) {
// $w = $costYanlingMo->weakType;
// $q = $yanling->$uid->quality;
// if ($uid != $firstYanlingUId && $w == $weekType && $q == $qly) {
// $n += 1;
// }
// }
// }
//
// my_Assert($n >= $num, ErrCode::yanling_canotevolve);
// }
//
// $retList = array();
// //进化
// foreach ($comList as $str) {
// $list = explode(',', $str);
//
// $firstYanlingUId = $list[0];
// $yanling->$firstYanlingUId->quality += 1;
// $retList[] = $firstYanlingUId;
// array_shift($list);
// self::YanlingCost($list, $yanling);
// }
//
// ctx()->store->yanling = $yanling;
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array("store" => ctx()->store(), "gold" => ctx()->baseInfo->gold, "evolveYanling" => $retList,));
// }
//
// /**
// * 6440 言灵进化
// */
// public static function yanlingEvolve() {
// $evolveYanlingUId = req()->paras[0];
// $ids = req()->paras[1];
//
// my_Assert(StlUtil::dictHasProperty(ctx()->store->yanling, $evolveYanlingUId), ErrCode::hero_yanling_notfound);
// $yanling = ctx()->store->yanling;
// $evolveYanlingId = $yanling->$evolveYanlingUId->typeId;
// $itemMo = GameConfig::item_base_getItem($evolveYanlingId);
// my_Assert($itemMo != null, ErrCode::err_const_no);
// if (!StlUtil::dictHasProperty($yanling->$evolveYanlingUId, 'quality')) {
// $yanling->$evolveYanlingUId->quality = $itemMo->quality;
// }
//
// $mo = GameConfig::item_yanling_getItem($evolveYanlingId);
// my_Assert($mo != null, ErrCode::err_const_no);
//
// $yanlingQualityMo = GameConfig::yanlingQuality_getItem($mo->type, $yanling->$evolveYanlingUId->quality);
// my_Assert($yanlingQualityMo != null, ErrCode::err_const_no);
//
// $arr = explode(',', $yanlingQualityMo->evolveCost);
// $qly = $arr[0];
// $type = $arr[1];
// $num = $arr[2];
//
// $n = 0;
// $list = explode(',', $ids);
// foreach ($list as $uid) {
// $tId = $yanling->$uid->typeId;
// my_Assert($yanling->$uid->herouid == 0, ErrCode::yanling_canotconsume);
//
// $costYanlingMo = GameConfig::item_yanling_getItem($tId);
// if ($type == 1) {//本体 同type 同$qly
// if ($uid != $evolveYanlingUId && $costYanlingMo->type == $mo->type && $yanling->$uid->quality == $qly) {
// $n += 1;
// }
// } elseif ($type == 2) {//同元素 同品阶
// $weekType = $mo->weakType;
// //$quality = $yanling->$evolveYanlingUId->quality;
// $w = $costYanlingMo->weakType;
// $q = $yanling->$uid->quality;
// if ($uid != $evolveYanlingUId && $w == $weekType && $q == $qly) {
// $n += 1;
// }
// }
// }
// my_Assert($n >= $num, ErrCode::yanling_canotevolve);
//
// self::YanlingCost($list, $yanling);
//
// $yanling->$evolveYanlingUId->quality += 1;
//
// ctx()->store->yanling = $yanling;
// UserProc::updateUserInfo();
//
// return Resp::ok(array("store" => ctx()->store(), "gold" => ctx()->baseInfo->gold,));
// }
//
// public static function YanlingCost($list, &$yanling) {
// foreach ($list as $uid) {
// $curExp = $yanling->$uid->curStarExp;
// //经验 金币突破材料
// if ($yanling->$uid->starLv > 0) {
// $starlv = $yanling->$uid->starLv;
// for ($i = 1; $i <= $starlv; $i++) {
// $goodsStr = GameConfig::yanlingextra_level_getItem($yanling->$uid->typeId, $starlv)->costItems;
// $gold = GameConfig::yanlingextra_level_getItem($yanling->$uid->typeId, $starlv)->gold;
// ctx()->base(true)->Add_Gold($gold);
// StoreProc::AddMultiItemInStore($goodsStr);
// }
// }
//
// self::giveBackYanlingDevelopMaterialDeal($curExp);
//
// //删除言灵
// StlUtil::dictRemove($yanling, $uid);
// }
// }
//
// public static function giveBackYanlingDevelopMaterialDeal($curExp) {
// if ($curExp < 100) {
// return "";
// }
// $stoneList = GameConfig::item_stones_type_getItemArray(2);
// $retArr = array();
// foreach ($stoneList as $stone) {
// $typeId = $stone->typeId;
// $exp = $stone->baseExp;
// $retArr[] = $typeId . '-' . $exp;
// }
// krsort($retArr);
//
// $dic = new \stdClass();
// foreach ($stoneList as $stone) {
// $typeId = $stone->typeId;
// $exp = $stone->baseExp;
// $dic->$typeId = $exp;
// }
//
// $tempExp = $curExp;
// foreach ($retArr as $val) {
// $valList = explode('-', $val);
// $itemId = $valList[0];
// $exp = $valList[1];
// $addNum = intval($tempExp / $exp);
// if ($addNum == 0) {//说明自己的经验比强化符的小
// continue;
// } else {
// $ctx = $itemId . ',' . $addNum;
// //$prizeArr[] = $ctx;
// StoreProc::AddMultiItemInStore($ctx);
// $stoneExp = $dic->$itemId;
// $tempExp = $tempExp - $addNum * $stoneExp;
// }
// }
// }
//
// /**
// * 背包里新标志道具查看 0 系统 1武器,2碎片,3材料, 4 言灵, 5 礼包
// */
// public static function refreshItem() {
// $type = req()->paras[0];
// $uid = req()->paras[1];
//
// if ($type == 101 && in_array($uid, ctx()->store->weaponRecord)) {
// StlUtil::arrayRemove(ctx()->store->weaponRecord, $uid);
// } elseif ($type == 401 && in_array($uid, ctx()->store->yanlingRecord)) {
// StlUtil::arrayRemove(ctx()->store->yanlingRecord, $uid);
// } else {
// if (in_array($uid, ctx()->store->itemRecord)) {
// StlUtil::arrayRemove(ctx()->store->itemRecord, $uid);
// }
// }
//
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array('store' => ctx()->store,));
// }
//
// /**
// * 6438 击杀怪,唤灵师获得的信息加成,暂时是经验
// */
// public static function killMosterAddData() {
// $heroUID = req()->paras[0];
// $mosterId = req()->paras[1]; # 提取参数
//
// $hero = ctx()->heros(true);
//
// $mo = GameConfig::hero_getItem($mosterId);
// my_Assert($mo != null, ErrCode::err_const_no);
//
// //经验修正率=1 + 0.05 × (怪物等级 - 角色(唤灵师)等级)
// //角色所得经验 = 怪物经验 * 经验修正率
//
// $lv = substr($mo->heroId, -2);
// $n = substr($lv, 0, 1);
// if ($n == 0) {
// $lv = substr($lv, 1, 1);
// }
// $collectHeros = $hero->collectHeros;
// my_default_Obj($collectHeros);
// my_Assert(CommUtil::isPropertyExists($collectHeros, $heroUID), ErrCode::hero_no); # 要升级的英雄不存在
// $targetHero = new Ins_UserHero($collectHeros->$heroUID); # 英雄对象
// $heroLv = $targetHero->level;
// $per = 1 + 0.05 * ($lv - $heroLv);
//
// $totalExp = intval($mo->exp * $per);
// if ($totalExp < 0) {
// $totalExp = 0;
// }
//
// $targetHero = HeroProc::HeroAddEXP($heroUID, $totalExp);
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array('hero' => $targetHero, 'exp' => $mo->exp,));
// }
//
// /**
// * 删除所有类型道具
// */
// public static function removeItem() {
// $str = req()->paras[0]; # 提取参数
//
// $list = explode(';', $str);
// foreach ($list as $k => $val) {
// $slist = explode('-', $val);
// $itemType = $slist[0]; # 提取参数
// $uid = $slist[1]; # 提取参数
// $typeId = $slist[2];
// $num = $slist[3]; # 提取参数
//
// self::removeStoreItem($itemType, $uid, $typeId, $num);
// }
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array("store" => ctx()->store(),));
// }
//
// public static function removeStoreItem($itemType, $uid, $typeId, $num) {
// $store = ctx()->store(true);
// switch ($itemType) {//物品大归类 0 系统 1武器,2碎片,3材料, 4 言灵, 5 礼包,6 宝石道具 7任务卡
// case 1:
// StoreProc::removeEquipFromStore($uid, $typeId);
// break;
// case 2:
// case 3:
// case 7:
// case 6:
// StoreProc::removeItemFromStore($store, $typeId, $num);
// break;
// case 4:
// StoreProc::removeYanlingFromStore($uid, $typeId);
// break;
// default:
// break;
// }
// }
//
// /**
// * 6436
// * @return type
// */
// public static function setBettleItemUseVal() {
// $index = req()->paras[0]; # 提取参数
// $val = req()->paras[1]; # 提取参数
//
// $store = ctx()->store(true);
//
// //my_Assert($store->battleItem->$index->num >= 1, ErrCode::store_bettleitemNumNotEnough);
// //$store->battleItem->$index->isAuto = 1;
// $store->battleItem->$index->attrVal = $val;
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array("store" => ctx()->store(),));
// }
//
// /**
// * 6436
// * @return type
// */
// public static function setBettleItemAutoVal() {
// $index = req()->paras[0]; # 提取参数
// $val = req()->paras[1]; # 提取参数
//
// $store = ctx()->store(true);
//
// //my_Assert($store->battleItem->$index->num >= 1, ErrCode::store_bettleitemNumNotEnough);
// $store->battleItem->$index->isAuto = $val;
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array("store" => ctx()->store(),));
// }
//
// /**
// * 6435
// * @return type
// */
// public static function useBettleItem() {
// $index = req()->paras[0]; # 提取参数
//
// $store = ctx()->store(true);
//
// //my_Assert($store->battleItem->$index->num >= 1, ErrCode::store_bettleitemNumNotEnough);
// $id = $store->battleItem->$index->id;
//
// //$store->battleItem->$index->num -= 1;
// StoreProc::removeItemFromStore($store, $id);
//// if(StlUtil::dictHasProperty($store->items,$id)){
//// $store->items->$id -= 1;
//// if($store->items->$id <= 0){
//// unset($store->items->$id);
//// }
//// }
//// if ($store->battleItem->$index->num <= 0) {
//// unset($store->battleItem->$index);
//// }
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array("store" => ctx()->store(),));
// }
//
// /**
// * 6434
// * @return type
// */
// public static function changeBettleItem() {
// $type = req()->paras[0]; # 提取参数
// $index = req()->paras[1]; # 提取参数
// $itemid = req()->paras[2]; # 提取参数
//
// $store = ctx()->store(true);
//
// $str = GameConfig::globalsettings()->YaoPingAttrInitVal;
// $slist = explode(';', $str);
// $hp = explode(',', $slist[0])[1];
// $mp = explode(',', $slist[1])[1];
//
// if ($type == 0) {//添加
// $item = new Ins_battleItem();
// $item->index = $index;
// $item->id = $itemid;
// $item->num = $store->items->$itemid;
//
// $subType = GameConfig::item_base_getItem($itemid)->subType;
// if ($subType == 341) {
// $item->attrVal = $hp;
// } else {
// $item->attrVal = $mp;
// }
//
// $store->battleItem->$index = $item;
// } else {
// unset($store->battleItem->$index);
// }
// UserProc::updateUserInfo();
// return Resp::ok(array("store" => ctx()->store(),));
// }
//
// /**
// * 6432
// * @return type
// */
// public static function changeStorage() {
// $index = req()->paras[0]; # 选中的第几个格子
// $type = req()->paras[1]; # 1:放入 2移除到背包
// $itemType = req()->paras[2]; # 道具类型
// $uid = req()->paras[3]; # 道具的uid
//
// $store = ctx()->store(true);
// my_Assert(StlUtil::dictHasProperty($store->storage, $index), ErrCode::store_NotHaveStorage);
//
// $storage = $store->storage->$index;
// $num = 0;
// foreach ($storage as $k => $dic) {
// $num += count((array) $dic);
// }
//
// switch ($itemType) {
// case 101://武器
// if ($type == 1) {
// my_Assert($num < 50, ErrCode::store_StorageEnough);
// $equipVo = $store->equipment->$uid;
// $storage->equipment->$uid = $equipVo; //添加
//
// StoreProc::removeEquipFromStore($uid, $equipVo->typeId); //移除
// } else {
// $equipVo = $storage->equipment->$uid;
// $store->equipment->$uid = $equipVo;
//
// unset($storage->equipment->$uid);
// }
//
// break;
// case 401://言灵
// if ($type == 1) {
// my_Assert($num < 50, ErrCode::store_StorageEnough);
// $yanlingVo = $store->yanling->$uid;
// $storage->yanling->$uid = $yanlingVo; //添加
//
// StoreProc::removeYanlingFromStore($uid, $yanlingVo->typeId); //移除
// } else {
// $yanlingVo = $storage->yanling->$uid;
// $store->yanling->$uid = $yanlingVo;
//
// unset($storage->yanling->$uid);
// }
//
// break;
// default://其他道具
// if ($type == 1) {
// my_Assert($num < 50, ErrCode::store_StorageEnough);
// $itemNum = $store->items->$uid;
// if (!StlUtil::dictHasProperty($storage->itemDic, $uid)) {
// $storage->itemDic->$uid = 0;
// }
// $storage->itemDic->$uid += $itemNum; //添加
// StoreProc::removeItemFromStore($store, $uid, $itemNum);
// } else {
// $itemNum = $storage->itemDic->$uid;
// $goodsStr = $uid . "," . $itemNum;
// StoreProc::AddMultiItemInStore($goodsStr);
//
// unset($storage->itemDic->$uid);
// }
//
// break;
// }
//
// $store->storage->$index = $storage;
//
// //ctx()->store(true) = $store;
// UserProc::updateUserInfo();
//
// return Resp::ok(array("store" => $store,));
// }
//
// /**
// * 储物间扩容
// * @return type
// */
// public static function expandStorage() {
// $cost = GameConfig::globalsettings()->expandStorageCost;
// $list = explode(',', $cost);
//
// $key = 3;
// my_Assert(!StlUtil::dictHasProperty(ctx()->store(true)->storage, $key), ErrCode::store_expandStorage);
//
// if ($list[0] == 1) {
// my_Assert(ctx()->base(true)->gold >= $list[1], ErrCode::notenough_gold_msg);
// ctx()->base(true)->Consume_Gold($list[1]);
// } elseif ($list[0] == 2) {
// my_Assert(ctx()->base(true)->cash >= $list[1], ErrCode::notenough_cash_msg);
// ctx()->base(true)->Consume_Cash($list[1]);
// }
// $str = $list[0] . "," . $list[1];
// ctx()->store(true)->storage->$key = new Ins_storage();
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array("storage" => ctx()->store(true)->storage, "cost" => $str,));
// }
//
// /**
// * 6431 购买补给品
// */
// public static function buySupplies() {
// $npcid = req()->paras[0]; # 提取参数
// $itemid = req()->paras[1]; # 提取参数
// $num = req()->paras[2]; # 提取参数
// //补充shop_supplies的mo
// $mo = GameConfig::shop_supplies_getItem($npcid, $itemid);
// my_Assert($mo != null, ErrCode::err_const_no);
//
// $cost = $mo->cost * $num;
// my_Assert($num <= $mo->num, ErrCode::err_const_no);
//
// my_Assert(ctx()->base(true)->gold >= $cost, ErrCode::notenough_gold_msg);
//
// ctx()->base(true)->Consume_Gold($cost);
// $goodsStr = $itemid . ',' . $num;
//
// StoreProc::AddMultiItemInStore($goodsStr);
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array("store" => ctx()->store(), "cost" => $cost,));
// }
//
// /**
// *
// */
// public static function getShopWeapon() {
// $npcid = req()->paras[0]; # 提取参数
//
// self::DailyRefreshWeapon($npcid);
//
// UserProc::updateUserInfo();
//
// return Resp::ok(array(
// "store" => ctx()->store(), #
// ));
// }
//
// /**
// *
// * @return type
// */
// public static function buyWeapon() {
// $npcid = req()->paras[0]; # 提取参数
// $weaponId = req()->paras[1]; # 提取参数
//
// $store = ctx()->store(true);
// $type = 0;
//
// $tag = true;
// if (StlUtil::dictHasProperty($store->weaponReward, $npcid)) {
// $dic = $store->weaponReward->$npcid;
// foreach ($dic as $k => $list) {
// if (in_array($weaponId, $list)) {
// $tag = false;
// break;
// }
// }
// }
//
// my_Assert($tag == true, ErrCode::store_weaponCantBuy);
//
// $list = GameConfig::shop_weapon_getItemArray($npcid);
// $cost = 0;
// foreach ($list as $item) {
// $weaponList = explode(';', $item->weaponlist);
// foreach ($weaponList as $value) {
// $pList = explode(',', $value);
// if (in_array($weaponId, $pList)) {
// $type = $item->id;
// $cost = $item->cost;
// break 2;
// }
// }
// }
//
// my_Assert(ctx()->base(true)->gold >= $cost, ErrCode::notenough_gold_msg);
// ctx()->base(true)->Consume_Gold($cost);
//
// if (!StlUtil::dictHasProperty($store->weaponReward, $npcid)) {
// $store->weaponReward->$npcid = new \stdClass();
// }
// $store->weaponReward->$npcid->$type[] = $weaponId;
//
// self::PutEquipInStore($weaponId);
//
// ctx()->store = $store;
//
// UserProc::updateUserInfo();
// return Resp::ok(array(
// "store" => $store,
// "cost" => $cost,
// ));
// }
//
// /*
// * 每日刷新武器
// */
//
// public static function DailyRefreshWeapon($npcid = null) {
// //没有数据初始化,有数据不在管
// if ($npcid != null && !StlUtil::dictHasProperty(ctx()->store()->weaponPool, $npcid)) {
// $list = GameConfig::shop_weapon_getItemArray($npcid);
//
// foreach ($list as $value) {
// $ret = new \stdClass();
// $arr = explode(';', $value->weaponlist);
// foreach ($arr as $item) {
// $itemList = explode(',', $item);
// $id = $itemList[0];
// $per = $itemList[1];
// $ret->$id = $per;
// }
// $retArr = array();
// $type = $value->id;
// $pArr = self::randweapon($ret, $value->num);
// //数组合并
// $retArr = array_merge($retArr, $pArr);
// if (!StlUtil::dictHasProperty(ctx()->store()->weaponPool, $npcid)) {
// ctx()->store()->weaponPool->$npcid = new \stdClass();
// }
// ctx()->store()->weaponPool->$npcid->$type = $retArr;
// }
// } else if ($npcid == null) {
// //每日登录刷新,刷新的时候把已经购买过的武器去掉;
// $dic = ctx()->store()->weaponPool;
// foreach ($dic as $npcid => $val) {
// $list = GameConfig::shop_weapon_getItemArray($npcid);
// foreach ($list as $value) {
// $ret = new \stdClass();
// $arr = explode(';', $value->weaponlist);
// foreach ($arr as $item) {
// $itemList = explode(',', $item);
// $id = $itemList[0];
// $per = $itemList[1];
// $ret->$id = $per;
// }
//
// $ret2 = $ret;
// $type = $value->id;
// if (StlUtil::dictHasProperty(ctx()->store()->weaponReward, $npcid)) {
// $weaponList = ctx()->store()->weaponReward->$npcid->$type;
// foreach ($weaponList as $wid) {
// if (StlUtil::dictHasProperty($ret, $wid)) {
// StlUtil::dictRemove($ret, $wid);
// }
// }
// }
//
// $temp = $ret;
// if (count((array) $ret) < $value->num) {//一旦所有的武器或是不够刷新数量了,重置当前档位
// $temp = $ret2;
// ctx()->store()->weaponReward->$npcid->$type = array();
// }
// $retArr = array();
//
// $pArr = self::randweapon($temp, $value->num);
//
// $retArr = array_merge($retArr, $pArr);
// ctx()->store()->weaponPool->$npcid->$type = $retArr;
// }
// }
// }
// }
//
// static function randweapon($temp, $limit) {
// $resultArr = array();
// $num = 0;
// while (true) {
// $total = 0;
// foreach ($temp as $k => $v) {
// $total += $v;
// }
//
// $n = rand(1, $total);
// $start = 0;
// foreach ($temp as $id => $per) {
// $start += $per;
// if ($n <= $start) {
// if (in_array($id, $resultArr)) {
// StlUtil::dictRemove($temp, $id);
// break;
// } else {
// $resultArr[] = $id;
// $num += 1;
// break;
// }
// }
// }
//
// if ($num >= $limit) {
// break;
// }
// }
//
// return $resultArr;
// }
//
// /**
// * 扩容
// * @return type
// */
// static function unlockStore() {
// //list() = req()->paras;
// $user = ctx();
//
// $mo = GameConfig::expandStoreNum_getItem($user->privateState->expandNum + 1);
// my_Assert($mo != null, ErrCode::err_const_no);
// my_Assert($user->baseInfo->gold >= $mo->cost, ErrCode::notenough_gold_msg);
//
// $user->base(true)->Consume_Gold($mo->cost);
// $user->privateState->expandNum += 1;
// ctx($user);
//
// UserProc::updateUserInfo(); # 回写玩家数据
// return Resp::ok(array(
// "gold" => $user->baseInfo->gold,
// "expandNum" => $user->privateState->expandNum,
// ));
// }
//
// /**
// * 宝石镶嵌
// */
// static function GemSetYanLing() {
// list($gemId, $yanlingUid) = req()->paras;
// $user = ctx();
//
// $yanling = $user->store->yanling;
// my_Assert(CommUtil::isPropertyExists($yanling, $yanlingUid), ErrCode::hero_yanling_errorYanling);
// my_Assert(CommUtil::isPropertyExists($user->store->items, $gemId) && $user->store->items->$gemId > 0, ErrCode::store_itemno_err);
//
// if (!StlUtil::dictHasProperty($yanling->$yanlingUid, "gemId")) {//临时
// $yanling->$yanlingUid->gemId = 0;
// }
//
// my_Assert($yanling->$yanlingUid->gemId == 0, ErrCode::store_YanLingHaveGem);
//
// StoreProc::removeItemFromStore($user->store, $gemId);
// $yanling->$yanlingUid->gemId = $gemId;
//
// $user->store->yanling = $yanling;
// ctx($user);
//
// UserProc::updateUserInfo(); # 回写玩家数据
// return Resp::ok(array(
// "store" => $user->store, # # 目前来看只涉及到items变化
// ));
// }
//
// /**
// * 从严灵上卸下宝石
// */
// static function GemRemoveYanLing() {
// list($yanlingUid) = req()->paras;
// $user = ctx();
// my_Assert(CommUtil::isPropertyExists($user->store->yanling, $yanlingUid), ErrCode::hero_yanling_errorYanling);
// $gemId = $user->store->yanling->$yanlingUid->gemId;
//
// my_Assert($gemId != 0, ErrCode::store_YanLingNotGem);
//
// $goodsStr = $gemId . ",1";
// StoreProc::AddMultiItemInStore($goodsStr);
// $user->store->yanling->$yanlingUid->gemId = 0;
//
// ctx($user);
//
// UserProc::updateUserInfo(); # 回写玩家数据
// return Resp::ok(array(
// "store" => $user->store, # # 目前来看只涉及到items变化
// ));
// }
//
// /**
// * 宝石合成
// */
// static function GemComposeItem() {
// list($gemId, $num) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
// $user = ctx();
// //my_Assert(CommUtil::isPropertyExists($myPacketItems, $costItemId), ErrCode::store_itemnotenough); #
//
// $mo = GameConfig::gem_formula_getItem($gemId);
// my_Assert($mo != null, ErrCode::err_const_no); #
// my_Assert($mo->levellimit <= $user->Gem->level, ErrCode::store_GemComplose_ResearchLevelLimit); #
// $itemId = $mo->drawItem;
// if ($itemId != "") {
// my_Assert(StlUtil::dictHasProperty($user->store->items, $itemId) && $user->store->items->$itemId > 0, ErrCode::store_GemComploseTuZhiNotEnough); #
// }
//
// if ($mo->composeMaterial != "") {
// $mList = explode(',', $mo->composeMaterial);
// $itemId = $mList[0];
// $num = $mList[1];
// my_Assert(StlUtil::dictHasProperty($user->store->items, $itemId) && $user->store->items->$itemId > $num, ErrCode::store_GemComploseMaterialNotEnough);
//
// //扣除材料
// StoreProc::removeItemFromStore($user->store, $itemId, $num);
// }
//
// $gList = explode(',', $mo->composeGem);
// $itemId = $gList[0];
// my_Assert(StlUtil::dictHasProperty($user->store->items, $itemId) && $user->store->items->$itemId > $gList[1], ErrCode::store_ComploseGemNotEnough);
// my_Assert($user->baseInfo->gold >= $mo->composeGold, ErrCode::notenough_gold_msg);
//
// //扣除配方金币 宝石
// $user->base(true)->Consume_Gold($mo->composeGold);
// StoreProc::removeItemFromStore($user->store, $gList[0], $gList[1]);
// $goodsStr = $gemId . ',1';
// StoreProc::AddMultiItemInStore($goodsStr);
// ctx($user);
//
// UserProc::updateUserInfo(); # 回写玩家数据
// return Resp::ok(array(
// "store" => $user->store, # # 目前来看只涉及到items变化
// 'gold' => $user->baseInfo->gold,
// ));
// }
//
// /**
// * 宝石合成的研究等级提升
// */
// static function GemResearchLvUp() {
// //list() = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
// $user = ctx();
// $researchLevel = $user->Gem->level; //研究等级
//
// $mo = GameConfig::gem_researchlevel_getItem($researchLevel + 1);
//
// my_Assert($mo != null, ErrCode::err_const_no);
// my_Assert($mo->userlevelLimit <= $user->baseInfo->level, ErrCode::store_GemResearchLvUp_UserLevelLimit);
// //$list = explode(',',$mo->unlockLevelGoldCost);
//
// my_Assert($mo->unlockLevelGoldCost <= $user->baseInfo->gold, ErrCode::notenough_gold_msg);
//
// $user->base(true)->Consume_Gold($mo->unlockLevelGoldCost);
// $user->Gem->level += 1;
// ctx($user);
//
// UserProc::updateUserInfo(); # 回写玩家数据
// return Resp::ok(array(
// "lv" => $user->Gem->level, # # 目前来看只涉及到items变化
// 'gold' => $user->baseInfo->gold,
// ));
// }
//
// /**
// * 武器升级
// */
// static function weaponUpgrade() {
// list($uid, $wuqiList, $items) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
// $user = ctx();
// $equipment = $user->store->equipment;
//
// my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
// $myPacketItems = $user->store->items;
// //消耗材料道具
// $total = 0;
// $totalGold = 0;
// foreach ($items as $costItemId => $costNumber) {
// my_Assert(CommUtil::isPropertyExists($myPacketItems, $costItemId), ErrCode::store_itemnotenough); #
// my_Assert($myPacketItems->$costItemId >= $costNumber, ErrCode::store_itemnotenough); # 检查道具的数量,在背包中是否充足
// $mo = GameConfig::item_stones_getItem($costItemId);
// my_Assert($mo != null, ErrCode::err_const_no);
//
// StoreProc::removeItemFromStore($user->store, $costItemId, $costNumber);
// $total += $mo->baseExp * $costNumber;
// $totalGold += $mo->costGold * $costNumber;
// }
//
// $wuqiExp = 0;
// //消耗武器
// foreach ($wuqiList as $wuqiId) {
// my_Assert(CommUtil::isPropertyExists($equipment, $wuqiId), ErrCode::store_weapon_err); # 玩家拥有此英雄
// my_Assert($equipment->$wuqiId->herouid == 0, ErrCode::store_WeaponCanotConsume); # 该言灵已经被装备不能在消耗
// $mo = GameConfig::item_weapon_getItem($equipment->$wuqiId->typeId);
// $baseExp = $mo->baseExp;
// //$needExp = GameConfig::weapon_levelexp_getItem(GameConfig::item_base_getItem($equipment->$wuqiId->typeId)->quality,$equipment->$wuqiId->level)->needExp;
// $wuqiExp += $baseExp + $equipment->$wuqiId->exp * 0.75;
// $totalGold += $mo->costGold;
// StlUtil::dictRemove($user->store->equipment, $wuqiId);
// }
// my_Assert($user->baseInfo->gold >= $totalGold, ErrCode::notenough_gold_msg);
//
// $equipVo = new Ins_Weapon($equipment->$uid);
// $initLevel = $equipVo->level;
//
// $equipVo->exp += $total + (int) $wuqiExp;
// $curlevel = self::Upgrade($equipVo->exp, GameConfig::item_base_getItem($equipVo->typeId)->quality, Enum_UpgradeType::Wuqi);
// $curStar = $equipVo->starLevel; #当前星级
// $equipVo->level = $curlevel;
//
// $num = 0;
// $dic = GameConfig::weaponextra_level();
// foreach ($dic as $tId => $val) {
// if ($tId == $equipVo->typeId) {
// foreach ($val as $k => $v) {
// $num += 1;
// }
// break;
// }
// }
// if ($curStar < $num - 1) {
// $starlimitLv = GameConfig::weaponextra_level_getItem($equipVo->typeId, $curStar + 1)->starlimitLv;
// if ($starlimitLv <= $curlevel) {
// $equipVo->level = $starlimitLv;
// $equipVo->exp = GameConfig::weapon_levelexp_getItem(GameConfig::item_base_getItem($equipVo->typeId)->quality, $starlimitLv)->requiredExp;
// }
// }
//
// $user->store->equipment->$uid = $equipVo;
//
// TaskProc::OnWeaponLevelUp($equipVo->typeId, $equipVo->level);
// UserProc::CollectUserBaseParam(req()->cmd, 2, $user->baseInfo->gold, $totalGold, $user->baseInfo->gold - $totalGold, "");
// $user->baseInfo->gold -= $totalGold;
// ctx($user);
// ctx()->store->items = $myPacketItems; # 更新背包数据
// if ($equipVo->level != $initLevel) {
// NormalEventProc::OnWeaponLvlUp($uid, $equipVo->level); # 广播英雄升级事件
// StatisticsProc::TargetStatistics(Enum_TargetStatistics::WeaponIdLevel_UserNum, $equipVo->typeId, "$equipVo->level", $initLevel);
// }
//
// UserProc::updateUserInfo(); # 回写玩家数据
// return Resp::ok(array(
// "store" => $user->store, # # 目前来看只涉及到items变化
// 'gold' => $user->baseInfo->gold,
// ));
// }
//
// /**
// * 武器升级计算
// * @param type $xp
// * @param type $type
// * @return type
// */
// static function Upgrade($xp, $qual, $type) {
// $curLv = 0;
// if ($type == Enum_UpgradeType::Wuqi) {
// $heroLvDic = GameConfig::weapon_levelexp()->$qual;
// } else {
// $heroLvDic = GameConfig::yanlingLevel_type()->$qual;
// }
//
// $f = (array) $heroLvDic;
// ksort($f);
// foreach ($f as $lv => $mo) {
// if ($xp < $mo->requiredExp) {
// $curLv = $lv - 1;
// break;
// }
//
//// if($lv>=glc()->Weapon_Upgrade_BasicMaxLevel){
//// $curLv = glc()->Weapon_Upgrade_BasicMaxLevel;
//// break;
//// }
// }
//
// return $curLv;
// }
//
// /**
// * 武器突破
// */
// static function weaponTupo() {
// list($uid) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
// $user = ctx();
// $equipment = $user->store->equipment;
// my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
//
// $typeId = $equipment->$uid->typeId;
// $curStar = $equipment->$uid->starLevel;
//
// $num = 0;
// $dic = GameConfig::weaponextra_level();
// foreach ($dic as $tId => $val) {
// if ($tId == $typeId) {
// foreach ($val as $k => $v) {
// $num += 1;
// }
// break;
// }
// }
// my_Assert($curStar < $num - 1, ErrCode::hero_yanling_canotTupo);
//
// $mo = GameConfig::weaponextra_level_getItem($typeId, $curStar + 1);
// my_Assert($mo != null, ErrCode::err_const_no);
//
// my_Assert($equipment->$uid->level >= $mo->starlimitLv, ErrCode::hero_yanling_canotTupo);
// my_Assert($user->baseInfo->level >= $mo->userlvLimit, ErrCode::hero_yanling_canotTupo);
// my_Assert($user->baseInfo->gold >= $mo->gold, ErrCode::notenough_gold_msg);
//// $segID = $mo->segID;
//// my_Assert(StlUtil::dictHasProperty($user->store->items,$segID) , ErrCode::store_itemnotenough);
//// my_Assert($user->store->items->$segID>=$mo->segNum , ErrCode::store_itemnotenough);
//
// $costItemsList = explode(';', $mo->costItems);
// foreach ($costItemsList as $value) {
// $list = explode(',', $value);
// StoreProc::removeItemFromStore($user->store, $list[0], $list[1]);
// }
//
// UserProc::CollectUserBaseParam(req()->cmd, 2, $user->baseInfo->gold, $mo->gold, $user->baseInfo->gold - $mo->gold, "");
// $user->baseInfo->gold -= $mo->gold;
// $equipment->$uid->starLevel += 1;
//
// NormalEventProc::OnWeaponLvTuPo($uid, $equipment->$uid->starLevel); # 广播英雄升级事件
// TaskProc::OnWeaponStarUp($equipment->$uid->starLevel);
//
// $user->store->equipment = $equipment;
// ctx($user);
//
// UserProc::updateUserInfo(); # 回写玩家数据
// return Resp::ok(array(
// "store" => $user->store, # # 目前来看只涉及到items变化
// 'gold' => $user->baseInfo->gold,
// ));
// }
//
// /**
// * 武器替换
// * @return type
// */
// static function weaponReplace() {
// list($uid, $replaceId) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
// $user = ctx();
// $equipment = $user->store->equipment;
// my_Assert(property_exists($equipment, $uid), "找不到这个言灵");
// my_Assert(property_exists($equipment, $replaceId), "找不到这个言灵");
//
// $herouid = $equipment->$uid->herouid;
// $herouid_replace = $equipment->$replaceId->herouid;
// $equipment->$replaceId->herouid = $herouid;
// $equipment->$uid->herouid = $herouid_replace;
// $user->store->equipment = $equipment;
// ctx($user);
//
// UserProc::updateUserInfo(); # 回写玩家数据
// return Resp::ok(array(
// "store" => $user->store, # # 目前来看只涉及到items变化
// ));
// }
//
// /**
// * [6420] 言灵进阶
// */
// static function YanlingUpgrade() {
// list($yanlingUid) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
// $user = ctx();
// my_Assert(property_exists($user->store->yanling, $yanlingUid), "找不到这个言灵");
// $yanlingObj = $user->store->yanling->$yanlingUid;
// $yanlingMoId = $yanlingObj->typeId;
// $curGrade = property_exists($yanlingObj, "grade") ? $yanlingObj->grade : 1; # 当前等阶
// $toGrade = $curGrade + 1; # 下一等阶
// my_Assert($toGrade <= 5, ErrCode::store_yanlingGrade_max); # 已经进阶到最高
// $toGradeCfg = GameConfig::yanling_upgrade_getItem($yanlingMoId, $toGrade); # 下一阶配置
// my_Assert(null != $toGradeCfg, ErrCode::err_const_no); # 找不到言灵进阶常量
// $costs = explode(';', $toGradeCfg->cost_materials);
// my_Assert(count($costs) > 0, ErrCode::store_yanlingGrade_cfg); # 言灵进阶数据有误
// foreach ($costs as $c) {
// list($itemId, $num) = explode(',', $c); # 解析材料
// $err = self::removeItemFromStore($user->store, $itemId, $num); # 扣除 材料
// my_Assert(ErrCode::ok == $err, $err); # 防御扣除材料失败
// }
// $yanlingObj->grade = $toGrade; # 修改进阶
// $user->store->yanling->$yanlingUid = $yanlingObj; # 回写言灵数据
// UserProc::updateUserInfo(); # 回写玩家数据
// return Resp::ok(array(
// "store" => $user->store, # # 目前来看只涉及到items变化
// ));
// }
//
// /**
// * [6418] 利用言灵召唤书碎片合成召唤书
// */
// static function MergeYanlingBook() {
// list($bookId) = req()->paras; # 参数 言灵召唤书id
// $user = ctx();
// $bookIdCfg = GameConfig::item_yanlingbook_getItem($bookId);
// my_Assert(null != $bookIdCfg, ErrCode::err_const_no); # 找不到言灵书常量
// list($segId, $num) = explode(',', $bookIdCfg->seg_num); # 解析所需碎片信息
// $err = self::removeItemFromStore($user->store, $segId, $num); # 扣除 碎片
// my_Assert(ErrCode::ok == $err, $err); # 防御扣除碎片失败
// self::PutOverlyingItemInStore($bookId); # 添加召唤书
// UserProc::updateUserInfo(); # 回写数据
// return Resp::ok(array(
// "store" => $user->store, # # 目前来看只涉及到items变化
// ));
// }
//
// /**
// * [6419] 利用言灵召唤书召唤言灵
// */
// static function CallYanlingByBook() {
// list($bookId) = req()->paras; # 参数 利用的言灵召唤书id
// $user = ctx();
// $bookIdCfg = GameConfig::item_yanlingbook_getItem($bookId);
// my_Assert(null != $bookIdCfg, ErrCode::err_const_no); # 找不到言灵书常量
// $err = self::removeItemFromStore($user->store, $bookId); # 扣除 召唤书
// my_Assert(ErrCode::ok == $err, $err); # 防御扣除召唤书失败
// $costs = explode(';', $bookIdCfg->cost_materials);
// my_Assert(count($costs) > 0, ErrCode::store_book_info); # 召唤书数据有误
// foreach ($costs as $c) {
// list($itemId, $num) = explode(',', $c); # 解析材料
// $err = self::removeItemFromStore($user->store, $itemId, $num); # 扣除 材料
// my_Assert(ErrCode::ok == $err, $err); # 防御扣除材料失败
// }
// self::PutYanLingInStore($bookIdCfg->yanling_id); # 添加言灵
// UserProc::updateUserInfo(); # 回写数据
// return Resp::ok(array(
// "store" => $user->store, # # 目前来看只涉及到items变化
// ));
// }
//
// /**
// * 测试方法
// * @return type
// */
// static public function Test() {
// Err(ErrCode::msg_method_obsoleted, "代码需更新");
// }
//
// /**
// * [6404] 使用仓库道具
// */
// static function useItem() {
// list($itemType, $num) = req()->paras; # 提取参数
// $mo = GameConfig::item_base_getItem($itemType);
// my_Assert(null != $mo, ErrCode::err_const_no);
// $store = ctx()->store();
// $err = $store->RemoveItemFromStore($itemType, $num); # 扣除道具
// my_Assert(ErrCode::ok == $err, $err);
// switch ($mo->subType) {
// case 601: # 任务卡
// my_Assert($num == 1, "任务卡一次只能使用一张!");
// StoreProc::PutTaskCardInStore($itemType); # 任务卡放入任务卡
// ctx()->store = $store;
// break;
// case 303: # 体力药水
// $pillMo = GameConfig::item_pills_getItem($itemType);
// ctx()->base()->Add_tili($pillMo->number * $num); # 加体力
// break;
// default :
// break;
// }
// UserProc::updateUserInfo();
// return Resp::ok(array(
// 'priv' => ctx()->privateState,
// 'store' => ctx()->store,
// 'tili' => ctx()->base()->tili,
// ));
//
//// Err(ErrCode::msg_method_obsoleted, "代码需更新");
// }
//
// /**
// * [6405] 刷新仓库列表
// */
// static function refreshStore() {
// StoreProc::CheckItemNum();
// return Resp::ok(array('store' => ctx()->store));
// }
//
// /**
// * [6406] 从仓库删除道具
// */
// static function delItemFromStore() {
// list($itemId, $num) = req()->paras;
// $err = self::removeItemFromStore(ctx()->store, $itemId, $num);
// my_Assert(ErrCode::ok == $err, $err);
// UserProc::updateUserInfo();
// return Resp::ok(array('store' => ctx()->store));
// }
//
// /**
// * [6409] 合成道具
// */
// static public function composeItem() {
// Err(ErrCode::err_method_notimplement);
// }
//
// /**
// * [6409] 合成碎片(几个碎片合成获得同品质或者更高品质的新碎片)
// */
// static public function composePieces() {
// Err(ErrCode::err_method_notimplement);
// }
//
////
//// --------------- 以下为辅助方法 ------------------
////
////
//
// /**
// * 从仓库中移除指定数量的物品
// * @param Info_Store $store
// * @param type $itemId
// * @param type $itemcount
// * @return type
// */
// static function removeItemFromStore($store, $itemId, $itemcount = 1) {
// my_Assert(CommUtil::isPropertyExists($store->items, $itemId), ErrCode::store_itemno_err); # 没有这个道具
// my_Assert($store->items->$itemId >= $itemcount, ErrCode::store_itemnotenough); # 数量不足
// $store->items->$itemId -= $itemcount;
// if ($store->items->$itemId == 0) {
// unset($store->items->$itemId);
// if (in_array($itemId, ctx()->store->itemRecord)) {
// StlUtil::arrayRemove(ctx()->store->itemRecord, $itemId);
// }
// }
//
// if (GameConfig::item_base_getItem($itemId)->subType == 341 || GameConfig::item_base_getItem($itemId)->subType == 342) {//血瓶/蓝瓶
// foreach (ctx()->store->battleItem as $index => $val) {
// if ($val->id == $itemId) {
// if (!isset($store->items->$itemId) || $store->items->$itemId == 0) {
// unset(ctx()->store->battleItem->$index);
// } else {
// ctx()->store->battleItem->$index->num = $store->items->$itemId;
// }
// }
// }
// }
//
// NormalEventProc::OnBag_Remove_Item($itemId, $itemcount); # 插入事件
// return ErrCode::ok;
// }
//
// /**
// * 从仓库移出装备
// * @param type $itemId uid
// * @param Info_Store $store
// * @return boolean
// */
// static function removeEquipFromStore($uid, $typeId) {
// $ok = false;
// if (CommUtil::isPropertyExists(ctx()->store->equipment, $uid)) {
// my_Assert($typeId == ctx()->store->equipment->$uid->typeId, "typeid检验错误"); // typeid相同;
// my_Assert(ctx()->store->equipment->$uid->herouid == 0, "该武器被装备无法删除"); // typeid相同;
// unset(ctx()->store->equipment->$uid);
// if (in_array($uid, ctx()->store->weaponRecord)) {
// StlUtil::arrayRemove(ctx()->store->weaponRecord, $uid);
// }
//
//
// $ok = true;
// }
// return $ok;
// }
//
// static function removeYanlingFromStore($uid, $typeId) {
// $ok = false;
// if (CommUtil::isPropertyExists(ctx()->store->yanling, $uid)) {
// my_Assert($typeId == ctx()->store->yanling->$uid->typeId, "typeid检验错误"); // typeid相同;
// unset(ctx()->store->yanling->$uid);
//
// if (in_array($uid, ctx()->store->yanlingRecord)) {
// StlUtil::arrayRemove(ctx()->store->yanlingRecord, $uid);
// }
// $ok = true;
// }
// return $ok;
// }
//
// /**
// * 从仓库移除碎片
// * @param Info_Store $store
// * @param int $segmentId
// * @param int $num
// * @return bool 成功/失败
// */
// static function removeSegmetFromStore($store, $segmentId, $num = 1) {
// if (CommUtil::isPropertyExists($store->segement, $segmentId) #
// && $store->segement->$segmentId >= $num) {
// $store->segement->$segmentId -= $num;
// return TRUE;
// }
// return false;
// }
//
// /**
// * 向仓库添加碎片
// * @param Info_Store $store
// * @param int $segmentId
// * @param int $num
// */
// static function addSegmentIntoStore($store, $segmentId, $num = 1) {
// if (CommUtil::isPropertyExists($store->segement, $segmentId)) {
// $store->segement->$segmentId += $num;
// } else {
// $store->segement->$segmentId = $num;
// }
// $segMo = GameConfig::item_segment_getItem($segmentId);
// my_Assert($segMo != null, ErrCode::err_const_no);
// TaskProc::OnHeroSegmengNum($segMo->protoHeroID, $num);
// }
//
////
////
////
//
// /**
// * 将其他物品放入仓库
// * @param type $itemId
// * @param Data_UserGame $game
// */
// static function PutItemInStore($itemId, &$game) {
// if (CommUtil::isPropertyExists($game->store->items, $itemId)) { // 如果仓库中已经有这种元素,则其数目+1
// $game->store->items->$itemId += 1;
// } else {// 如果仓库中没有这种元素,则其数目置1
// $game->store->items->$itemId = 1;
// }
// }
//
// /**
// * 解包多种物品到玩家身上 【警告】此函数的异常处理功能残废,不安全
// * 检测如果当前物品格子大于物品总数,则可以获取战利品,否则不可以
// * @param string $goodsStr itemid,num;itemid,num;...
// * @param int $src 1:战斗奖励, 2: 任务奖励, 3: 抽奖奖品, 4: 邮件领取, 5: 现金充值, 6: 活动领取
// * @deprecated since version 0
// * @return type
// */
// public static function AddMultiItemInStore($goodsStr, $src = 1, $mask = 0) {
// $user = ctx();
// $ary = explode(";", $goodsStr);
// //$unlockNum = $user->privateState->expandNum * 5;
// //$n = self::countStoreNum();
// foreach ($ary as $value) {
// $val = explode(",", $value);
// $cid = "";
// my_Assert(count($val) > 1, "解析奖励字符串出错");
//
// list( $itemId, $num) = $val; # ID, 数量
// $smItem = GameConfig::item_base_getItem($itemId); # 道具mo
// switch ($smItem->subType) { # 根据类型分别添加到容器中
// case META_EXP: # 指挥官经验
//// Data_UserGame::Add_Exp($user->baseInfo, $num);
// $user->base()->Add_Exp($num); # 加指挥官经验
// break;
// case META_GOLD_ITEMID: # 金币
//// Data_UserGame::Add_Gold($user->baseInfo, $num);
// $user->base()->Add_Gold($num, $mask); # 增加金币
// break;
// case META_CASH_ITEMID: # 钻石
//// Data_UserGame::Add_Cash($user->baseInfo, $num);
// $user->base()->Add_Cash($num, $mask); # 增加钻石
// break;
// case META_tili_ITEMID: # 体力
//// Data_UserGame::Add_tili($num);
// $user->base()->Add_tili($num); # 增加体力
// break;
// case META_FriendShipPoit_ItemId: # 友情值
//// Data_UserGame::Add_FriendPoint($user->baseInfo, $num);
// $user->base()->Add_FriendPoint($num); # 加友情点
// break;
// case META_PVPCOIN_ITEMID: # 竞技币
// $user->pvp->pvpCoins += $num;
// break;
// case META_ActivePoint_ITEMID:
//// $user->task->dailyActivePoint += $num; # 每日任务活跃点
// break;
// case META_RESPOINT_ITEMID:
// $user->base()->Add_resPoint($num); # 增加资源点
//// Data_UserGame::Add_resPoint($user->baseInfo, $num); # 资源点添加
// break;
// case 101: # 武器
// for ($n = 0; $n < $num; $n++) {
// $cid = StoreProc::PutEquipInStore($itemId);
// }
// CornerSignEventProc::OnBag_new_Weapon();
// CornerSignEventProc::OnRoleWeapon();
// break;
// case 401: # 言灵
// for ($n = 0; $n < $num; $n++) {
// $cid = StoreProc::PutYanLingInStore($itemId);
// }
// CornerSignEventProc::OnBag_new_Yanling();
// CornerSignEventProc::OnRoleYanling();
// break;
// case 501: # 限购礼包
// $itemMO = GameConfig::item_package_getItem($itemId);
// my_Assert(null != $itemMO, ErrCode::err_const_no);
// $err = StoreProc::AddMultiItemInStore($itemMO->contents); # 发放奖励
// my_Assert(ErrCode::ok == $err, $err);
// break;
// case 601: # 任务卡
// $cid = StoreProc::PutTaskCardInStore($itemId);
// CornerSignEventProc::OnBag_new_TaskCard();
// break;
// case 201: # 碎片
// $segMo = GameConfig::item_segment_getItem($itemId);
// my_Assert($segMo != null, ErrCode::err_const_no);
// TaskProc::OnHeroSegmengNum($segMo->protoHeroID, $num);
// CornerSignEventProc::OnBag_new_Fragment();
// StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
// break;
// case 202: # 召唤书碎片
// case 351: # 言灵召唤书
// StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
//// $book = GameConfig::item_yanlingbook_getItem($itemId);
//// my_Assert(null != $book, ErrCode::err_const_no);
//// $ylCfg = GameConfig::item_yanling_getItem($book->yanling_id);
//// my_Assert(null != $ylCfg, ErrCode::err_const_no);
//// switch ($ylCfg->career) { # 根据不同职业更新角标系统
//// case 1:
//// CornerSignEventProc::OnCall_Warrior_new(); # 战士
//// break;
//// case 2:
//// CornerSignEventProc::OnCall_Magician_new(); # 法师
//// break;
//// case 3:
//// CornerSignEventProc::OnCall_Archer_new(); # 射手
//// break;
//// default :
//// break;
//// }
// break;
// case 321: # 进阶材料
// case 322: # 进阶材料
// case 323: # 锻造材料
// case 324: # 魂器
//
// case 325: #元素突破材料
// case 326: #职业突破材料
// case 327: #言灵的突破石
// case 328: #言灵的突破材料
// case 329: #武器的突破石
// case 330: #武器的突破材料
// //
// case 701: #宝石
// case 702: #设计图纸
// case 703: #宝石辅助材料
// StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
// CornerSignEventProc::OnBag_new_Material();
// break;
//
// case 332: #普通祈愿券
// case 333: #活动祈愿券
// // 补给品
// case 341: # 血瓶
// case 342: # 能量瓶
// case 343: #
// case 344: # 回城券 -2022.4.13 海哥
// case 303: # 体力药水 - 2023.3.15 海哥
// StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
// CornerSignEventProc::OnBag_new_Consume();
// break;
// case 311: # 基因(经验丹)
// case 312: # 强化道具
// case 313:
// StoreProc::PutOverlyingItemInStore($itemId, $num); # 直接进包裹items
// break;
// case 801:
// case 802:
// //头像款,不入背包。直接解锁
// self::HeadImgFrameUnLock($itemId, $num);
// break;
//
// default :
// Err(ErrCode::err_innerfault, "落入包裹时,出现了非法物品($itemId)");
// }
// TaskProc::OnGainItem($itemId, $num); // 检查获得道具的任务进度
// NormalEventProc::OnBag_new_Item($itemId, $num, $cid);
// }
// return ErrCode::ok; // 返回
// }
//
// public static function HeadImgFrameUnLock($itemId, $num) {
// if(!StlUtil::dictHasProperty(ctx()->baseInfo,'headImgFrameList')){
// ctx()->base(true)->headImgFrameList = array();
// }
// $list = ctx()->base(true)->headImgFrameList;
// if(!in_array($itemId,$list)){
// $list[] = $itemId;
// }
// ctx()->base(true)->headImgFrameList = $list;
// }
//
// public static function countStoreNum() {
// $user = ctx();
// //$num = 0;
// $itemDic = $user->store->items;
// //$num += count((array)$user->store->items);
// $itemNum = 0;
// foreach ($itemDic as $key => $num) {
// if ($num == 0) {
// continue;
// }
//
// if ($num > 99999) {
// $itemNum += 2;
// } else {
// $itemNum += 1;
// }
// }
//
// //var_dump($num);
// //var_dump('-----------------');
//
// $itemNum += count((array) $user->store->equipment);
// //var_dump($num);
// //var_dump('-----------------');
// $itemNum += count((array) $user->store->yanling);
// //var_dump($itemNum);
// return $itemNum;
// }
//
// /**
// * [6401]向包裹中添加物品
// */
// public static function AddItemInStore() {
// list($rwdStr, $mask) = req()->paras; //mask = 1:表示战斗中掉落
// $user = ctx();
//
// if ($mask == 1) {
// $err = self::AddMultiItemInStore($rwdStr, 1, 1);
// } else {
// $err = self::AddMultiItemInStore($rwdStr);
// }
//
// my_Assert(ErrCode::ok == $err, $err);
// UserProc::updateUserInfo();
// return Resp::ok(array(
// 'gold' => $user->baseInfo->gold,
// 'tili' => $user->baseInfo->tili,
// 'cash' => $user->baseInfo->cash,
// 'resPoint' => $user->baseInfo->resPoint,
// 'store' => $user->store));
// }
//
// /**
// * 将装备放入背包
// * @param type $itemId
// */
// static function PutEquipInStore($itemId) {
// $privateState = ctx()->privateState;
// $unlockNum = $privateState->expandNum * 5;
// //var_dump("wuqi==============");
// $n = self::countStoreNum();
// $initNum = GameConfig::globalsettings()->Item_Packet_InitNum_New;
// my_Assert($n < $unlockNum + $initNum, ErrCode::store_bagSpaceNotEnough);
//
// if (!CommUtil::isPropertyExists($privateState, "currentId")) { // 如果仓库中已经有这种元素,则其数目+1
// ctx()->privateState->currentId = 1;
// }
// $cid = ctx()->privateState->currentId++;
// //$equip = ObjectInit();
// $equip = new Ins_Weapon();
// $equip->typeId = $itemId;
// ctx()->store->equipment->$cid = $equip;
//
// ctx()->store->weaponRecord[] = $cid;
//
// SystemProc::GetSpecialQualityWeapon(req()->zoneid, ctx()->baseInfo->name, $itemId);
// //StatisticsProc::TargetStatistics(Enum_TargetStatistics::WeaponId_UserNum, $itemId);
// //StatisticsProc::TargetStatistics(Enum_TargetStatistics::WeaponIdLevel_UserNum, $itemId, "1");
// return $cid;
//// SystemProc::GetEquip($req->zoneid, $req->userInfo->game, $itemId); # 添加获得装备的消息
// }
//
// /**
// * 将言灵放入背包
// * @param type $itemId
// */
// static function PutYanLingInStore($itemId) {
// //my_Assert(count((array) ctx()->store->yanling) < 100, ErrCode::store_yanling_bagfull);
// $privateState = ctx()->privateState;
// $unlockNum = $privateState->expandNum * 5;
// //var_dump("yanling==============");
// $n = self::countStoreNum();
// $initNum = GameConfig::globalsettings()->Item_Packet_InitNum_New;
// my_Assert($n < $unlockNum + $initNum, ErrCode::store_bagSpaceNotEnough);
//
// if (!CommUtil::isPropertyExists($privateState, "currentId")) { # 如果仓库中已经有这种元素,则其数目+1
// ctx()->privateState->currentId = 1;
// }
// $cid = ctx()->privateState->currentId++;
// //$equip = ObjectInit();
// $equip = new Ins_YanLin();
// $equip->typeId = $itemId;
// $equip->quality = GameConfig::item_base_getItem($itemId)->quality; //品阶初始化
// ctx()->store->yanling->$cid = $equip;
//
// ctx()->store->yanlingRecord[] = $cid;
//
// TaskProc::autoRecoverStateMissions(); # 重新更新其它状态类的任务卡
// TaskProc::autoRecoverTaskTracingState(); # 更新任务追踪.
//
// SystemProc::GetSpecialQualityYanling(req()->zoneid, ctx()->baseInfo->name, $itemId);
// SystemProc::GetSpecialNumYanling(req()->zoneid, ctx()->baseInfo->name);
// StatisticsProc::TargetStatistics(Enum_TargetStatistics::YanLingId_UserNum, $itemId);
// StatisticsProc::TargetStatistics(Enum_TargetStatistics::YanLingIdLevel_UserNum, $itemId, "1");
// return $cid;
// }
//
// /**
// * 将任务卡放入背包
// * @param type $itemId
// */
// static function PutTaskCardInStore($itemId) {
// $privateState = ctx()->privateState;
// $unlockNum = $privateState->expandNum * 5;
// //var_dump("task==============");
// //$n = self::countStoreNum();
// //my_Assert($n<$unlockNum+50, ErrCode::store_StorageEnough);
//
// if (!CommUtil::isPropertyExists($privateState, "currentId")) { # 如果仓库中已经有这种元素,则其数目+1
// ctx()->privateState->currentId = 1;
// }
// $cid = ctx()->privateState->currentId++;
// $mo = GameConfig::item_taskcard_getItem($itemId); # 任务卡常量
//// var_dump($mo);
// my_Assert(null != $mo, ErrCode::err_const_no);
// $itembaseMo = GameConfig::item_base_getItem($itemId);
// my_Assert(null != $itembaseMo, ErrCode::err_const_no);
// if ($itembaseMo->pileNum > 0) { # 可叠加
// Err(ErrCode::taskCard_no_pile); # 不可堆叠!!! 我支持不了.gwang 2020年12月12日13:40:04
// //
//// $taskCard = null;
//// foreach ($req->userInfo->game->store->taskcards as $uuid => &$val) {
//// $val = new Ins_TaskCard($val);
//// if ($val->typeId == $itemId) {
//// $taskCard = $val;
//// break;
//// }
//// }
//// if (null == $taskCard) { # 原来么有
//// $taskCard = new Ins_TaskCard($itemId);
//// $taskCard->uid = $cid;
//// $req->userInfo->game->store->taskcards->$cid = $taskCard;
//// }
//// $taskCard->count += 1;
// //
// } else {
// $taskCard = new Ins_TaskCard($itemId);
// $taskCard->uid = $cid;
// ctx()->store->taskcards->$cid = $taskCard;
// }
// NormalEventProc::OnTaskBag_new_Card($cid, 1); # 播放获得任务卡事件
// if (null != $taskCard) {
// $t = req()->paras;
// req()->paras = array($cid);
// TaskProc::OnTaskCard_active(); # 自动激活任务卡
// req()->paras = $t;
// }
// return $cid;
// }
//
// /**
// * 将可叠加物品放入背包
// * @param int $itemId
// * @param int $num
// */
// static function PutOverlyingItemInStore($itemId, $num = 1) {
// //var_dump("item==============".$itemId);
//
// $items = ctx()->store->items; # dic: itemid=>number
// if (CommUtil::isPropertyExists($items, $itemId)) { # 如果仓库中已经有这种元素,则其数目+=num
// $items->$itemId += $num;
// } else { # 如果仓库中没有这种元素,则其数目置为num
// $unlockNum = ctx()->privateState->expandNum * 5;
// $n = self::countStoreNum();
// $initNum = GameConfig::globalsettings()->Item_Packet_InitNum_New;
// my_Assert($n < $unlockNum + $initNum, ErrCode::store_bagSpaceNotEnough); # 没有的需要占用新的格子, 先判断下格子够不够用.
//
// $items->$itemId = $num;
// }
// if (!in_array($itemId, ctx()->store->itemRecord)) {
// ctx()->store->itemRecord[] = $itemId;
// }
//
// if (GameConfig::item_base_getItem($itemId)->subType == 341) {//血瓶
// foreach (ctx()->store->battleItem as $index => $val) {
// if ($val->id == $itemId) {
// ctx()->store->battleItem->$index->num = $items->$itemId;
// }
// }
// }
// }
//
// /**
// * 物品包裹打散成独立道具到仓库
// * @param GoodsItemModel $itemModel
// * @deprecated since version now
// */
// static function addSeprateItem($itemModel) {
// Err(ErrCode::err_method_obsoleted, "未更新包裹操作");
// }
//
// /**
// * [6416] 给英雄装上言灵
// */
// static function WearYanlingToHero() {
// $user = ctx(); # user引用
// list($itemtype, $yanling_uid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 英雄的UID
// my_Assert(CommUtil::isPropertyExists($user->store->yanling, $yanling_uid), ErrCode::store_itemno_err); # 检测是否存在该言灵
// $yanlingVo = new Ins_YanLin($user->store->yanling->$yanling_uid); # 取言灵对象
// if (isset($yanlingVo->herouid) && $yanlingVo->herouid > 0 #
// && $yanlingVo->herouid != $herouid) { # 检测该言灵是否装备到其他英雄身上
// Err(ErrCode::store_equipWeared_err);
// }
// $collectHeros = $user->heros->collectHeros; # 英雄集合
// my_Assert(null != $collectHeros, ErrCode::err_innerfault); # 防御对象为空
// my_Assert(CommUtil::isPropertyExists($collectHeros, $herouid), ErrCode::hero_no); # 检查英雄是否存在
//
// my_Assert($user->store->yanling->$yanling_uid->herouid == 0 || $user->store->yanling->$yanling_uid->herouid != $herouid, "该言灵不能重复装备");
// $hero = new Ins_UserHero($collectHeros->$herouid); # 取hero
// my_Assert($hero->level >= $yanlingVo->mo()->require_herolvl, "请提升唤灵师等级"); # 可装备的言灵等级受唤灵师等级限制.
// $user->store->yanling->$yanling_uid->herouid = $herouid; # 言灵上添加反向引用, 避免查询时的循环
// $oldYLid = $collectHeros->$herouid->yanling->$itemtype->itemuid; # 旧言灵id
// if ($oldYLid > 0) { # 代表替换操作
// $user->store->yanling->$oldYLid->herouid = 0; # 清理旧言灵的
// }
// $hero->yanling->$itemtype->itemuid = $yanling_uid; # 英雄身上添加言灵记录
// $collectHeros->$herouid = $hero;
// TaskProc::OnHeroWearYanling($collectHeros->$herouid->typeId, $user->store->yanling->$yanling_uid->typeId);
// UserProc::updateUserInfo(); # 5.回写数据
// $ret = array('resp' => "succeed!",
// 'store' => $user->store);
// $resp = Resp::ok($ret); // 返回
// HeroProc::CalcUserFightPower(req()->zoneid, req()->uid, $user); # 更新总战力榜
// return $resp;
// }
//
// /**
// * [6417] 给英雄卸下言灵
// * @deprecated since version 无法卸下,只能更换
// */
// static function UnWieldYanling() {
// $user = ctx(); # user引用
// list($itemtype, $yanling_uid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID
//
// $collectHeros = $user->heros->collectHeros;
// my_Assert(null != $collectHeros, ErrCode::err_innerfault); # 防御
// my_Assert(CommUtil::isPropertyExists($collectHeros, $herouid), ErrCode::hero_no); # 检测是否存在拥有该装备的英雄
// my_Assert(CommUtil::isPropertyExists($user->store->yanling, $yanling_uid), ErrCode::store_itemno_err); # 检测是否存在该装备
// if ($user->store->yanling->$yanling_uid->herouid == $herouid) { # 取装备对象
// $user->store->yanling->$yanling_uid->herouid = 0; # 清理反向引用
// }
//// $arr = $collectHeros->$herouid->yanling;
//// my_Assert(in_array($yanling_uid, $arr), ErrCode::hero_yanling_notfound); # 未装备此言灵
//// StlUtil::arrayRemove($arr, $yanling_uid);
//// $collectHeros->$herouid->yanling = $arr;
//
// my_Assert($collectHeros->$herouid->yanling->$itemtype->itemuid == $yanling_uid, ErrCode::store_noequip_err); # 防御
// $collectHeros->$herouid->yanling->$itemtype->itemuid = 0; # 卸下
//
// UserProc::updateUserInfo(); # 回写数据
// $resp = Resp::ok(array('resp' => "succeed!")); // 返回
//// StoreProc::CheckItemNum($req);
// return $resp;
// }
//
// /**
// * [6410] 给英雄穿装备
// */
// static function WearEquipToHero() {
// list($itemtype, $equipuid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 英雄的UID
// $user = ctx(); # user引用
// my_Assert(CommUtil::isPropertyExists($user->store->equipment, $equipuid), ErrCode::store_itemno_err); # 检测是否存在该装备
// $equipVo = new Ins_Weapon($user->store->equipment->$equipuid); # 取装备对象
// if ($equipVo->herouid > 0) { # 检测该装备是否装备到其他英雄身上
// my_Assert($equipVo->herouid == $herouid, ErrCode::store_equipWeared_err);
// $user->store->equipment->$equipuid->herouid = 0; # 清理原来已经装备的言灵的反指向
// }
// $collectHeros = $user->heros->collectHeros;
// my_default_Obj($collectHeros);
// my_Assert(CommUtil::isPropertyExists($collectHeros, $herouid), ErrCode::hero_no); # 检查是否存在需要装备的英雄
// $hero = new Ins_UserHero($collectHeros->$herouid); # 取hero
// my_Assert($hero->level >= $equipVo->mo()->require_herolvl, "请升级唤灵师."); # 检查武器要求的唤灵师等级, -gwang 2021.4.20
// $user->store->equipment->$equipuid->herouid = $herouid; # 装备上添加反向引用, 避免查询时的循环
// $oldEquipId = 0;
// switch ($itemtype) { # 添加或替换英雄该部位的装备
// case 1: # 武器
// $oldEquipId = $collectHeros->$herouid->equip->weapon->itemuid;
// $collectHeros->$herouid->equip->weapon->itemuid = $equipuid;
// break;
// case 2: # 防具
// $oldEquipId = $collectHeros->$herouid->equip->armor->itemuid;
// $collectHeros->$herouid->equip->armor->itemuid = $equipuid;
// break;
// case 3: # 饰品
// $oldEquipId = $collectHeros->$herouid->equip->ring->itemuid;
// $collectHeros->$herouid->equip->ring->itemuid = $equipuid;
// break;
// default :
// Err(ErrCode::store_equip_type);
// break;
// }
// if ($oldEquipId > 0 && $oldEquipId != $equipuid) {
// $user->store->equipment->$oldEquipId->herouid = 0;
// }
// UserProc::updateUserInfo(); // 5.回写数据
//// StoreProc::CheckItemNum($req);
// TaskProc::OnHeroWearWeapon($collectHeros->$herouid->typeId, $user->store->equipment->$equipuid->typeId);
// HeroProc::CalcUserFightPower(req()->zoneid, req()->uid, $user); # 更新总战力榜
// return Resp::ok(array('resp' => "succeed!",
// 'store' => $user->store)); // 返回
// }
//
// /**
// * [6411] 给英雄脱装备
// * @deprecated since version 不能卸下装备, 只能更换.
// */
// static function UnWieldEquip() {
// list($itemtype, $equipuid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID
// $user = ctx(); # user引用
//
// $collectHeros = $user->heros->collectHeros;
// my_default_Obj($collectHeros);
// my_Assert(CommUtil::isPropertyExists($collectHeros, $herouid), ErrCode::hero_no); # 检测是否存在拥有该装备的英雄
// my_Assert(CommUtil::isPropertyExists($user->store->equipment, $equipuid), ErrCode::store_itemno_err); # 检测是否存在该装备
// if ($user->store->equipment->$equipuid->herouid == $herouid) { # 取装备对象
// $user->store->equipment->$equipuid->herouid = 0;
// }
// switch ($itemtype) { # 检测该装备是否装备在该英雄身上
// case 1: # 武器
// if ($collectHeros->$herouid->equip->weapon->itemuid != $equipuid) {
// Err(ErrCode::store_noequip_err);
// }
// $collectHeros->$herouid->equip->weapon->itemuid = 0; # 卸下
// break;
// case 2: # 防具
// if ($collectHeros->$herouid->equip->armor->itemuid != $equipuid) {
// Err(ErrCode::store_noequip_err);
// }
// $collectHeros->$herouid->equip->armor->itemuid = 0;
// break;
// case 3: # 饰品
// if ($collectHeros->$herouid->equip->ring->itemuid != $equipuid) {
// Err(ErrCode::store_noequip_err);
// }
// $collectHeros->$herouid->equip->ring->itemuid = 0;
// break;
// default :
// Err(ErrCode::store_equip_type);
// }
// UserProc::updateUserInfo(); # 回写数据
// return Resp::ok(array('resp' => "succeed!")); // 返回
// }
//
////
////
////
////
//
// /**
// * 检查背包中物品的个数
// * @return int
// */
// public static function CheckItemNum() {
// $ItemObj = ctx()->store->items;
// $EquipObj = ctx()->store->equipment;
// $SegementObj = ctx()->store->segement;
// $HeroObj = ctx()->heros->collectHeros;
// $ItemNum = 0;
// if ($ItemObj) {
// foreach ($ItemObj as $value) { ////检查宝石类可叠加物品的格子占用
// $ItemNum++;
// }
// }
// if ($SegementObj) {
// foreach ($SegementObj as $value) { # 碎片
// $ItemNum++;
// }
// }
// if ($EquipObj) {
// foreach ($EquipObj as $value) { // 检测装备类物品格子占用
// $ItemNum++;
// }
// }
// if ($HeroObj) {
// foreach ($HeroObj as $value) { // 检测英雄装备到身上的情况,装备到英雄身上不占格子,要减去.
// $HeroEquipId = $value->equip->weapon->itemuid;
// if ($HeroEquipId > 0) {
// $ItemNum--;
// }
// $HeroEquipId = $value->equip->armor->itemuid;
// if ($HeroEquipId > 0) {
// $ItemNum--;
// }
// $HeroEquipId = $value->equip->ring->itemuid;
// if ($HeroEquipId > 0) {
// $ItemNum--;
// }
// }
// }
// ctx()->privateState->ItemNum = $ItemNum;
// return $ItemNum;
// }
//
// /**
// * 获取物品格子的上限值---废弃了
// * @return int 上限数值
// */
//// public static function GetItemMaxNum() {
//// $user = ctx();
//// if (!CommUtil::isPropertyExists($user->privateState, "maxItemNum")) {
//// $user->privateState->maxItemNum = glc()->Item_Packet_MaxNum;
//// }
//// return $user->privateState->maxItemNum;
//// }
//
// /**
// * 6412 背包扩容
// */
// public static function AddPacketNum() {
// $user = ctx(); # user引用
// if (!CommUtil::isPropertyExists($user->privateState, "maxItemNum")) {
// $user->privateState->maxItemNum = glc()->Item_Packet_MaxNum;
// }
// $costCash = glc()->Item_Packet_NumCostCash; # 钻石花费
// my_Assert($costCash > 0, ErrCode::paras_err);
// my_Assert($user->base()->Consume_Cash($costCash), ErrCode::notenough_cash_msg); # 6.进行消耗
//
// $user->privateState->maxItemNum += 10; # 扩容
// UserProc::updateUserInfo(); # 保存玩家数据
// $resp = Resp::ok(array('maxItemNum' => $user->privateState->maxItemNum)); # 返回值
// StoreProc::CheckItemNum();
// return $resp;
// }
//
////
////
////
////
//
// /**
// * 出售单一的物品
// */
// static function sellItem() {
// Err(ErrCode::err_method_obsoleted, "代码需要更新");
// }
//
// /**
// * 卖出一堆物品时候,检测每个单个物品是否符合卖的条件
// */
// static function preSellSingleFromStore($type, $itemId, $count, $uid) {
// Err(ErrCode::err_method_obsoleted, "代码需要更新");
// }
//
// /**
// * 6403 从背包出售多个物品
// */
// static function sellMultiItemFromStore() {
// Err(ErrCode::err_method_obsoleted, "代码需要更新");
// $obj = req()->paras[0]; // 获取物品的结构数组
// foreach ($obj as $value) {
// $type = $value[0];
// $itemId = $value[1];
//
// if ($type > 3) {
// $count = intval($value[2]); // 数量
// $uid = 0;
// } else { ////先判断一下物品类型,如果是可叠加的,就按数量取值,如果是不可叠加的就按uid取值
// $count = 1;
// $uid = $value[2];
// }//物品的uid
// $resp = StoreProc:: preSellSingleFromStore($type, $itemId, $count, $uid);
// }
//
// if (0 == $resp->err) {
// UserProc::updateUserInfo();
// }
//
// StoreProc::CheckItemNum();
// return $resp;
// }
//
////
////
//}