102 lines
3.6 KiB
PHP
102 lines
3.6 KiB
PHP
<?php
|
|
|
|
namespace mt;
|
|
|
|
use phpcommon;
|
|
|
|
class Equip {
|
|
|
|
public static function get($id)
|
|
{
|
|
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'
|
|
],[//子弹飞行速度-固定值
|
|
'attr_id' => kHAT_BulletSpeed,
|
|
'type' => kHAT_ABS_VAL,
|
|
'field_name' => 'bullet_speed'
|
|
],
|
|
];
|
|
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)
|
|
{
|
|
$meta = self::get($id);
|
|
return array(
|
|
'id' => $equip_conf['id'],
|
|
'upgrade_priority' => $equip_conf['upgrade_priority'],
|
|
'equip_upgrade' => $equip_conf['equip_upgrade'],
|
|
'level_gold_cost' => $equip_conf['level_gold_cost'],
|
|
'max_level' => $equip_conf['max_level'],
|
|
'equip_upgradematerial' => $equip_conf['equip_upgradematerial'],
|
|
'equip_upgradetime' => $equip_conf['equip_upgradetime'],
|
|
'diamond_cost' => $equip_conf['diamond_cost'],
|
|
'drop_id' => $equip_conf['drop_id'],
|
|
'reduce_time' => $equip_conf['reduce_time'],
|
|
'diamond_time' => $equip_conf['diamond_time'],
|
|
'upgrade_gold' => $equip_conf['upgrade_gold'],
|
|
'promote_gold' => $equip_conf['promote_gold'],
|
|
'promote_material' => $equip_conf['promote_material'],
|
|
'real_index_id' => $equip_conf['real_index_id'],
|
|
'promote_gold' => $equip_conf['promote_gold'],
|
|
);
|
|
}
|
|
|
|
protected static function getMetaList()
|
|
{
|
|
if (!self::$metaList) {
|
|
self::$metaList = getMetaTable('equip@equip.php');
|
|
}
|
|
return self::$metaList;
|
|
}
|
|
|
|
protected static $metaList;
|
|
|
|
}
|