This commit is contained in:
hujiabin 2022-09-16 17:58:35 +08:00
parent c430f2962a
commit 3ba4b38a8f
2 changed files with 89 additions and 0 deletions

View File

@ -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', [], '英雄或枪械的基本信息']
]
},
]

View File

@ -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;
}