diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 2b82c510..05cf5932 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -150,16 +150,37 @@ class OutAppNftController extends BaseController { echo json_encode($info); die; } + $heroAttrs = emptyReplace(json_decode($heroDb['wealth_attr'], true), array()); + $heroResult = \mt\EconomyAttribute::getAttrValue($heroAttrs); + $wealth = $heroResult['wealth']; + $wealth_rate = $heroResult['wealth_rate']; + $lucky = $heroResult['lucky']; + $lucky_rate = $heroResult['lucky_rate']; + $heroAbility = Hero::abilityInfo($heroDb); $heroMeta = \mt\Hero::get($heroDb['hero_id']); $NftMeta = \mt\NftDesc::getByItemId($heroDb['hero_id']); + $itemMeta = \mt\Item::get($heroDb['hero_id']); + $heroAtteMeta = \mt\EconomyAttribute::findByGrade($itemMeta['relationship'],$heroDb['quality']); $info['token_id'] = $tokenId; $info['name'] = $heroMeta['name']; $info['description'] = $NftMeta['desc']; - $info['image'] = "https://res2.counterfire.games/nft/meta/".$heroDb['hero_id'].'_'.$heroDb['quality'].".gif"; + $info['image'] = "https://res2.counterfire.games/nft/meta/". + $heroDb['hero_id'].'_'.$this->getRealHeroQuality($heroDb).".gif"; array_push($info['attributes'],array( - "trait_type" => "level", - "value" => intval($heroDb['hero_lv']), - "max_value" => 15, + "trait_type" => "quality", + "value" => intval($this->getRealHeroQuality($heroDb)), + )); + array_push($info['attributes'],array( + "trait_type" => "max_mining_days", + "value" => $heroAtteMeta['validTime'], + )); + array_push($info['attributes'],array( + "trait_type" => "wealth", + "value" => floor($wealth * (1+$wealth_rate)), + )); + array_push($info['attributes'],array( + "trait_type" => "lucky", + "value" => floor($lucky * (1+$lucky_rate)), )); if ($this->isCloseBox()) { $this->fillBoxMeta($info); @@ -280,10 +301,12 @@ class OutAppNftController extends BaseController { $info['item_id'] = $heroMeta['id']; $info['type'] = $nftDb['token_type']; $info['image'] = 'https://res2.counterfire.games/nft/meta/' . $heroMeta['id'] . '_' . $heroDb['quality'] . '.gif'; - $info['detail']['quality'] = $heroDb['quality']; + $info['detail']['quality'] = $this->getRealHeroQuality($heroDb); $info['detail']['max_mining_days'] = $heroAtteMeta['validTime']; $info['detail']['wealth'] = floor($wealth * (1+$wealth_rate)); $info['detail']['lucky'] = floor($lucky * (1+$lucky_rate)); + $info['detail']['wealth'] = ''; + $info['detail']['lucky'] = ''; $info['detail']['hp'] = $heroAbility['hp']; $info['detail']['atk'] = $heroAbility['attack']; $info['detail']['def'] = $heroAbility['defence']; @@ -390,4 +413,17 @@ class OutAppNftController extends BaseController { return $row ? 1 : 0; } + private function getRealHeroQuality($heroDb) + { + $quality = $heroDb['quality'];; + if ($heroDb['createtime'] <= 1719985966) { + } else { + $quality = $quality - 1; + if ($quality <= 0) { + $quality = 1; + } + } + return $quality; + } + } diff --git a/webapp/models/Nft.php b/webapp/models/Nft.php index f70e1d72..ca89fcf6 100644 --- a/webapp/models/Nft.php +++ b/webapp/models/Nft.php @@ -120,7 +120,7 @@ class Nft extends BaseModel 't_nft', array( 'owner_address' => LOCK_CONTRACT_ADDRESS, - 'last_owner_address' => $account, + 'last_lock_address' => $account, 'token_type' => $type, 'deleted' => 0, ),