mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-04-13 15:57:14 +03:00
Correct some commodity categories
"Ion Distributor" and "Trinkets Of Hidden Fortune" - see https://github.com/EDCD/FDevIDs/pull/6
This commit is contained in:
parent
a75f9ff3bc
commit
d6bb4f90ca
@ -9,11 +9,12 @@ import os
|
||||
from os.path import exists, isfile
|
||||
import sys
|
||||
|
||||
from companion import category_map, commodity_map, ship_map
|
||||
from companion import ship_map
|
||||
import outfitting
|
||||
|
||||
|
||||
# keep a summary of commodities found using in-game names
|
||||
# Assumes that the commodity data has already been 'fixed up'
|
||||
def addcommodities(data):
|
||||
|
||||
if not data['lastStarport'].get('commodities'): return
|
||||
@ -31,10 +32,10 @@ def addcommodities(data):
|
||||
size_pre = len(commodities)
|
||||
|
||||
for commodity in data['lastStarport'].get('commodities'):
|
||||
key = commodity_map.get(commodity['name']) or commodity['name']
|
||||
key = commodity['name']
|
||||
new = {
|
||||
'id' : commodity['id'],
|
||||
'category' : category_map.get(commodity['categoryname']) or commodity['categoryname'],
|
||||
'category' : commodity['categoryname'],
|
||||
'average' : commodity['cost_mean'].split('.')[0]
|
||||
}
|
||||
old = commodities.get(key)
|
||||
|
@ -47,6 +47,7 @@ commodity_map= {
|
||||
'Hafnium178' : 'Hafnium 178',
|
||||
'Hazardous Environment Suits' : 'H.E. Suits',
|
||||
'Heliostatic Furnaces' : 'Microbial Furnaces',
|
||||
'Ion Distributor' :('Machinery', 'Ion Distributor'),
|
||||
'Low Temperature Diamond' : 'Low Temperature Diamonds',
|
||||
'Marine Supplies' : 'Marine Equipment',
|
||||
'Meta Alloys' : 'Meta-Alloys',
|
||||
@ -58,7 +59,7 @@ commodity_map= {
|
||||
'S A P8 Core Container' : 'SAP 8 Core Container', # Not seen in E:D 1.4 or later?
|
||||
'Skimer Components' : 'Skimmer Components',
|
||||
'Terrain Enrichment Systems' : 'Land Enrichment Systems',
|
||||
'Trinkets Of Fortune' : 'Trinkets Of Hidden Fortune',
|
||||
'Trinkets Of Fortune' :('Consumer Items', 'Trinkets Of Hidden Fortune'),
|
||||
'Unknown Artifact' : 'Unknown Artefact',
|
||||
'Unknown Artifact2' : 'Unknown Probe', # untested
|
||||
'U S S Cargo Ancient Artefact' : 'Ancient Artefact',
|
||||
@ -293,7 +294,11 @@ class Session:
|
||||
else:
|
||||
# Rewrite text fields
|
||||
commodity['categoryname'] = category_map.get(commodity['categoryname'], commodity['categoryname'])
|
||||
commodity['name'] = commodity_map.get(commodity['name'], commodity['name'])
|
||||
fixed = commodity_map.get(commodity['name'])
|
||||
if type(fixed) == tuple:
|
||||
(commodity['categoryname'], commodity['name']) = fixed
|
||||
elif fixed:
|
||||
commodity['name'] = fixed
|
||||
|
||||
# Force demand and stock to zero if their corresponding bracket is zero
|
||||
# Fixes spurious "demand": 1 in ED 1.3
|
||||
|
@ -8,7 +8,7 @@ from sys import platform
|
||||
import time
|
||||
|
||||
from config import config
|
||||
from companion import commodity_map, ship_map
|
||||
from companion import ship_map
|
||||
|
||||
|
||||
logfile = None
|
||||
@ -46,7 +46,7 @@ def export(data):
|
||||
commodities = defaultdict(int)
|
||||
for item in data['ship'].get('cargo',{}).get('items',[]):
|
||||
if item['commodity'] != 'drones':
|
||||
commodities[commodity_map.get(item['commodity'], item['commodity'])] += item['qty']
|
||||
commodities[item['commodity']] += item['qty']
|
||||
|
||||
writelog(querytime,
|
||||
data['lastSystem']['name'],
|
||||
|
Loading…
x
Reference in New Issue
Block a user