|
@@ -250,7 +250,6 @@ class StoreProc {
|
|
|
public static function AllEquipUpgrade() {
|
|
|
//list() = req()->paras;
|
|
|
//$user = ctx();
|
|
|
-
|
|
|
// $equipDic = $user->store->equipPosition;
|
|
|
//
|
|
|
// $equip_levelDic = GameConfig::equip_levelupgrade();
|
|
@@ -295,8 +294,7 @@ class StoreProc {
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
- //升级,扣除金币和图纸
|
|
|
+ //升级,扣除金币和图纸
|
|
|
// while (true) {
|
|
|
// $tag = 9999;
|
|
|
// foreach ($arr as $index => &$equip) {
|
|
@@ -324,7 +322,6 @@ class StoreProc {
|
|
|
// break;
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
// if ($tag != 9999) {
|
|
|
// if (array_key_exists($tag, $arr)) {
|
|
|
// StlUtil::arrayRemoveAt($arr, $tag);
|
|
@@ -336,7 +333,6 @@ class StoreProc {
|
|
|
// }
|
|
|
// }
|
|
|
// }
|
|
|
-
|
|
|
// TaskProc::OnAnyEquipUpLevel_X();
|
|
|
// TaskProc::OnAllEquipUpLevel_X();
|
|
|
// TaskProc::OnEquipLevelUpNum();
|
|
@@ -359,9 +355,9 @@ class StoreProc {
|
|
|
public static function RemoveNewGemTip() {
|
|
|
list($uid) = req()->paras; //宝石uid
|
|
|
|
|
|
- my_Assert(StlUtil::dictHasProperty(ctx()->store->gemStore, $uid), ErrCode::user_store_NoItem);
|
|
|
- ctx()->store(true)->gemStore->$uid->isNew = 0;
|
|
|
-
|
|
|
+ my_Assert(StlUtil::dictHasProperty(ctx()->store->gemStore, $uid), ErrCode::user_store_NoItem);
|
|
|
+ ctx()->store(true)->gemStore->$uid->isNew = 0;
|
|
|
+
|
|
|
UserProc::updateUserInfo();
|
|
|
return Resp::ok(array());
|
|
|
}
|
|
@@ -391,105 +387,60 @@ class StoreProc {
|
|
|
*/
|
|
|
public static function GemCompose() {
|
|
|
list($gemIds) = req()->paras;
|
|
|
- $user = ctx();
|
|
|
|
|
|
- //做校验
|
|
|
+ $list = explode(';', $gemIds);
|
|
|
+
|
|
|
+ $gemStore = ctx()->store->gemStore;
|
|
|
$composeArr = array();
|
|
|
+ foreach ($list as $gems) {
|
|
|
+ $gemArr = explode('-', $gems);
|
|
|
+ $length1 = strlen($gemArr[0]);
|
|
|
+ $length2 = strlen($gemArr[1]);
|
|
|
+ $gem_composeCost = explode(',', substr($gemArr[0], 1, $length1 - 1)); //去掉逗号
|
|
|
+ $gem_composeIds = explode(',', substr($gemArr[1], 1, $length2 - 1)); //去掉逗号
|
|
|
+
|
|
|
+ $gemMo = GameConfig::gem_getItem($gem_composeIds[0]);
|
|
|
+ my_Assert(null != $gemMo, ErrCode::err_const_no);
|
|
|
|
|
|
- //$gemIds = substr($gemIds, 0, -1);
|
|
|
- $list = explode(';', $gemIds);
|
|
|
- krsort($list);
|
|
|
-
|
|
|
- foreach ($list as $str) {
|
|
|
- $str = substr($str, 0, -1);
|
|
|
- $gemUidList = explode(',', $str);
|
|
|
- $firstGemUId = $gemUidList[0];
|
|
|
- $qual = 0;
|
|
|
- $posId = 0;
|
|
|
- if (StlUtil::dictHasProperty($user->store->gemStore, $firstGemUId)) {
|
|
|
- $ins_gem = $user->store->gemStore->$firstGemUId;
|
|
|
- $mo = GameConfig::gem_getItem($ins_gem->typeId);
|
|
|
- $qual = $mo->qual;
|
|
|
- $posId = $mo->position;
|
|
|
- }
|
|
|
$isCompose = true;
|
|
|
- //在做一次校验
|
|
|
- foreach ($gemUidList as $uid) {
|
|
|
- if (StlUtil::dictHasProperty($user->store->gemStore, $uid)) {
|
|
|
- $ins_gem = $user->store->gemStore->$uid;
|
|
|
- $mo = GameConfig::gem_getItem($ins_gem->typeId);
|
|
|
-
|
|
|
- if ($mo->qual != $qual || $mo->position != $posId) {
|
|
|
- $isCompose = false;
|
|
|
- break;
|
|
|
- }
|
|
|
+ foreach ($gem_composeCost as $gemUid) {
|
|
|
+ if (!StlUtil::dictHasProperty($gemStore, $gemUid)) {
|
|
|
+ $isCompose = false;
|
|
|
+ break;
|
|
|
}
|
|
|
- }
|
|
|
- my_Assert($isCompose == true, ErrCode::user_store_GemCanotCompose);
|
|
|
|
|
|
- //查找要合成的宝石配置信息
|
|
|
- $gemConf = self::GemComposeSynthesis($qual, $posId);
|
|
|
- my_Assert($gemConf != null, ErrCode::err_const_no);
|
|
|
- $synthesisList = explode('_', $gemConf->synthesis);
|
|
|
- $composePosition = $synthesisList[0];
|
|
|
- $composeQual = $synthesisList[1];
|
|
|
- $composeNum = $synthesisList[2];
|
|
|
-
|
|
|
- foreach ($composeArr as $val) {
|
|
|
- $mo = GameConfig::gem_getItem($val->typeId);
|
|
|
- if ($mo->qual == $composeQual && $mo->position == $composePosition) {
|
|
|
- $gemUidList[] = $val->uid;
|
|
|
+ $ins_gem = new Ins_Gem($gemStore->$gemUid);
|
|
|
+ if ($ins_gem->mo()->qual + 1 != $gemMo->qual || $ins_gem->mo()->position == $gemMo->position) {
|
|
|
+ $isCompose = false;
|
|
|
+ break;
|
|
|
}
|
|
|
+
|
|
|
+ if(!self::GemIsCanCompose($gemUid)){
|
|
|
+ $isCompose = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- if (count($gemUidList) >= $composeNum) {
|
|
|
- if ($gemConf != null) {
|
|
|
- $maxGemNum = intval(count($gemUidList) / $composeNum);
|
|
|
- $index = 0;
|
|
|
- $res = 0;
|
|
|
- foreach ($gemUidList as $uid) {
|
|
|
- my_Assert(self::GemIsCanCompose($uid) == false && $user->store->gemStore->$uid->isUnlock == 0, ErrCode::user_store_GemCanotCompose);
|
|
|
-
|
|
|
- $index += 1;
|
|
|
- self::RemoveGemInStore($uid);
|
|
|
- //$composeArr 有的话删除
|
|
|
- for ($i = 0; $i < count($composeArr); $i++) {
|
|
|
- if ($composeArr[$i]->uid == $uid) {
|
|
|
- StlUtil::arrayRemoveAt($composeArr, $i);
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if ($index % $composeNum == 0) {
|
|
|
- $res += 1;
|
|
|
- $composeGem = self::initGem($gemConf->typeId);
|
|
|
- self::PutGemInStore($composeGem);
|
|
|
- $composeArr[] = $composeGem; //临时放这
|
|
|
- }
|
|
|
-
|
|
|
- if ($res >= $maxGemNum) {
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+ my_Assert($isCompose == true, ErrCode::user_store_GemCanotCompose);
|
|
|
+
|
|
|
+ foreach ($gem_composeCost as $gemUid) {
|
|
|
+ self::RemoveGemInStore($gemUid);
|
|
|
}
|
|
|
+
|
|
|
+ foreach ($gem_composeIds as $gemTypeId) {
|
|
|
+ $composeGem = self::initGem($gemTypeId);
|
|
|
+ self::PutGemInStore($composeGem);
|
|
|
+ $composeArr[] = $composeGem->uid; //临时放这
|
|
|
+ }
|
|
|
}
|
|
|
- $resultArr = array();
|
|
|
- foreach ($composeArr as $value) {
|
|
|
- SystemProc::GetGem_GreaterOrangeQual_GemCompose(req()->zoneid, ctx()->baseInfo->name, $value->typeId); //广播
|
|
|
- ctx()->store->gemComposeNum += 1;
|
|
|
- $resultArr[] = $value->uid;
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
TaskProc::OnComposeNumGem();
|
|
|
TaskProc::OnComposeNumGem_state();
|
|
|
- ctx($user);
|
|
|
+
|
|
|
UserProc::updateUserInfo();
|
|
|
return Resp::ok(array(
|
|
|
- 'composeGemIds' => $resultArr,
|
|
|
- 'store' => $user->store,
|
|
|
- 'task' => $user->task,
|
|
|
+ 'composeGemIds' => $composeArr,
|
|
|
+ 'store' => ctx()->store,
|
|
|
+ 'task' => ctx()->task,
|
|
|
));
|
|
|
}
|
|
|
|
|
@@ -498,61 +449,33 @@ class StoreProc {
|
|
|
* @param type $uid
|
|
|
* @return bool
|
|
|
*/
|
|
|
- private static function GemIsCanCompose($uid) {
|
|
|
- $Ins_gemItem = new Ins_Gem(ctx()->store->gemStore->$uid);
|
|
|
-
|
|
|
- $equipGemDic = ctx()->store->gemEquip;
|
|
|
- $equipPag = ctx()->store->equipPag;
|
|
|
-
|
|
|
- $isExist = false;
|
|
|
- foreach ($equipGemDic as $pag => $dic) {
|
|
|
- if ($equipPag == $pag) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (StlUtil::dictHasProperty($dic, $Ins_gemItem->mo()->position)) {
|
|
|
- $posId = $Ins_gemItem->mo()->position;
|
|
|
- $tDic = $dic->$posId;
|
|
|
- foreach ($tDic as $index => $ins_gem) {
|
|
|
- if ($ins_gem->uid == $Ins_gemItem->uid) {
|
|
|
- $isExist = true;
|
|
|
- break;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- if ($isExist) {
|
|
|
+ private static function GemIsCanCompose($uid) {
|
|
|
+ $ins_gem = new Ins_Gem($uid);
|
|
|
+ if($ins_gem->isUnlock == 1){
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ $isExist = true;
|
|
|
+ $equip = ctx()->store->equip;
|
|
|
+ foreach ($equip as $uid => $item) {
|
|
|
+ $arr = get_object_vars($item->gemSetSlot);
|
|
|
+ $values = array_values($arr);
|
|
|
+ if(in_array($uid, $values)){
|
|
|
+ $isExist = false;
|
|
|
break;
|
|
|
- }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
return $isExist;
|
|
|
}
|
|
|
-
|
|
|
- private static function GemComposeSynthesis($qual, $posId) {
|
|
|
- $gem = GameConfig::gem();
|
|
|
- foreach ($gem as $key => $value) {
|
|
|
- if ($value->synthesis != null) {
|
|
|
- $synthesisList = explode('_', $value->synthesis);
|
|
|
- $composePosition = $synthesisList[0];
|
|
|
- $composeQual = $synthesisList[1];
|
|
|
- $composeNum = $synthesisList[2];
|
|
|
-
|
|
|
- if ($composeQual != 0 && $composePosition != 0 && $composeQual == $qual && $posId == $composePosition && $value->isfixed_predicateId == 0) {
|
|
|
- return $value;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- return null;
|
|
|
- }
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* 装备宝石
|
|
|
* @return type
|
|
|
*/
|
|
|
public static function GemSet() {
|
|
|
list($equipUid, $uid, $type, $replaceUId) = req()->paras; //宝石uid 手动的时候记得校验u $replaceUId宝石槽坑位id
|
|
|
-
|
|
|
+
|
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->store->gemStore, $uid), ErrCode::user_store_NoItem);
|
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->store->equip, $equipUid), ErrCode::user_store_NoEquip);
|
|
|
$ins_equip = new Ins_Equip(ctx()->store->equip->$equipUid);
|
|
@@ -571,16 +494,16 @@ class StoreProc {
|
|
|
}
|
|
|
}
|
|
|
$mo = GameConfig::gem_slotposition_getItem($ins_equip->mo()->qual);
|
|
|
- my_Assert(null != $mo, ErrCode::err_const_no);
|
|
|
+ my_Assert(null != $mo, ErrCode::err_const_no);
|
|
|
switch ($type) {
|
|
|
case 1://镶嵌
|
|
|
- my_Assert($tag_gem == null, ErrCode::user_store_GemCanotSet);
|
|
|
- for ($i = 1; $i <= $mo->initNum_slot+$mo->buyNum_slot; $i++) {
|
|
|
+ my_Assert($tag_gem == null, ErrCode::user_store_GemCanotSet);
|
|
|
+ for ($i = 1; $i <= $mo->initNum_slot + $mo->buyNum_slot; $i++) {
|
|
|
if (!StlUtil::dictHasProperty($gemSetSlotDic, $i)) {
|
|
|
- $gemSetSlotDic->$i = $ins_gem;
|
|
|
+ $gemSetSlotDic->$i = $ins_gem;
|
|
|
break;
|
|
|
}
|
|
|
- }
|
|
|
+ }
|
|
|
break;
|
|
|
case 2://替换
|
|
|
//满不满都高替低品阶
|
|
@@ -591,7 +514,7 @@ class StoreProc {
|
|
|
$gemSetSlotDic->$replaceUId = $ins_gem;
|
|
|
break;
|
|
|
case 3://手动
|
|
|
- my_Assert(count((array) $gemSetSlotDic) >= $mo->initNum_slot+$mo->buyNum_slot, ErrCode::user_store_GemCanotSet);
|
|
|
+ my_Assert(count((array) $gemSetSlotDic) >= $mo->initNum_slot + $mo->buyNum_slot, ErrCode::user_store_GemCanotSet);
|
|
|
$gUid = $gemSetSlotDic->$replaceUId;
|
|
|
my_Assert(StlUtil::dictHasProperty($gemSetSlotDic, $replaceUId), ErrCode::user_store_NoExistGemReplace);
|
|
|
$replace_ins_Gem = new Ins_Gem(ctx()->store->gemStore->$gUid);
|
|
@@ -625,9 +548,9 @@ class StoreProc {
|
|
|
|
|
|
$ins_equip->gemSetSlot = $gemSetSlotDic;
|
|
|
ctx()->store(true)->equip->$equipUid = $ins_equip;
|
|
|
-
|
|
|
+
|
|
|
TaskProc::OnSetSpecialQualGem();
|
|
|
- FightProc::Ranking_FightPower();
|
|
|
+ FightProc::Ranking_FightPower();
|
|
|
UserProc::updateUserInfo();
|
|
|
return Resp::ok(array(
|
|
|
'gold' => 0,
|
|
@@ -642,18 +565,18 @@ class StoreProc {
|
|
|
*/
|
|
|
public static function GemRemove() {
|
|
|
list($uid) = req()->paras; //装备宝石id
|
|
|
-
|
|
|
+
|
|
|
$equips = ctx()->store->equip;
|
|
|
foreach ($equips as $eUid => $ins_equip) {
|
|
|
$dic = $ins_equip->gemSetSlot;
|
|
|
foreach ($dic as $slotId => $gemUid) {
|
|
|
- if($uid == $gemUid){
|
|
|
+ if ($uid == $gemUid) {
|
|
|
ctx()->store->equip->$eUid->gemSetSlot->$slotId = 0;
|
|
|
}
|
|
|
break 2;
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
FightProc::Ranking_FightPower();
|
|
|
UserProc::updateUserInfo();
|