From b49d90706b70031592cc1c2467487b94c345f435 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 2 Jul 2024 19:29:48 +0800 Subject: [PATCH 1/5] 1 --- .../controller/OutAppNftController.class.php | 26 ++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 2b82c510..9d5e03b8 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -150,16 +150,36 @@ 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"; array_push($info['attributes'],array( - "trait_type" => "level", - "value" => intval($heroDb['hero_lv']), - "max_value" => 15, + "trait_type" => "quality", + "value" => intval($heroDb['quality']), + )); + 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); From 94c47d1ad5ba4e459b03a96f9acf50b3e3a658b8 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 2 Jul 2024 19:52:32 +0800 Subject: [PATCH 2/5] 1 --- webapp/controller/OutAppNftController.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 9d5e03b8..038b402a 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -165,6 +165,7 @@ class OutAppNftController extends BaseController { $info['name'] = $heroMeta['name']; $info['description'] = $NftMeta['desc']; $info['image'] = "https://res2.counterfire.games/nft/meta/".$heroDb['hero_id'].'_'.$heroDb['quality'].".gif"; + /* array_push($info['attributes'],array( "trait_type" => "quality", "value" => intval($heroDb['quality']), @@ -180,7 +181,7 @@ class OutAppNftController extends BaseController { array_push($info['attributes'],array( "trait_type" => "lucky", "value" => floor($lucky * (1+$lucky_rate)), - )); + ));*/ if ($this->isCloseBox()) { $this->fillBoxMeta($info); } From 3b5f2fc16eb4646c5ed164af4fdef7e89aca593d Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 2 Jul 2024 20:41:27 +0800 Subject: [PATCH 3/5] 1 --- webapp/controller/OutAppNftController.class.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 038b402a..1bf5d759 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -303,8 +303,10 @@ class OutAppNftController extends BaseController { $info['image'] = 'https://res2.counterfire.games/nft/meta/' . $heroMeta['id'] . '_' . $heroDb['quality'] . '.gif'; $info['detail']['quality'] = $heroDb['quality']; $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'] = 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']; From d19eb275e7cb4e4b01b429d343f2a6ba729c6253 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 3 Jul 2024 11:01:29 +0800 Subject: [PATCH 4/5] 1 --- webapp/models/Nft.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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, ), From 16e32ab30faea73ae40660b6f3fdfa6663abeb14 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Wed, 3 Jul 2024 14:06:02 +0800 Subject: [PATCH 5/5] 1 --- .../controller/OutAppNftController.class.php | 27 ++++++++++++++----- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/webapp/controller/OutAppNftController.class.php b/webapp/controller/OutAppNftController.class.php index 1bf5d759..05cf5932 100644 --- a/webapp/controller/OutAppNftController.class.php +++ b/webapp/controller/OutAppNftController.class.php @@ -164,11 +164,11 @@ class OutAppNftController extends BaseController { $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" => "quality", - "value" => intval($heroDb['quality']), + "value" => intval($this->getRealHeroQuality($heroDb)), )); array_push($info['attributes'],array( "trait_type" => "max_mining_days", @@ -181,7 +181,7 @@ class OutAppNftController extends BaseController { array_push($info['attributes'],array( "trait_type" => "lucky", "value" => floor($lucky * (1+$lucky_rate)), - ));*/ + )); if ($this->isCloseBox()) { $this->fillBoxMeta($info); } @@ -301,10 +301,10 @@ 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'] = floor($wealth * (1+$wealth_rate)); + $info['detail']['lucky'] = floor($lucky * (1+$lucky_rate)); $info['detail']['wealth'] = ''; $info['detail']['lucky'] = ''; $info['detail']['hp'] = $heroAbility['hp']; @@ -413,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; + } + }