|
@@ -86,11 +86,12 @@ class HeroProc {
|
|
|
|
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->store, $cardId) , ErrCode::err_const_no);
|
|
|
|
|
|
- $mo = GameConfig::zhaohuanCard_getItem($cardId);
|
|
|
+ $mo = GameConfig::item_yanlingbook_getItem($cardId);
|
|
|
my_Assert($mo != null, ErrCode::err_const_no);
|
|
|
- my_Assert(ctx()->baseInfo->gold >= $mo->cost, ErrCode::notenough_gold_msg);
|
|
|
- my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $mo->hunqi), ErrCode::err_const_no);
|
|
|
- $list = explode(';', $mo->material);
|
|
|
+ my_Assert(ctx()->baseInfo->gold >= $mo->costGold, ErrCode::notenough_gold_msg);
|
|
|
+ $hunqiList = explode(',', $mo->hunqi);
|
|
|
+ my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $hunqiList[0]), ErrCode::err_const_no);
|
|
|
+ $list = explode(';', $mo->cost_materials);
|
|
|
|
|
|
foreach ($list as $value) {
|
|
|
$slist = explode(',',$value);
|
|
@@ -99,8 +100,9 @@ class HeroProc {
|
|
|
my_Assert(StlUtil::dictHasProperty(ctx()->store->items, $id) && ctx()->store->items->$id >= $num , ErrCode::err_const_no);
|
|
|
}
|
|
|
ctx()->store(true)->RemoveItemFromStore($cardId, 1);
|
|
|
- ctx()->base(true)->Consume_Gold($mo->cost);
|
|
|
- ctx()->store(true)->RemoveItemFromStore($mo->hunqi, 1);
|
|
|
+ ctx()->base(true)->Consume_Gold($mo->cost);
|
|
|
+ ctx()->store(true)->RemoveItemFromStore($hunqiList[0],$hunqiList[1]);
|
|
|
+
|
|
|
foreach ($list as $value) {
|
|
|
$slist = explode(',',$value);
|
|
|
$id = $slist[0];
|
|
@@ -109,34 +111,53 @@ class HeroProc {
|
|
|
}
|
|
|
|
|
|
//1:指定卡;2:品质固定随机卡;3:品质元素固定随机卡
|
|
|
- switch ($mo->type) {
|
|
|
- case 1:
|
|
|
- $yanlingId = $mo->yanlingPool;
|
|
|
- break;
|
|
|
- case 2:
|
|
|
- case 3:
|
|
|
- $rList = explode(';', $mo->yanlingPool);
|
|
|
- $rand = rand(0,100);
|
|
|
+ $rList = explode(';', $mo->yanlingPool);
|
|
|
+ $rand = rand(0,100);
|
|
|
|
|
|
- $start = 0;
|
|
|
- $end = 0;
|
|
|
- foreach ($rList as $value) {
|
|
|
- $valueList = explode(',', $value);
|
|
|
- $end += $valueList[1];
|
|
|
+ $start = 0;
|
|
|
+ $end = 0;
|
|
|
+ $yanlingId =0;
|
|
|
+ foreach ($rList as $value) {
|
|
|
+ $valueList = explode(',', $value);
|
|
|
+ $end += $valueList[1];
|
|
|
|
|
|
- if($rand >= $start && $rand < $end){
|
|
|
- $yanlingId = $valueList[0];
|
|
|
- break;
|
|
|
- }
|
|
|
- $start = $end;
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- break;
|
|
|
- default:
|
|
|
+ if($rand >= $start && $rand < $end){
|
|
|
+ $yanlingId = $valueList[0];
|
|
|
break;
|
|
|
+ }
|
|
|
+ $start = $end;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+// switch ($mo->type) {
|
|
|
+// case 1:
|
|
|
+// $yanlingId = $mo->yanlingPool;
|
|
|
+// break;
|
|
|
+// case 2:
|
|
|
+// case 3:
|
|
|
+// $rList = explode(';', $mo->yanlingPool);
|
|
|
+// $rand = rand(0,100);
|
|
|
+//
|
|
|
+// $start = 0;
|
|
|
+// $end = 0;
|
|
|
+// foreach ($rList as $value) {
|
|
|
+// $valueList = explode(',', $value);
|
|
|
+// $end += $valueList[1];
|
|
|
+//
|
|
|
+// if($rand >= $start && $rand < $end){
|
|
|
+// $yanlingId = $valueList[0];
|
|
|
+// break;
|
|
|
+// }
|
|
|
+// $start = $end;
|
|
|
+// }
|
|
|
+//
|
|
|
+//
|
|
|
+// break;
|
|
|
+// default:
|
|
|
+// break;
|
|
|
+// }
|
|
|
+
|
|
|
$yanling = new Ins_YanLin();
|
|
|
$yanling->typeId = $yanlingId;
|
|
|
$cid = ctx()->privateState->currentId++;
|