|
@@ -106,7 +106,7 @@ class StoreProc {
|
|
|
$npcid = req()->paras[0]; # 提取参数
|
|
|
$weaponId = req()->paras[1]; # 提取参数
|
|
|
|
|
|
- $store = req()->userInfo->game->store(true);
|
|
|
+ $store = ctx()->store(true);
|
|
|
$type = 0;
|
|
|
|
|
|
$tag = true;
|
|
@@ -138,11 +138,11 @@ class StoreProc {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- req()->userInfo->game->base(true)->Consume_Gold($cost);
|
|
|
+ ctx()->base(true)->Consume_Gold($cost);
|
|
|
|
|
|
$store->weaponReward->$npcid->$type[] = $weaponId;
|
|
|
|
|
|
-// req()->userInfo->game->store = $store;
|
|
|
+// ctx()->store = $store;
|
|
|
|
|
|
UserProc::updateUserInfo();
|
|
|
return Resp::ok();
|
|
@@ -153,7 +153,7 @@ class StoreProc {
|
|
|
*/
|
|
|
public static function DailyRefreshWeapon($npcid = null) {
|
|
|
//没有数据初始化,有数据不在管
|
|
|
- if($npcid != null && !StlUtil::dictHasProperty(req()->userInfo->game->store()->weaponPool, $npcid)){
|
|
|
+ if($npcid != null && !StlUtil::dictHasProperty(ctx()->store()->weaponPool, $npcid)){
|
|
|
$ret = new \stdClass();
|
|
|
$list = GameConfig::shop_weapon_getItemArray($npcid);
|
|
|
|
|
@@ -170,12 +170,12 @@ class StoreProc {
|
|
|
$pArr = self::randweapon($ret, $value->num);
|
|
|
//数组合并
|
|
|
$retArr = array_merge($retArr, $pArr);
|
|
|
- req()->userInfo->game->store()->weaponPool->$npcid->$type = $retArr;
|
|
|
+ ctx()->store()->weaponPool->$npcid->$type = $retArr;
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
//每日登录刷新,刷新的时候把已经购买过的武器去掉;
|
|
|
- $dic = req()->userInfo->game->store()->weaponPool;
|
|
|
+ $dic = ctx()->store()->weaponPool;
|
|
|
foreach ($dic as $npcid => $val) {
|
|
|
$list = GameConfig::shop_weapon_getItemArray($npcid);
|
|
|
foreach ($list as $value) {
|
|
@@ -190,8 +190,8 @@ class StoreProc {
|
|
|
|
|
|
$ret2 = $ret;
|
|
|
$type = $value->id;
|
|
|
- if(StlUtil::dictHasProperty(req()->userInfo->game->store()->weaponReward, $npcid)){
|
|
|
- $weaponList = req()->userInfo->game->store()->weaponReward->$npcid->$type;
|
|
|
+ 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);
|
|
@@ -202,14 +202,14 @@ class StoreProc {
|
|
|
$temp = $ret;
|
|
|
if(count((array)$ret)< $value->num){//一旦所有的武器或是不够刷新数量了,重置当前档位
|
|
|
$temp = $ret2;
|
|
|
- req()->userInfo->game->store()->weaponReward->$npcid->$type = array();
|
|
|
+ ctx()->store()->weaponReward->$npcid->$type = array();
|
|
|
}
|
|
|
$retArr= array();
|
|
|
|
|
|
$pArr = self::randweapon($temp, $value->num);
|
|
|
|
|
|
$retArr = array_merge($retArr, $pArr);
|
|
|
- req()->userInfo->game->store()->weaponPool->$npcid->$type = $retArr;
|
|
|
+ ctx()->store()->weaponPool->$npcid->$type = $retArr;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -254,7 +254,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function unlockStore() {
|
|
|
//list() = req()->paras;
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
|
|
|
$mo = GameConfig::expandStoreNum_getItem($user->privateState->expandNum + 1);
|
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
@@ -262,7 +262,7 @@ class StoreProc {
|
|
|
|
|
|
$user->base(true)->Consume_Gold($mo->cost);
|
|
|
$user->privateState->expandNum += 1;
|
|
|
- req()->userInfo->game = $user;
|
|
|
+ ctx($user);
|
|
|
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
@@ -276,7 +276,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function GemSetYanLing() {
|
|
|
list($gemId, $yanlingUid) = req()->paras;
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
|
|
|
$yanling = $user->store->yanling;
|
|
|
my_Assert(CommUtil::isPropertyExists($yanling, $yanlingUid), ErrCode::hero_yanling_errorYanling);
|
|
@@ -292,7 +292,7 @@ class StoreProc {
|
|
|
$yanling->$yanlingUid->gemId = $gemId;
|
|
|
|
|
|
$user->store->yanling = $yanling;
|
|
|
- req()->userInfo->game = $user;
|
|
|
+ ctx($user);
|
|
|
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
@@ -305,7 +305,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function GemRemoveYanLing() {
|
|
|
list($yanlingUid) = req()->paras;
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
my_Assert(CommUtil::isPropertyExists($user->store->yanling, $yanlingUid), ErrCode::hero_yanling_errorYanling);
|
|
|
$gemId = $user->store->yanling->$yanlingUid->gemId;
|
|
|
|
|
@@ -315,7 +315,7 @@ class StoreProc {
|
|
|
StoreProc::AddMultiItemInStore($goodsStr);
|
|
|
$user->store->yanling->$yanlingUid->gemId = 0;
|
|
|
|
|
|
- req()->userInfo->game = $user;
|
|
|
+ ctx($user);
|
|
|
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
@@ -328,7 +328,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function GemComposeItem() {
|
|
|
list($gemId, $num) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
//my_Assert(CommUtil::isPropertyExists($myPacketItems, $costItemId), ErrCode::store_itemnotenough); #
|
|
|
|
|
|
$mo = GameConfig::gem_formula_getItem($gemId);
|
|
@@ -359,7 +359,7 @@ class StoreProc {
|
|
|
StoreProc::removeItemFromStore($user->store, $gList[0], $gList[1]);
|
|
|
$goodsStr = $gemId . ',1';
|
|
|
StoreProc::AddMultiItemInStore($goodsStr);
|
|
|
- req()->userInfo->game = $user;
|
|
|
+ ctx($user);
|
|
|
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
@@ -373,7 +373,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function GemResearchLvUp() {
|
|
|
//list() = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
$researchLevel = $user->Gem->level; //研究等级
|
|
|
|
|
|
$mo = GameConfig::gem_researchlevel_getItem($researchLevel + 1);
|
|
@@ -386,7 +386,7 @@ class StoreProc {
|
|
|
|
|
|
$user->base(true)->Consume_Gold($mo->unlockLevelGoldCost);
|
|
|
$user->Gem->level += 1;
|
|
|
- req()->userInfo->game = $user;
|
|
|
+ ctx($user);
|
|
|
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
@@ -400,7 +400,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function weaponUpgrade() {
|
|
|
list($uid, $wuqiList, $items) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
$equipment = $user->store->equipment;
|
|
|
|
|
|
my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
|
|
@@ -451,8 +451,8 @@ class StoreProc {
|
|
|
|
|
|
UserProc::CollectUserBaseParam(req()->cmd, 2, $user->baseInfo->gold, $totalGold, $user->baseInfo->gold - $totalGold, "");
|
|
|
$user->baseInfo->gold -= $totalGold;
|
|
|
- req()->userInfo->game = $user;
|
|
|
- req()->userInfo->game->store->items = $myPacketItems; # 更新背包数据
|
|
|
+ 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);
|
|
@@ -501,7 +501,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function weaponTupo() {
|
|
|
list($uid) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
$equipment = $user->store->equipment;
|
|
|
my_Assert(CommUtil::isPropertyExists($equipment, $uid), ErrCode::store_weapon_err); # 玩家拥有此英雄
|
|
|
|
|
@@ -533,7 +533,7 @@ class StoreProc {
|
|
|
TaskProc::OnWeaponStarUp($equipment->$uid->starLevel);
|
|
|
|
|
|
$user->store->equipment = $equipment;
|
|
|
- req()->userInfo->game = $user;
|
|
|
+ ctx($user);
|
|
|
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
@@ -548,7 +548,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function weaponReplace() {
|
|
|
list($uid, $replaceId) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
$equipment = $user->store->equipment;
|
|
|
my_Assert(property_exists($equipment, $uid), "找不到这个言灵");
|
|
|
my_Assert(property_exists($equipment, $replaceId), "找不到这个言灵");
|
|
@@ -558,7 +558,7 @@ class StoreProc {
|
|
|
$equipment->$replaceId->herouid = $herouid;
|
|
|
$equipment->$uid->herouid = $herouid_replace;
|
|
|
$user->store->equipment = $equipment;
|
|
|
- req()->userInfo->game = $user;
|
|
|
+ ctx($user);
|
|
|
|
|
|
UserProc::updateUserInfo(); # 回写玩家数据
|
|
|
return Resp::ok(array(
|
|
@@ -571,7 +571,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function YanlingUpgrade() {
|
|
|
list($yanlingUid) = req()->paras; # 参数 言灵uid(指定进阶的言灵实例id)
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
my_Assert(property_exists($user->store->yanling, $yanlingUid), "找不到这个言灵");
|
|
|
$yanlingObj = $user->store->yanling->$yanlingUid;
|
|
|
$yanlingMoId = $yanlingObj->typeId;
|
|
@@ -600,7 +600,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function MergeYanlingBook() {
|
|
|
list($bookId) = req()->paras; # 参数 言灵召唤书id
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
$bookIdCfg = GameConfig::item_yanlingbook_getItem($bookId);
|
|
|
my_Assert(null != $bookIdCfg, ErrCode::err_const_no); # 找不到言灵书常量
|
|
|
list($segId, $num) = explode(',', $bookIdCfg->seg_num); # 解析所需碎片信息
|
|
@@ -618,7 +618,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function CallYanlingByBook() {
|
|
|
list($bookId) = req()->paras; # 参数 利用的言灵召唤书id
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
$bookIdCfg = GameConfig::item_yanlingbook_getItem($bookId);
|
|
|
my_Assert(null != $bookIdCfg, ErrCode::err_const_no); # 找不到言灵书常量
|
|
|
$err = self::removeItemFromStore($user->store, $bookId); # 扣除 召唤书
|
|
@@ -655,19 +655,19 @@ class StoreProc {
|
|
|
switch ($mo->subType) {
|
|
|
case 601: # 任务卡
|
|
|
my_Assert($num == 1, "任务卡一次只能使用一张!");
|
|
|
- $store = req()->userInfo->game->store();
|
|
|
+ $store = ctx()->store();
|
|
|
$err = $store->RemoveItemFromStore($itemType, $num); # 扣除任务卡
|
|
|
my_Assert(ErrCode::ok == $err, $err);
|
|
|
StoreProc::PutTaskCardInStore($itemType);
|
|
|
- req()->userInfo->game->store = $store;
|
|
|
+ ctx()->store = $store;
|
|
|
break;
|
|
|
default :
|
|
|
break;
|
|
|
}
|
|
|
UserProc::updateUserInfo();
|
|
|
return Resp::ok(array(
|
|
|
- 'priv' => req()->userInfo->game->privateState,
|
|
|
- 'store' => req()->userInfo->game->store));
|
|
|
+ 'priv' => ctx()->privateState,
|
|
|
+ 'store' => ctx()->store));
|
|
|
|
|
|
// Err(ErrCode::msg_method_obsoleted, "代码需更新");
|
|
|
}
|
|
@@ -677,7 +677,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function refreshStore() {
|
|
|
StoreProc::CheckItemNum();
|
|
|
- return Resp::ok(array('store' => req()->userInfo->game->store));
|
|
|
+ return Resp::ok(array('store' => ctx()->store));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -685,10 +685,10 @@ class StoreProc {
|
|
|
*/
|
|
|
static function delItemFromStore() {
|
|
|
list($itemId, $num) = req()->paras;
|
|
|
- $err = self::removeItemFromStore(req()->userInfo->game->store, $itemId, $num);
|
|
|
+ $err = self::removeItemFromStore(ctx()->store, $itemId, $num);
|
|
|
my_Assert(ErrCode::ok == $err, $err);
|
|
|
UserProc::updateUserInfo();
|
|
|
- return Resp::ok(array('store' => req()->userInfo->game->store));
|
|
|
+ return Resp::ok(array('store' => ctx()->store));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -736,9 +736,9 @@ class StoreProc {
|
|
|
*/
|
|
|
static function removeEquipFromStore($uid, $typeId) {
|
|
|
$ok = false;
|
|
|
- if (CommUtil::isPropertyExists(req()->userInfo->game->store->equipment, $uid)) {
|
|
|
- my_Assert($typeId == req()->userInfo->game->store->equipment->$uid->typeId, "typeid检验错误"); // typeid相同;
|
|
|
- unset(req()->userInfo->game->store->equipment->$uid);
|
|
|
+ if (CommUtil::isPropertyExists(ctx()->store->equipment, $uid)) {
|
|
|
+ my_Assert($typeId == ctx()->store->equipment->$uid->typeId, "typeid检验错误"); // typeid相同;
|
|
|
+ unset(ctx()->store->equipment->$uid);
|
|
|
$ok = true;
|
|
|
}
|
|
|
return $ok;
|
|
@@ -803,7 +803,7 @@ class StoreProc {
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function AddMultiItemInStore($goodsStr, $src = 1, $mask = 0) {
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
$ary = explode(";", $goodsStr);
|
|
|
//$unlockNum = $user->privateState->expandNum * 5;
|
|
|
//$n = self::countStoreNum();
|
|
@@ -934,7 +934,7 @@ class StoreProc {
|
|
|
}
|
|
|
|
|
|
public static function countStoreNum() {
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
//$num = 0;
|
|
|
$itemDic = $user->store->items;
|
|
|
//$num += count((array)$user->store->items);
|
|
@@ -967,7 +967,7 @@ class StoreProc {
|
|
|
*/
|
|
|
public static function AddItemInStore() {
|
|
|
list($rwdStr, $mask) = req()->paras; //mask = 1:表示战斗中掉落
|
|
|
- $user = req()->userInfo->game;
|
|
|
+ $user = ctx();
|
|
|
|
|
|
if ($mask == 1) {
|
|
|
$err = self::AddMultiItemInStore($rwdStr, 1, 1);
|
|
@@ -990,7 +990,7 @@ class StoreProc {
|
|
|
* @param type $itemId
|
|
|
*/
|
|
|
static function PutEquipInStore($itemId) {
|
|
|
- $privateState = req()->userInfo->game->privateState;
|
|
|
+ $privateState = ctx()->privateState;
|
|
|
$unlockNum = $privateState->expandNum * 5;
|
|
|
//var_dump("wuqi==============");
|
|
|
$n = self::countStoreNum();
|
|
@@ -998,13 +998,13 @@ class StoreProc {
|
|
|
my_Assert($n < $unlockNum + $initNum, "背包容量不够请扩容");
|
|
|
|
|
|
if (!CommUtil::isPropertyExists($privateState, "currentId")) { // 如果仓库中已经有这种元素,则其数目+1
|
|
|
- req()->userInfo->game->privateState->currentId = 1;
|
|
|
+ ctx()->privateState->currentId = 1;
|
|
|
}
|
|
|
- $cid = req()->userInfo->game->privateState->currentId++;
|
|
|
+ $cid = ctx()->privateState->currentId++;
|
|
|
//$equip = ObjectInit();
|
|
|
$equip = new Ins_Weapon();
|
|
|
$equip->typeId = $itemId;
|
|
|
- req()->userInfo->game->store->equipment->$cid = $equip;
|
|
|
+ ctx()->store->equipment->$cid = $equip;
|
|
|
|
|
|
StatisticsProc::TargetStatistics(Enum_TargetStatistics::WeaponId_UserNum, $itemId);
|
|
|
StatisticsProc::TargetStatistics(Enum_TargetStatistics::WeaponIdLevel_UserNum, $itemId, "1");
|
|
@@ -1017,8 +1017,8 @@ class StoreProc {
|
|
|
* @param type $itemId
|
|
|
*/
|
|
|
static function PutYanLingInStore($itemId) {
|
|
|
- //my_Assert(count((array) req()->userInfo->game->store->yanling) < 100, ErrCode::store_yanling_bagfull);
|
|
|
- $privateState = req()->userInfo->game->privateState;
|
|
|
+ //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();
|
|
@@ -1026,13 +1026,13 @@ class StoreProc {
|
|
|
my_Assert($n < $unlockNum + $initNum, "背包容量不够请扩容");
|
|
|
|
|
|
if (!CommUtil::isPropertyExists($privateState, "currentId")) { # 如果仓库中已经有这种元素,则其数目+1
|
|
|
- req()->userInfo->game->privateState->currentId = 1;
|
|
|
+ ctx()->privateState->currentId = 1;
|
|
|
}
|
|
|
- $cid = req()->userInfo->game->privateState->currentId++;
|
|
|
+ $cid = ctx()->privateState->currentId++;
|
|
|
//$equip = ObjectInit();
|
|
|
$equip = new Ins_YanLin();
|
|
|
$equip->typeId = $itemId;
|
|
|
- req()->userInfo->game->store->yanling->$cid = $equip;
|
|
|
+ ctx()->store->yanling->$cid = $equip;
|
|
|
|
|
|
StatisticsProc::TargetStatistics(Enum_TargetStatistics::YanLingId_UserNum, $itemId);
|
|
|
StatisticsProc::TargetStatistics(Enum_TargetStatistics::YanLingIdLevel_UserNum, $itemId, "1");
|
|
@@ -1044,16 +1044,16 @@ class StoreProc {
|
|
|
* @param type $itemId
|
|
|
*/
|
|
|
static function PutTaskCardInStore($itemId) {
|
|
|
- $privateState = req()->userInfo->game->privateState;
|
|
|
+ $privateState = ctx()->privateState;
|
|
|
$unlockNum = $privateState->expandNum * 5;
|
|
|
//var_dump("task==============");
|
|
|
//$n = self::countStoreNum();
|
|
|
//my_Assert($n<$unlockNum+50, "背包容量不够请扩容");
|
|
|
|
|
|
if (!CommUtil::isPropertyExists($privateState, "currentId")) { # 如果仓库中已经有这种元素,则其数目+1
|
|
|
- req()->userInfo->game->privateState->currentId = 1;
|
|
|
+ ctx()->privateState->currentId = 1;
|
|
|
}
|
|
|
- $cid = req()->userInfo->game->privateState->currentId++;
|
|
|
+ $cid = ctx()->privateState->currentId++;
|
|
|
$mo = GameConfig::item_taskcard_getItem($itemId); # 任务卡常量
|
|
|
// var_dump($mo);
|
|
|
my_Assert(null != $mo, ErrCode::err_const_no);
|
|
@@ -1080,7 +1080,7 @@ class StoreProc {
|
|
|
} else {
|
|
|
$taskCard = new Ins_TaskCard($itemId);
|
|
|
$taskCard->uid = $cid;
|
|
|
- req()->userInfo->game->store->taskcards->$cid = $taskCard;
|
|
|
+ ctx()->store->taskcards->$cid = $taskCard;
|
|
|
}
|
|
|
NormalEventProc::OnTaskBag_new_Card($cid, 1); # 播放获得任务卡事件
|
|
|
if (null != $taskCard) {
|
|
@@ -1097,12 +1097,12 @@ class StoreProc {
|
|
|
*/
|
|
|
static function PutOverlyingItemInStore($itemId, $num = 1) {
|
|
|
//var_dump("item==============".$itemId);
|
|
|
- $unlockNum = req()->userInfo->game->privateState->expandNum * 5;
|
|
|
+ $unlockNum = ctx()->privateState->expandNum * 5;
|
|
|
$n = self::countStoreNum();
|
|
|
$initNum = GameConfig::globalsettings()->Item_Packet_InitNum_New;
|
|
|
my_Assert($n < $unlockNum + $initNum, "背包容量不够请扩容");
|
|
|
|
|
|
- $items = req()->userInfo->game->store->items; # dic: itemid=>number
|
|
|
+ $items = ctx()->store->items; # dic: itemid=>number
|
|
|
if (CommUtil::isPropertyExists($items, $itemId)) { # 如果仓库中已经有这种元素,则其数目+=num
|
|
|
$items->$itemId += $num;
|
|
|
} else { # 如果仓库中没有这种元素,则其数目置为num
|
|
@@ -1123,7 +1123,7 @@ class StoreProc {
|
|
|
* [6416] 给英雄装上言灵
|
|
|
*/
|
|
|
static function WearYanlingToHero() {
|
|
|
- $user = req()->userInfo->game; # user引用
|
|
|
+ $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); # 取言灵对象
|
|
@@ -1157,7 +1157,7 @@ class StoreProc {
|
|
|
* @deprecated since version 无法卸下,只能更换
|
|
|
*/
|
|
|
static function UnWieldYanling() {
|
|
|
- $user = req()->userInfo->game; # user引用
|
|
|
+ $user = ctx(); # user引用
|
|
|
list($itemtype, $yanling_uid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID
|
|
|
|
|
|
$collectHeros = $user->heros->collectHeros;
|
|
@@ -1186,7 +1186,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function WearEquipToHero() {
|
|
|
list($itemtype, $equipuid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 英雄的UID
|
|
|
- $user = req()->userInfo->game; # user引用
|
|
|
+ $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) { # 检测该装备是否装备到其他英雄身上
|
|
@@ -1234,7 +1234,7 @@ class StoreProc {
|
|
|
*/
|
|
|
static function UnWieldEquip() {
|
|
|
list($itemtype, $equipuid, $herouid) = req()->paras; # 提取参数: 装备类型, 装备的UID, 拥有该装备的英雄的UID
|
|
|
- $user = req()->userInfo->game; # user引用
|
|
|
+ $user = ctx(); # user引用
|
|
|
|
|
|
$collectHeros = $user->heros->collectHeros;
|
|
|
my_default_Obj($collectHeros);
|
|
@@ -1279,10 +1279,10 @@ class StoreProc {
|
|
|
* @return int
|
|
|
*/
|
|
|
public static function CheckItemNum() {
|
|
|
- $ItemObj = req()->userInfo->game->store->items;
|
|
|
- $EquipObj = req()->userInfo->game->store->equipment;
|
|
|
- $SegementObj = req()->userInfo->game->store->segement;
|
|
|
- $HeroObj = req()->userInfo->game->heros->collectHeros;
|
|
|
+ $ItemObj = ctx()->store->items;
|
|
|
+ $EquipObj = ctx()->store->equipment;
|
|
|
+ $SegementObj = ctx()->store->segement;
|
|
|
+ $HeroObj = ctx()->heros->collectHeros;
|
|
|
$ItemNum = 0;
|
|
|
if ($ItemObj) {
|
|
|
foreach ($ItemObj as $value) { ////检查宝石类可叠加物品的格子占用
|
|
@@ -1315,7 +1315,7 @@ class StoreProc {
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- req()->userInfo->game->privateState->ItemNum = $ItemNum;
|
|
|
+ ctx()->privateState->ItemNum = $ItemNum;
|
|
|
return $ItemNum;
|
|
|
}
|
|
|
|
|
@@ -1324,7 +1324,7 @@ class StoreProc {
|
|
|
* @return int 上限数值
|
|
|
*/
|
|
|
// public static function GetItemMaxNum() {
|
|
|
-// $user = req()->userInfo->game;
|
|
|
+// $user = ctx();
|
|
|
// if (!CommUtil::isPropertyExists($user->privateState, "maxItemNum")) {
|
|
|
// $user->privateState->maxItemNum = glc()->Item_Packet_MaxNum;
|
|
|
// }
|
|
@@ -1335,7 +1335,7 @@ class StoreProc {
|
|
|
* 6412 背包扩容
|
|
|
*/
|
|
|
public static function AddPacketNum() {
|
|
|
- $user = req()->userInfo->game; # user引用
|
|
|
+ $user = ctx(); # user引用
|
|
|
if (!CommUtil::isPropertyExists($user->privateState, "maxItemNum")) {
|
|
|
$user->privateState->maxItemNum = glc()->Item_Packet_MaxNum;
|
|
|
}
|