mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-12 15:27:14 +03:00
[2228] Handle Unknown FSD Ranges
This commit is contained in:
parent
ebc62ae8e0
commit
690523c916
@ -357,7 +357,7 @@ outfitting_standard_map = {
|
|||||||
'guardianpowerdistributor': 'Guardian Hybrid Power Distributor',
|
'guardianpowerdistributor': 'Guardian Hybrid Power Distributor',
|
||||||
'guardianpowerplant': 'Guardian Hybrid Power Plant',
|
'guardianpowerplant': 'Guardian Hybrid Power Plant',
|
||||||
'hyperdrive': 'Frame Shift Drive',
|
'hyperdrive': 'Frame Shift Drive',
|
||||||
('hyperdrive', 'overcharge'): 'Frame Shift Drive',
|
('hyperdrive', 'overcharge'): 'Frame Shift Drive (SCO)',
|
||||||
'lifesupport': 'Life Support',
|
'lifesupport': 'Life Support',
|
||||||
# 'planetapproachsuite': handled separately
|
# 'planetapproachsuite': handled separately
|
||||||
'powerdistributor': 'Power Distributor',
|
'powerdistributor': 'Power Distributor',
|
||||||
@ -501,6 +501,7 @@ ship_name_map = {
|
|||||||
'mamba': 'Mamba',
|
'mamba': 'Mamba',
|
||||||
'orca': 'Orca',
|
'orca': 'Orca',
|
||||||
'python': 'Python',
|
'python': 'Python',
|
||||||
|
'python_nx': 'Python Mk II',
|
||||||
'scout': 'Taipan Fighter',
|
'scout': 'Taipan Fighter',
|
||||||
'sidewinder': 'Sidewinder',
|
'sidewinder': 'Sidewinder',
|
||||||
'testbuggy': 'Scarab',
|
'testbuggy': 'Scarab',
|
||||||
|
@ -106,7 +106,7 @@ def export(data, filename=None) -> None: # noqa: C901, CCR001
|
|||||||
else:
|
else:
|
||||||
name = module['name'] # type: ignore
|
name = module['name'] # type: ignore
|
||||||
|
|
||||||
if name == 'Frame Shift Drive':
|
if name == 'Frame Shift Drive' or name == 'Frame Shift Drive (SCO)':
|
||||||
fsd = module # save for range calculation
|
fsd = module # save for range calculation
|
||||||
|
|
||||||
if mods.get('OutfittingFieldType_FSDOptimalMass'):
|
if mods.get('OutfittingFieldType_FSDOptimalMass'):
|
||||||
@ -167,15 +167,19 @@ def export(data, filename=None) -> None: # noqa: C901, CCR001
|
|||||||
try:
|
try:
|
||||||
mass += ships[ship_name_map[data['ship']['name'].lower()]]['hullMass']
|
mass += ships[ship_name_map[data['ship']['name'].lower()]]['hullMass']
|
||||||
string += f'Mass : {mass:.2f} T empty\n {mass + fuel + cargo:.2f} T full\n'
|
string += f'Mass : {mass:.2f} T empty\n {mass + fuel + cargo:.2f} T full\n'
|
||||||
|
maxfuel = fsd.get('maxfuel', 0) # type: ignore
|
||||||
|
fuelmul = fsd.get('fuelmul', 0) # type: ignore
|
||||||
|
|
||||||
multiplier = pow(min(fuel, fsd['maxfuel']) / fsd['fuelmul'], 1.0 # type: ignore
|
try:
|
||||||
/ fsd['fuelpower']) * fsd['optmass'] # type: ignore
|
multiplier = pow(min(fuel, maxfuel) / fuelmul, 1.0 / fsd['fuelpower']) * fsd['optmass'] # type: ignore
|
||||||
|
range_unladen = multiplier / (mass + fuel) + jumpboost
|
||||||
range_unladen = multiplier / (mass + fuel) + jumpboost
|
range_laden = multiplier / (mass + fuel + cargo) + jumpboost
|
||||||
range_laden = multiplier / (mass + fuel + cargo) + jumpboost
|
# As of 2021-04-07 edsy.org says text import not yet implemented, so ignore the possible issue with
|
||||||
# As of 2021-04-07 edsy.org says text import not yet implemented, so ignore the possible issue with
|
# a locale that uses comma for decimal separator.
|
||||||
# a locale that uses comma for decimal separator.
|
except ZeroDivisionError:
|
||||||
string += f'Range : {range_unladen:.2f} LY unladen\n {range_laden:.2f} LY laden\n'
|
range_unladen = range_laden = 0.0
|
||||||
|
string += (f'Range : {range_unladen:.2f} LY current without cargo\n'
|
||||||
|
f' {range_laden:.2f} LY current with cargo\n')
|
||||||
|
|
||||||
except Exception:
|
except Exception:
|
||||||
if __debug__:
|
if __debug__:
|
||||||
|
@ -222,7 +222,7 @@ def lookup(module, ship_map, entitled=False) -> dict | None: # noqa: C901, CCR0
|
|||||||
(new['class'], new['rating']) = (str(name[2][4:]), 'H')
|
(new['class'], new['rating']) = (str(name[2][4:]), 'H')
|
||||||
|
|
||||||
elif len(name) > 4 and name[1] == 'hyperdrive': # e.g. Int_Hyperdrive_Overcharge_Size6_Class3
|
elif len(name) > 4 and name[1] == 'hyperdrive': # e.g. Int_Hyperdrive_Overcharge_Size6_Class3
|
||||||
(new['class'], new['rating']) = (str(name[4][-1:]), 'C')
|
(new['class'], new['rating']) = (str(name[3][-1:]), rating_map[name[4][-1:]])
|
||||||
|
|
||||||
else:
|
else:
|
||||||
if len(name) < 3:
|
if len(name) < 3:
|
||||||
@ -257,7 +257,7 @@ def lookup(module, ship_map, entitled=False) -> dict | None: # noqa: C901, CCR0
|
|||||||
if not m:
|
if not m:
|
||||||
print(f'No data for module {key}')
|
print(f'No data for module {key}')
|
||||||
|
|
||||||
elif new['name'] == 'Frame Shift Drive':
|
elif new['name'] == 'Frame Shift Drive' or new['name'] == 'Frame Shift Drive (SCO)':
|
||||||
assert 'mass' in m and 'optmass' in m and 'maxfuel' in m and 'fuelmul' in m and 'fuelpower' in m, m
|
assert 'mass' in m and 'optmass' in m and 'maxfuel' in m and 'fuelmul' in m and 'fuelpower' in m, m
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -89,6 +89,9 @@
|
|||||||
"Python": {
|
"Python": {
|
||||||
"hullMass": 350
|
"hullMass": 350
|
||||||
},
|
},
|
||||||
|
"Python Mk II": {
|
||||||
|
"hullMass": 450
|
||||||
|
},
|
||||||
"Sidewinder": {
|
"Sidewinder": {
|
||||||
"hullMass": 25
|
"hullMass": 25
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user