import configparser

# 创建配置解析器
config = configparser.ConfigParser()

# 读取INI文件
config.read('weapon_config.ini')

# 获取枪械配置
weapon_name = config.get('Weapon', 'Name')
damage = config.getint('Weapon', 'Damage')
fire_rate = config.getfloat('Weapon', 'FireRate')
range = config.getint('Weapon', 'Range')
ammo = config.getint('Weapon', 'Ammo')
lock_on = config.getboolean('Weapon', 'LockOn')
lock_on_range = config.getint('Weapon', 'LockOnRange')
lock_on_speed = config.getint('Weapon', 'LockOnSpeed')

# 打印配置参数
print(f"Weapon Name: {weapon_name}")
print(f"Damage: {damage}")
print(f"Fire Rate: {fire_rate} seconds")
print(f"Range: {range} units")
print(f"Ammo: {ammo}")
print(f"Lock On: {lock_on}")
print(f"Lock On Range: {lock_on_range} units")
print(f"Lock On Speed: {lock_on_speed} degrees per second")