|
@@ -28,69 +28,77 @@ class HeroProc {
|
|
return self::UnlockHero();
|
|
return self::UnlockHero();
|
|
case CmdCode::hero_strengthenStar: # 6603 角色升星
|
|
case CmdCode::hero_strengthenStar: # 6603 角色升星
|
|
return self::HeroStrengthenStar();
|
|
return self::HeroStrengthenStar();
|
|
|
|
+ case CmdCode::hero_resetUnlockHero: # 6604 角色卡解锁英雄
|
|
|
|
+ return self::ResetUnlockHero();
|
|
default:
|
|
default:
|
|
Err(ErrCode::cmd_err);
|
|
Err(ErrCode::cmd_err);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ private static function ResetUnlockHero() {
|
|
|
|
+ ctx()->heros->roleCardUnlockHeroList = array();
|
|
|
|
+ UserProc::updateUserInfo();
|
|
|
|
+ return Resp::ok(array());
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 6603 角色升星
|
|
* 6603 角色升星
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
- private static function HeroStrengthenStar(){
|
|
|
|
- list($heroId) = req()->paras;
|
|
|
|
-
|
|
|
|
|
|
+ private static function HeroStrengthenStar() {
|
|
|
|
+ list($heroId) = req()->paras;
|
|
|
|
+
|
|
$mo = GameConfig::hero_getItem($heroId);
|
|
$mo = GameConfig::hero_getItem($heroId);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
-
|
|
|
|
|
|
+
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->heros->Dic, $heroId), "找不到英雄配置数据!");
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->heros->Dic, $heroId), "找不到英雄配置数据!");
|
|
my_Assert(ctx()->heros->Dic->$heroId->isUnlock == 1, "英雄未解锁!");
|
|
my_Assert(ctx()->heros->Dic->$heroId->isUnlock == 1, "英雄未解锁!");
|
|
-
|
|
|
|
- $nextMo = null;
|
|
|
|
|
|
+
|
|
|
|
+ $nextMo = null;
|
|
$typeList = GameConfig::heroType_typeId_getItemArray($mo->typeID);
|
|
$typeList = GameConfig::heroType_typeId_getItemArray($mo->typeID);
|
|
foreach ($typeList as $item) {
|
|
foreach ($typeList as $item) {
|
|
- if($item->starLv == $mo->starLv +1){
|
|
|
|
|
|
+ if ($item->starLv == $mo->starLv + 1) {
|
|
$nextMo = $item;
|
|
$nextMo = $item;
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
my_Assert($nextMo != null, "没有下一星级配置信息");
|
|
my_Assert($nextMo != null, "没有下一星级配置信息");
|
|
-
|
|
|
|
|
|
+
|
|
$heroDebrisList = explode(',', $nextMo->heroDebris_need);
|
|
$heroDebrisList = explode(',', $nextMo->heroDebris_need);
|
|
$itemId = $heroDebrisList[0];
|
|
$itemId = $heroDebrisList[0];
|
|
$itemNum = $heroDebrisList[1];
|
|
$itemNum = $heroDebrisList[1];
|
|
-
|
|
|
|
- my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items->$itemId >= $itemNum, ErrCode::notenough_item);
|
|
|
|
|
|
+
|
|
|
|
+ my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items->$itemId >= $itemNum, ErrCode::notenough_item);
|
|
ctx()->store->removeItem($itemId, $itemNum);
|
|
ctx()->store->removeItem($itemId, $itemNum);
|
|
-
|
|
|
|
|
|
+
|
|
$nextHeroId = $nextMo->id;
|
|
$nextHeroId = $nextMo->id;
|
|
-
|
|
|
|
|
|
+
|
|
$ins_hero = new Ins_Hero(ctx()->heros->Dic->$heroId);
|
|
$ins_hero = new Ins_Hero(ctx()->heros->Dic->$heroId);
|
|
- $ins_hero->Id = $nextHeroId;
|
|
|
|
|
|
+ $ins_hero->Id = $nextHeroId;
|
|
ctx()->heros->Dic->$nextHeroId = $ins_hero;
|
|
ctx()->heros->Dic->$nextHeroId = $ins_hero;
|
|
- if(ctx()->heros->CurrentHeroId == $heroId){
|
|
|
|
|
|
+ if (ctx()->heros->CurrentHeroId == $heroId) {
|
|
ctx()->heros->CurrentHeroId = $nextHeroId;
|
|
ctx()->heros->CurrentHeroId = $nextHeroId;
|
|
}
|
|
}
|
|
StlUtil::dictRemove(ctx()->heros->Dic, $heroId);
|
|
StlUtil::dictRemove(ctx()->heros->Dic, $heroId);
|
|
-
|
|
|
|
|
|
+
|
|
UserProc::updateUserInfo();
|
|
UserProc::updateUserInfo();
|
|
- return Resp::ok(array(
|
|
|
|
|
|
+ return Resp::ok(array(
|
|
'store' => ctx()->store,
|
|
'store' => ctx()->store,
|
|
- 'heros'=>ctx()->heros,
|
|
|
|
- 'newHeroId'=>$nextHeroId,
|
|
|
|
|
|
+ 'heros' => ctx()->heros,
|
|
|
|
+ 'newHeroId' => $nextHeroId,
|
|
));
|
|
));
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 购买角色
|
|
* 购买角色
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
- private static function BuyHero(){
|
|
|
|
|
|
+ private static function BuyHero() {
|
|
list($heroId) = req()->paras; # 切换英雄id
|
|
list($heroId) = req()->paras; # 切换英雄id
|
|
my_Assert(GameConfig::hero_getItem($heroId) != null, "找不到英雄配置数据!");
|
|
my_Assert(GameConfig::hero_getItem($heroId) != null, "找不到英雄配置数据!");
|
|
-
|
|
|
|
|
|
+
|
|
ctx()->heros->Dic->$heroId->isUnlock = 1;
|
|
ctx()->heros->Dic->$heroId->isUnlock = 1;
|
|
|
|
|
|
return Resp::ok();
|
|
return Resp::ok();
|
|
@@ -101,35 +109,84 @@ class HeroProc {
|
|
* @return type
|
|
* @return type
|
|
*/
|
|
*/
|
|
private static function UnlockHero() {
|
|
private static function UnlockHero() {
|
|
- list($heroId) = req()->paras;
|
|
|
|
-
|
|
|
|
|
|
+ list($heroId) = req()->paras;
|
|
|
|
+
|
|
$mo = GameConfig::hero_getItem($heroId);
|
|
$mo = GameConfig::hero_getItem($heroId);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
-
|
|
|
|
|
|
+
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->heros->Dic, $heroId), "找不到英雄配置数据!");
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->heros->Dic, $heroId), "找不到英雄配置数据!");
|
|
my_Assert(ctx()->heros->Dic->$heroId->isUnlock == 0, "英雄已经解锁!");
|
|
my_Assert(ctx()->heros->Dic->$heroId->isUnlock == 0, "英雄已经解锁!");
|
|
-
|
|
|
|
|
|
+
|
|
//$heroDebris_need = $mo->heroDebris_need;
|
|
//$heroDebris_need = $mo->heroDebris_need;
|
|
$heroDebrisList = explode(',', $mo->heroDebris_need);
|
|
$heroDebrisList = explode(',', $mo->heroDebris_need);
|
|
$itemId = $heroDebrisList[0];
|
|
$itemId = $heroDebrisList[0];
|
|
$itemNum = $heroDebrisList[1];
|
|
$itemNum = $heroDebrisList[1];
|
|
-
|
|
|
|
|
|
+
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items->$itemId >= $itemNum, ErrCode::notenough_item);
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $itemId) && ctx()->store->items->$itemId >= $itemNum, ErrCode::notenough_item);
|
|
-
|
|
|
|
|
|
+
|
|
ctx()->store->removeItem($itemId, $itemNum);
|
|
ctx()->store->removeItem($itemId, $itemNum);
|
|
-
|
|
|
|
- FightProc::skillUnlock_heroUnlock($heroId);//这个接口位置不能动
|
|
|
|
-
|
|
|
|
- ctx()->heros->Dic->$heroId->isUnlock = 1;//解锁
|
|
|
|
- ctx()->heros->Dic->$heroId->isNewHeadImgTip = 1;
|
|
|
|
-
|
|
|
|
|
|
+
|
|
|
|
+ self::UnlockNewHero($heroId);
|
|
|
|
+
|
|
UserProc::updateUserInfo();
|
|
UserProc::updateUserInfo();
|
|
- return Resp::ok(array(
|
|
|
|
|
|
+ return Resp::ok(array(
|
|
'store' => ctx()->store,
|
|
'store' => ctx()->store,
|
|
- 'heros'=>ctx()->heros,
|
|
|
|
|
|
+ 'heros' => ctx()->heros,
|
|
'skillUnlockRecord' => ctx()->privateState->skillUnlockRecord,
|
|
'skillUnlockRecord' => ctx()->privateState->skillUnlockRecord,
|
|
));
|
|
));
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static function UnlockNewHero($heroId) {
|
|
|
|
+ FightProc::skillUnlock_heroUnlock($heroId); //这个接口位置不能动
|
|
|
|
+
|
|
|
|
+ ctx()->heros->Dic->$heroId->isUnlock = 1; //解锁
|
|
|
|
+ ctx()->heros->Dic->$heroId->isNewHeadImgTip = 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public static function RoleCardUnlockHero($itemId, $num) {
|
|
|
|
+ $heroDic = GameConfig::hero();
|
|
|
|
+ $heroTypeId = 0;
|
|
|
|
+
|
|
|
|
+ $tMo = null;
|
|
|
|
+ foreach ($heroDic as $mo) {
|
|
|
|
+ if ($itemId == $mo->roleCard) {
|
|
|
|
+ $heroTypeId = $mo->typeID;
|
|
|
|
+ $tMo = $mo;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ $tag = false;
|
|
|
|
+ if ($heroTypeId != 0) {
|
|
|
|
+ $dic = ctx()->heros->Dic;
|
|
|
|
+ foreach ($dic as $heroItem) {
|
|
|
|
+ $hero = GameConfig::hero_getItem($heroItem->id);
|
|
|
|
+ if ($hero->typeID == $heroTypeId) {
|
|
|
|
+ $tag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if ($tag) {//英雄已经解锁,则转为碎片
|
|
|
|
+ for ($i = 0; $i < $num; $i++) {
|
|
|
|
+ if ($tMo->heroDebris_need != null) {
|
|
|
|
+ StoreProc::AddMultiItemInStore($tMo->heroDebris_need);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ } else {//解锁英雄
|
|
|
|
+ for ($i = 0; $i < $num; $i++) {
|
|
|
|
+ if ($i == 0) {
|
|
|
|
+ HeroProc::UnlockNewHero($tMo->id);
|
|
|
|
+ ctx()->heros->roleCardUnlockHeroList[] = $tMo->id;
|
|
|
|
+
|
|
|
|
+ //StoreProc::$reward_hero[] = $tMo->id;
|
|
|
|
+ } else {
|
|
|
|
+ StoreProc::AddMultiItemInStore($tMo->heroDebris_need);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ UserProc::updateUserInfo();
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -141,4 +198,5 @@ class HeroProc {
|
|
ctx()->heros->CurrentHeroId = $newHeroId;
|
|
ctx()->heros->CurrentHeroId = $newHeroId;
|
|
return Resp::ok();
|
|
return Resp::ok();
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|