获取枪械equip表的基础属性
This commit is contained in:
parent
3945836bef
commit
9f0aa042b4
@ -70,6 +70,7 @@ const kHAT_Critical = 42;
|
|||||||
const kHAT_CriDamage = 43;
|
const kHAT_CriDamage = 43;
|
||||||
const kHAT_Dodge = 44;
|
const kHAT_Dodge = 44;
|
||||||
const kHAT_Ruduce = 45;
|
const kHAT_Ruduce = 45;
|
||||||
|
const kHAT_BrainLifePct = 47;
|
||||||
|
|
||||||
const kHAT_ABS_VAL = 1;
|
const kHAT_ABS_VAL = 1;
|
||||||
const kHAT_RATE_VAL = 2;
|
const kHAT_RATE_VAL = 2;
|
||||||
|
@ -5,7 +5,6 @@ require_once('models/Hero.php');
|
|||||||
require_once('models/Gun.php');
|
require_once('models/Gun.php');
|
||||||
require_once('models/User.php');
|
require_once('models/User.php');
|
||||||
require_once('mt/ChipAttr.php');
|
require_once('mt/ChipAttr.php');
|
||||||
require_once('mt/AttrHelper.php');
|
|
||||||
require_once('services/FormulaService.php');
|
require_once('services/FormulaService.php');
|
||||||
|
|
||||||
|
|
||||||
@ -491,7 +490,6 @@ class ChipController extends BaseAuthedController
|
|||||||
// Chip::update($chip['token_id'],['strength'=>$tili]);
|
// Chip::update($chip['token_id'],['strength'=>$tili]);
|
||||||
// }
|
// }
|
||||||
// $this->_rspOk();
|
// $this->_rspOk();
|
||||||
print_r(Chip::getChipByIdx(10052)) ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -637,7 +635,8 @@ class ChipController extends BaseAuthedController
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function _inLayNewAttrGun($gun_id){
|
private function _inLayNewAttrGun($gun_id){
|
||||||
$gun = Gun::find($gun_id);
|
$gunDb = Gun::find($gun_id);
|
||||||
|
$gun = Gun::toDto($gunDb);
|
||||||
$chipAttr = [];
|
$chipAttr = [];
|
||||||
if (! $gun['chip_ids'] ){
|
if (! $gun['chip_ids'] ){
|
||||||
return $gun;
|
return $gun;
|
||||||
@ -657,9 +656,15 @@ class ChipController extends BaseAuthedController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
$gun_attr = emptyReplace(json_decode($gun['rand_attr'], true), array());
|
$item = [];
|
||||||
\mt\AttrHelper::mergeAttr($gun_attr,$chipAttr);
|
foreach ($chipAttr as $k=>$v){
|
||||||
$gun['rand_attr'] = $gun_attr;
|
if (!isset($item[$v['attr_id']])){
|
||||||
|
$item[$v['attr_id']] = $v;
|
||||||
|
}else{
|
||||||
|
$item[$v['attr_id']]['val']+= $v['val'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$gun['attr_chip'] = $item;//芯片属性
|
||||||
return $gun;
|
return $gun;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -142,8 +142,8 @@ class Gun extends BaseModel {
|
|||||||
$itemMeta = mt\Item::get($row['gun_id']);
|
$itemMeta = mt\Item::get($row['gun_id']);
|
||||||
$baseAttr=[];
|
$baseAttr=[];
|
||||||
if ($itemMeta) {
|
if ($itemMeta) {
|
||||||
$baseAttr = mt\Item::getBaseAttrs($itemMeta);
|
$baseAttr = mt\Equip::getGunBaseAttrs($itemMeta['relationship']);
|
||||||
// mt\AttrHelper::mergeAttr($attr, $baseAttr);
|
// $baseAttr = mt\Item::getBaseAttrs($itemMeta);
|
||||||
}
|
}
|
||||||
$todayGetGold = $row['today_get_gold'];
|
$todayGetGold = $row['today_get_gold'];
|
||||||
$lastGetGoldTime = $row['last_get_gold_time'];
|
$lastGetGoldTime = $row['last_get_gold_time'];
|
||||||
|
@ -11,6 +11,56 @@ class Equip {
|
|||||||
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
|
return array_key_exists($id, self::getMetaList()) ? self::getMetaList()[$id] : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function getGunBaseAttrs($id){
|
||||||
|
$mate = self::get($id);
|
||||||
|
$attr = array();
|
||||||
|
if ($mate){
|
||||||
|
$fields = [
|
||||||
|
[//攻击力-固定值
|
||||||
|
'attr_id' => kHAT_Atk,
|
||||||
|
'type' => kHAT_ABS_VAL,
|
||||||
|
'field_name' => 'atk'
|
||||||
|
],[//暴击率-百分比
|
||||||
|
'attr_id' => kHAT_Critical,
|
||||||
|
'type' => kHAT_RATE_VAL,
|
||||||
|
'field_name' => 'critical'
|
||||||
|
],[//暴击伤害-百分比
|
||||||
|
'attr_id' => kHAT_CriDamage,
|
||||||
|
'type' => kHAT_RATE_VAL,
|
||||||
|
'field_name' => 'cri_damage'
|
||||||
|
],[//射速-固定值
|
||||||
|
'attr_id' => kHAT_FireRate,
|
||||||
|
'type' => kHAT_ABS_VAL,
|
||||||
|
'field_name' => 'fire_rate'
|
||||||
|
],[//弹夹-固定值
|
||||||
|
'attr_id' => kHAT_Volume,
|
||||||
|
'type' => kHAT_ABS_VAL,
|
||||||
|
'field_name' => 'clip_volume'
|
||||||
|
],[//换弹-固定值
|
||||||
|
'attr_id' => kHAT_ReloadTime,
|
||||||
|
'type' => kHAT_ABS_VAL,
|
||||||
|
'field_name' => 'reload_time'
|
||||||
|
],[//射程-固定值
|
||||||
|
'attr_id' => kHAT_ShotRange,
|
||||||
|
'type' => kHAT_ABS_VAL,
|
||||||
|
'field_name' => 'range'
|
||||||
|
],[//攻击吸血-百分比
|
||||||
|
'attr_id' => kHAT_BrainLifePct,
|
||||||
|
'type' => kHAT_RATE_VAL,
|
||||||
|
'field_name' => 'brain_life_pct'
|
||||||
|
],
|
||||||
|
];
|
||||||
|
foreach ($fields as $field) {
|
||||||
|
array_push($attr, array(
|
||||||
|
'attr_id' => $field['attr_id'],
|
||||||
|
'type' => $field['type'],
|
||||||
|
'val' => $mate[$field['field_name']]
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $attr;
|
||||||
|
}
|
||||||
|
|
||||||
public static function getOldEquip($id)
|
public static function getOldEquip($id)
|
||||||
{
|
{
|
||||||
$meta = self::get($id);
|
$meta = self::get($id);
|
||||||
|
@ -20,45 +20,49 @@ class Hero {
|
|||||||
public static function getHeroAttr($meta)
|
public static function getHeroAttr($meta)
|
||||||
{
|
{
|
||||||
$fields = array(
|
$fields = array(
|
||||||
array(
|
array(//生命值-固定值
|
||||||
'attr_id' => kHAT_Hp,
|
'attr_id' => kHAT_Hp,
|
||||||
|
'type' => kHAT_ABS_VAL,
|
||||||
'field_name' => 'hp'
|
'field_name' => 'hp'
|
||||||
),
|
),
|
||||||
array(
|
array(//攻击力-固定值
|
||||||
'attr_id' => kHAT_Atk,
|
'attr_id' => kHAT_Atk,
|
||||||
|
'type' => kHAT_ABS_VAL,
|
||||||
'field_name' => 'damage'
|
'field_name' => 'damage'
|
||||||
),
|
),
|
||||||
array(
|
array(//防御-固定值
|
||||||
'attr_id' => kHAT_Def,
|
'attr_id' => kHAT_Def,
|
||||||
|
'type' => kHAT_ABS_VAL,
|
||||||
'field_name' => 'defence'
|
'field_name' => 'defence'
|
||||||
),
|
),
|
||||||
array(
|
array(//移动速度-固定值
|
||||||
'attr_id' => kHAT_Speed,
|
'attr_id' => kHAT_Speed,
|
||||||
|
'type' => kHAT_ABS_VAL,
|
||||||
'field_name' => 'move_speed5'
|
'field_name' => 'move_speed5'
|
||||||
),array(
|
),array(//暴击率-百分比
|
||||||
'attr_id' => kHAT_Critical,
|
'attr_id' => kHAT_Critical,
|
||||||
|
'type' => kHAT_RATE_VAL,
|
||||||
'field_name' => 'crit_atk'
|
'field_name' => 'crit_atk'
|
||||||
),array(
|
),array(//暴击伤害-百分比
|
||||||
'attr_id' => kHAT_CriDamage,
|
'attr_id' => kHAT_CriDamage,
|
||||||
|
'type' => kHAT_RATE_VAL,
|
||||||
'field_name' => 'crit_atk_damage'
|
'field_name' => 'crit_atk_damage'
|
||||||
),array(
|
),array(//闪避-百分比
|
||||||
'attr_id' => kHAT_Dodge,
|
'attr_id' => kHAT_Dodge,
|
||||||
|
'type' => kHAT_RATE_VAL,
|
||||||
'field_name' => 'miss'
|
'field_name' => 'miss'
|
||||||
),array(
|
),array(//闪避减伤-百分比
|
||||||
'attr_id' => kHAT_Ruduce,
|
'attr_id' => kHAT_Ruduce,
|
||||||
|
'type' => kHAT_RATE_VAL,
|
||||||
'field_name' => 'miss_damage_ruduce'
|
'field_name' => 'miss_damage_ruduce'
|
||||||
),
|
)
|
||||||
// array(
|
|
||||||
// 'attr_id' => kHAT_View,
|
|
||||||
// 'field_name' => ''
|
|
||||||
// ),
|
|
||||||
);
|
);
|
||||||
$attr = array();
|
$attr = array();
|
||||||
foreach ($fields as $field) {
|
foreach ($fields as $field) {
|
||||||
array_push($attr, array(
|
array_push($attr, array(
|
||||||
'attr_id' => $field['attr_id'],
|
'attr_id' => $field['attr_id'],
|
||||||
'type' => kHAT_ABS_VAL,
|
'type' => $field['type'],
|
||||||
'val' => (int)$meta[$field['field_name']]
|
'val' => $meta[$field['field_name']]
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
return $attr;
|
return $attr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user