1
This commit is contained in:
parent
f489a12fd3
commit
ddd78b4659
@ -197,7 +197,8 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
|
|
||||||
public function evolveChip()
|
public function evolveChip()
|
||||||
{
|
{
|
||||||
|
$tokenId1 = getReqVal('token_id1', '');
|
||||||
|
$tokenIds = explode('|', getReqVal('token_ids', ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function mintShardBatchUser()
|
public function mintShardBatchUser()
|
||||||
@ -242,82 +243,26 @@ class BlockChainController extends BaseAuthedController {
|
|||||||
$tokenId = '';
|
$tokenId = '';
|
||||||
$tokenType = '';
|
$tokenType = '';
|
||||||
|
|
||||||
if (count($tokenIds) <= 0) {
|
{
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
$heros = array();
|
||||||
return;
|
$guns = array();
|
||||||
}
|
$specHeros = array();
|
||||||
|
$specGuns = array();
|
||||||
$part = 0;
|
mt\Item::groupFragment($tokenIds, $heros, $guns, $specHeros, $specGuns);
|
||||||
$hasSpecHero = false;
|
if (count($tokenIds) != (
|
||||||
$hasSpecGun = false;
|
count($heros) + count($guns) + count($specHeros) + count($specGuns)
|
||||||
$specCount = 0;
|
)) {
|
||||||
foreach ($tokenIds as $itemId) {
|
myself()->_rspErr(101, 'token_ids paramater error');
|
||||||
$itemMeta = mt\Item::get($itemId);
|
|
||||||
if (!$itemMeta || !mt\Item::isFragment($itemMeta)) {
|
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($part == 0) {
|
if (count($specHeros) + count($specGuns) > 1) {
|
||||||
if (!($itemMeta['sub_type'] == 3 ||
|
myself()->_rspErr(101, 'token_ids paramater error');
|
||||||
$itemMeta['sub_type'] == 4)) {
|
|
||||||
$part = $itemMeta['sub_type'];
|
|
||||||
} else {
|
|
||||||
if ($itemMeta['sub_type'] == 3) {
|
|
||||||
$hasSpecHero = true;
|
|
||||||
}
|
|
||||||
if ($itemMeta['sub_type'] == 4) {
|
|
||||||
$hasGunHero = true;
|
|
||||||
}
|
|
||||||
++$specCount;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ($part != $itemMeta['sub_type']) {
|
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($specCount > 1) {
|
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($part == 1) {
|
|
||||||
if ($hasSpecGun) {
|
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$tokenType = Nft::HERO_TYPE;
|
if (count($heros) > 0 && count($guns) > 0) {
|
||||||
if (!mt\Item::canMixHero($tokenIds)) {
|
myself()->_rspErr(101, 'token_ids paramater error');
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if ($hasSpecHero) {
|
|
||||||
$itemMeta = mt\Item::get($itemId);
|
|
||||||
if (!$itemMeta || $itemMeta['type'] != mt\Item::HERO_TYPE) {
|
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if ($part == 2) {
|
|
||||||
if ($hasSpecHero) {
|
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$tokenType = Nft::EQUIP_TYPE;
|
|
||||||
if (!mt\Item::canMixGun($tokenIds)) {
|
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if ($hasSpecGun) {
|
|
||||||
$itemMeta = mt\Item::get($itemId);
|
|
||||||
if (!$itemMeta || $itemMeta['type'] != mt\Item::GUN_TYPE) {
|
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
myself()->_rspErr(1, 'token_ids paramaer error');
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tokenId = BuyRecord::genOrderId
|
$tokenId = BuyRecord::genOrderId
|
||||||
|
@ -275,8 +275,8 @@ class Item {
|
|||||||
return $itemMeta['type'] == self::FRAGMENT_TYPE;
|
return $itemMeta['type'] == self::FRAGMENT_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function canMixHero($itemIds) {
|
public static function groupFragment($tokenIds, &$heros, &$guns, &$specHeros, &$specGuns)
|
||||||
$ok = true;
|
{
|
||||||
$heroItemIds = array(
|
$heroItemIds = array(
|
||||||
110110,
|
110110,
|
||||||
110120,
|
110120,
|
||||||
@ -287,23 +287,6 @@ class Item {
|
|||||||
110170,
|
110170,
|
||||||
110180
|
110180
|
||||||
);
|
);
|
||||||
foreach ($heroItemIds as $itemId1) {
|
|
||||||
$found = false;
|
|
||||||
foreach ($itemIds as $itemId2) {
|
|
||||||
if ($itemId1 == $itemId2) {
|
|
||||||
$found = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$found) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return $ok;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function canMixGun($itemIds) {
|
|
||||||
$ok = true;
|
|
||||||
$gunItemIds = array(
|
$gunItemIds = array(
|
||||||
110210,
|
110210,
|
||||||
110220,
|
110220,
|
||||||
@ -314,19 +297,29 @@ class Item {
|
|||||||
110270,
|
110270,
|
||||||
110280
|
110280
|
||||||
);
|
);
|
||||||
foreach ($gunItemIds as $itemId1) {
|
foreach ($tokenIds as $tokenId) {
|
||||||
$found = false;
|
if (in_array($tokenId, $heroItemIds)) {
|
||||||
foreach ($itemIds as $itemId2) {
|
array_push($heros, $tokenId);
|
||||||
if ($itemId1 == $itemId2) {
|
}
|
||||||
$found = true;
|
if (in_array($tokenId, $gunItemIds)) {
|
||||||
break;
|
array_push($gun, $tokenId);
|
||||||
}
|
}
|
||||||
|
switch ($tokenId) {
|
||||||
|
case 110100:
|
||||||
|
{
|
||||||
|
array_push($specHeros, $tokenId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 110200:
|
||||||
|
{
|
||||||
|
array_push($gunHeros, $tokenId);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
{
|
||||||
}
|
}
|
||||||
if (!$found) {
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $ok;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getMetaList()
|
protected static function getMetaList()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user