89 lines
3.4 KiB
PHP
89 lines
3.4 KiB
PHP
<?php
|
|
|
|
|
|
require_once('models/Bag.php');
|
|
require_once('models/Hero.php');
|
|
require_once('models/Chip.php');
|
|
|
|
require_once('services/PropertyChgService.php');
|
|
require_once('services/LogService.php');
|
|
|
|
require_once('mt/Manufacture.php');
|
|
|
|
|
|
use models\Bag;
|
|
use models\Hero;
|
|
use models\Chip;
|
|
use services\FormulaService;
|
|
use services\LogService;
|
|
use phpcommon\SqlHelper;
|
|
|
|
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,
|
|
'rand_attr' => $baseAttr,
|
|
'lucky' => strval($heroLucky),
|
|
'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,
|
|
'labour'=>0
|
|
);
|
|
$hero['current_pvp_get_ceg'] = strval(round(FormulaService::getHeroPvpDailyCegUpLimit($hero),2));
|
|
$hero['pvp_ceg_uplimit'] = strval(round(FormulaService::getHeroPvpDailyCegUpLimit($hero),2));
|
|
$hero['current_pve_get_ceg'] = strval(round(FormulaService::getHeroPveDailyCegUpLimit($hero),2));
|
|
$hero['pve_ceg_uplimit'] = strval(round(FormulaService::getHeroPveDailyCegUpLimit($hero),2));
|
|
$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,
|
|
'rand_attr' => $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,
|
|
'labour'=>0
|
|
);
|
|
$gun['current_pvp_get_ceg'] = strval(round(FormulaService::getWeaponPvpDailyCegUpLimit($gun),2)) ;
|
|
$gun['pvp_ceg_uplimit'] = strval(round(FormulaService::getWeaponPvpDailyCegUpLimit($gun),2)) ;
|
|
$gun['current_pve_get_ceg'] = strval(round(FormulaService::getWeaponPveDailyCegUpLimit($gun),2)) ;
|
|
$gun['pve_ceg_uplimit'] = strval(round(FormulaService::getWeaponPveDailyCegUpLimit($gun),2)) ;
|
|
$this->_rspData(array(
|
|
'data' => $gun
|
|
));
|
|
}else{
|
|
$this->_rspErr(1, 'item_id parameter error');
|
|
return;
|
|
}
|
|
}
|
|
|
|
const HERO_TYPE = 3;
|
|
const GUN_TYPE = 7;
|
|
|
|
}
|