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