1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-12 23:37:14 +03:00

Add some new 2.4 modules

This commit is contained in:
Jonathan Harris 2017-10-03 11:09:34 -07:00
parent ec73fe1bcb
commit df944b0f6e
4 changed files with 3949 additions and 3790 deletions

View File

@ -8,6 +8,7 @@ import json
import os
from os.path import exists, isfile
import sys
from traceback import print_exc
import companion
import outfitting
@ -36,7 +37,7 @@ def addcommodities(data):
'id' : commodity['id'],
'symbol' : commodity['name'],
'category' : commodity['categoryname'],
'name' : commodity['locName'],
'name' : commodity.get('locName') or 'Limpets',
}
old = commodities.get(key)
if old:
@ -79,7 +80,12 @@ def addmodules(data):
for key,module in data['lastStarport'].get('modules').iteritems():
# sanity check
if int(key) != module.get('id'): raise AssertionError('id: %s!=%s' % (key, module['id']))
new = outfitting.lookup(module, companion.ship_map, True)
try:
new = outfitting.lookup(module, companion.ship_map, True)
except:
print '%d, %s:' % (module['id'], module['name'])
print_exc(0)
new = None
if new:
old = modules.get(int(key))
if old:

View File

@ -163,10 +163,16 @@ if __name__ == "__main__":
else:
modules[key] = { 'mass': m.get('mass', 0) } # Some modules don't have mass
# Repair Limpet Controller not yet present in coriolis-data. Same masses as Prospector
# Repair and Research Limpet Controller not yet present in coriolis-data. Same masses as Prospector.
# (Note only seen 1E Research).
for k in modules.keys():
if k[0] == 'Prospector Limpet Controller':
modules[('Repair Limpet Controller',) + k[1:]] = modules[k]
modules[('Research Limpet Controller',) + k[1:]] = modules[k]
# Other 2.4 additions not yet present in coriolis-data
modules[('AX Missile Rack', None, '2', 'B')] = {'mass': 4}
modules[('Xeno Scanner', None, '0', 'E')] = {'mass': 1.3}
modules = OrderedDict([(k,modules[k]) for k in sorted(modules)]) # sort for easier diffing
cPickle.dump(modules, open('modules.p', 'wb'))

7701
modules.p

File diff suppressed because it is too large Load Diff

View File

@ -19,6 +19,7 @@ armour_map = OrderedDict([
weapon_map = {
'advancedtorppylon' : 'Torpedo Pylon',
'atdumbfiremissile' : 'AX Missile Rack',
'basicmissilerack' : 'Missile Rack',
'beamlaser' : 'Beam Laser',
('beamlaser','heat') : 'Retributor Beam Laser',
@ -70,6 +71,8 @@ weaponclass_map = {
weaponrating_map = {
'hpt_advancedtorppylon_fixed_small' : 'I',
'hpt_advancedtorppylon_fixed_medium': 'I',
'hpt_atdumbfiremissile_fixed_medium': 'B',
'hpt_atdumbfiremissile_turret_medium': 'B',
'hpt_basicmissilerack_fixed_small' : 'B',
'hpt_basicmissilerack_fixed_medium' : 'B',
'hpt_beamlaser_fixed_small' : 'E',
@ -166,6 +169,7 @@ countermeasure_map = {
'electroniccountermeasure' : ('Electronic Countermeasure', 'F'),
'heatsinklauncher' : ('Heat Sink Launcher', 'I'),
'plasmapointdefence' : ('Point Defence', 'I'),
'xenoscanner' : ('Xeno Scanner', 'E'),
}
utility_map = {
@ -251,6 +255,7 @@ internal_map = {
'shieldgenerator' : 'Shield Generator',
('shieldgenerator','fast') : 'Bi-Weave Shield Generator',
('shieldgenerator','strong') : 'Prismatic Shield Generator',
'unkvesselresearch' : 'Research Limpet Controller',
}
@ -372,12 +377,15 @@ def lookup(module, ship_map, entitled=False):
else:
raise AssertionError('%s: Unknown module "%s"' % (module['id'], name[1]))
if not name[2].startswith('size') or not name[3].startswith('class'): raise AssertionError('%s: Unknown class/rating "%s/%s"' % (module['id'], name[2], name[3]))
new['class'] = str(name[2][4:])
new['rating'] = (name[1]=='buggybay' and planet_rating_map or
name[1]=='fighterbay' and fighter_rating_map or
name[1]=='corrosionproofcargorack' and corrosion_rating_map or
rating_map)[name[3][5:]]
if len(name) < 4 and name[1] == 'unkvesselresearch': # Hack! No size or class.
(new['class'], new['rating']) = ('1', 'E')
else:
if not name[2].startswith('size') or not name[3].startswith('class'): raise AssertionError('%s: Unknown class/rating "%s/%s"' % (module['id'], name[2], name[3]))
new['class'] = str(name[2][4:])
new['rating'] = (name[1]=='buggybay' and planet_rating_map or
name[1]=='fighterbay' and fighter_rating_map or
name[1]=='corrosionproofcargorack' and corrosion_rating_map or
rating_map)[name[3][5:]]
# Disposition of fitted modules
if 'on' in module and 'priority' in module: