From 3ba4b38a8f22bd41c5bf06d180b620aef9bfe9e1 Mon Sep 17 00:00:00 2001 From: hujiabin Date: Fri, 16 Sep 2022 17:58:35 +0800 Subject: [PATCH] 1 --- doc/Fragment.py | 13 ++++ .../controller/FragmentController.class.php | 76 +++++++++++++++++++ 2 files changed, 89 insertions(+) diff --git a/doc/Fragment.py b/doc/Fragment.py index 18dcb744..5f7ec064 100644 --- a/doc/Fragment.py +++ b/doc/Fragment.py @@ -50,6 +50,19 @@ class Fragment(object): ['property_chg', _common.PropertyChg(), '属性变更'], ['item_id', 0, '道具id'] ] + },{ + 'name': 'showBaseByItemId', + 'desc': '查看item的基本信息', + 'group': 'Fragment', + 'url': 'webapp/index.php?c=Fragment&a=showBaseByItemId', + 'params': [ + _common.ReqHead(), + ['item_id', '', '英雄或枪械的道具id'], + ], + 'response': [ + _common.RspHead(), + ['data', [], '英雄或枪械的基本信息'] + ] }, ] \ No newline at end of file diff --git a/webapp/controller/FragmentController.class.php b/webapp/controller/FragmentController.class.php index 709db4dc..d4a45886 100644 --- a/webapp/controller/FragmentController.class.php +++ b/webapp/controller/FragmentController.class.php @@ -7,6 +7,7 @@ require_once('services/PropertyChgService.php'); use models\Fragment; use models\Nft; +use services\FormulaService; class FragmentController extends BaseAuthedController { @@ -307,4 +308,79 @@ class FragmentController extends BaseAuthedController } } + public function showBaseByItemId(){ + $item_id = getReqVal('item_id',''); + $itemMeta = mt\Item::get($item_id); + if (! $itemMeta){ + $this->_rspErr(1, 'item_id parameter error'); + return; + } + if ($itemMeta['type'] == self::HERO_TYPE){ + $heroMeta = mt\Hero::get($itemMeta['id']); + $baseAttr =[]; + if ($heroMeta) { + $baseAttr = mt\Hero::getHeroAttr($heroMeta); + } + $heroLucky = FormulaService::Hero_Advanced_Lucky_Value(1); + $hero = array( + 'hero_id' => $itemMeta['id'], + 'hero_lv' => 1, + 'quality' => 1, + 'skill_lv1' => 1, + 'skill_lv2' => 1, + 'attr_base' => $baseAttr, + 'lucky' => strval($heroLucky), + 'skill_points' => 0, + 'skill_common' => [ + "100100", + "100120", + "100140", + "100160", + "100180", + "100200", + "100220", + "100240", + "100260", + "100280" + ], + 'hero_tili' => strval(round(FormulaService::Hero_NFT_Maximum_Physical_Strength(1,$heroLucky),3)), + 'hero_tili_max' => strval(round(FormulaService::Hero_NFT_Maximum_Physical_Strength(1,$heroLucky),3)), + 'chip_strength_sum' =>0, + ); + $hero['current_pvp_get_ceg'] = strval(FormulaService::getHeroPvpDailyCegUpLimit($hero)); + $hero['pvp_ceg_uplimit'] = strval(FormulaService::getHeroPvpDailyCegUpLimit($hero)); + $hero['current_pve_get_ceg'] = strval(FormulaService::getHeroPveDailyCegUpLimit($hero)); + $hero['pve_ceg_uplimit'] = strval(FormulaService::getHeroPveDailyCegUpLimit($hero)); + $this->_rspData(array( + 'data' => $hero + )); + }else if ($itemMeta['type'] == self::GUN_TYPE){ + $baseAttr = mt\Equip::getGunBaseAttrs($itemMeta['relationship']); + $gunLucky = FormulaService::Weapon_Advanced_Lucky_Value(1); + $gun = array( + 'gun_id' => $itemMeta['id'], + 'gun_lv' => 1, + 'quality' => 1, + 'attr_base' => $baseAttr, + 'lucky' => strval($gunLucky), + 'durability' => strval(round(FormulaService::Weapon_NFT_Maximum_Durability(1,$gunLucky),3)), + 'durability_max' => strval(round(FormulaService::Weapon_NFT_Maximum_Durability(1,$gunLucky),3)), + 'chip_strength_sum' =>0, + ); + $gun['current_pvp_get_ceg'] = FormulaService::getWeaponPvpDailyCegUpLimit($gun); + $gun['pvp_ceg_uplimit'] = FormulaService::getWeaponPvpDailyCegUpLimit($gun); + $gun['current_pve_get_ceg'] = FormulaService::getWeaponPveDailyCegUpLimit($gun); + $gun['pve_ceg_uplimit'] = FormulaService::getWeaponPveDailyCegUpLimit($gun); + $this->_rspData(array( + 'data' => $gun + )); + }else{ + $this->_rspErr(1, 'item_id parameter error'); + return; + } + } + + const HERO_TYPE = 3; + const GUN_TYPE = 7; + } \ No newline at end of file