From b49d90706b70031592cc1c2467487b94c345f435 Mon Sep 17 00:00:00 2001 From: aozhiwei Date: Tue, 2 Jul 2024 19:29:48 +0800 Subject: [PATCH] 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);