elite-engineering/elite_engineering/trade.py
2022-01-20 11:04:54 -05:00

154 lines
4.8 KiB
Python

import dataclasses
import fractions
materials = {
"raw": {
"Raw Material Category 1": ["Carbon", "Vanadium", "Niobium", "Yttrium"],
"Raw Material Category 2": [
"Phosphorus",
"Chromium",
"Molybdenum",
"Technetium",
],
"Raw Material Category 3": ["Sulphur", "Manganese", "Cadmium", "Ruthenium"],
"Raw Material Category 4": ["Iron", "Zinc", "Tin", "Selenium"],
"Raw Material Category 5": ["Nickel", "Germanium", "Tungsten", "Tellurium"],
"Raw Material Category 6": ["Rhenium", "Arsenic", "Mercury", "Polonium"],
"Raw Material Category 7": ["Lead", "Zirconium", "Boron", "Antimony"],
},
"manufactured": {
"Chemical": [
"Chemical Storage Units",
"Chemical Processors",
"Chemical Distillery",
"Chemical Manipulators",
"Pharmaceutical Isolators",
],
"Thermic": [
"Tempered Alloys",
"Heat Resistant Ceramics",
"Precipitated Alloys",
"Thermic Alloys",
"Military Grade Alloys",
],
"Heat": [
"Heat Conduction Wiring",
"Heat Dispersion Plate",
"Heat Exchangers",
"Heat Vanes",
"Proto Heat Radiators",
],
"Conductive": [
"Basic Conductors",
"Conductive Components",
"Conductive Ceramics",
"Conductive Polymers",
"Biotech Conductors",
],
"Mechanical Components": [
"Mechanical Scrap",
"Mechanical Equipment",
"Mechanical Components",
"Configurable Components",
"Improvised Components",
],
"Capacitors": [
"Grid Resistors",
"Hybrid Capacitors",
"Electrochemical Arrays",
"Polymer Capacitors",
"Military Supercapacitors",
],
"Shielding": [
"Worn Shield Emitters",
"Shield Emitters",
"Shielding Sensors",
"Compound Shielding",
"Imperial Shielding",
],
"Composite": [
"Compact Composites",
"Filament Composites",
"High Density Composites",
"Proprietary Composites",
"Core Dynamics Composites",
],
"Crystals": [
"Crystal Shards",
"Flawed Focus Crystals",
"Focus Crystals",
"Refined Focus Crystals",
"Exquisite Focus Crystals",
],
"Alloys": [
"Salvaged Alloys",
"Galvanising Alloys",
"Phase Alloys",
"Proto Light Alloys",
"Proto Radiolic Alloys",
],
},
"encoded": {
"Emission Data": [
"Exceptional Scrambled Emission Data",
"Irregular Emission Data",
"Unexpected Emission Data",
"Decoded Emission Data",
"Abnormal Compact Emissions Data",
],
"Wake Scans": [
"Atypical Disrupted Wake Echoes",
"Anomalous FSD Telemetry",
"Strange Wake Solutions",
"Eccentric Hyperspace Trajectories",
"Datamined Wake Exceptions",
],
"Shield Data": [
"Distorted Shield Cycle Recordings",
"Inconsistent Shield Soak Analysis",
"Untypical Shield Scans",
"Aberrant Shield Pattern Analysis",
"Peculiar Shield Frequency Data",
],
"Encryption Files": [
"Unusual Encrypted Files",
"Tagged Encryption Codes",
"Open Symmetric Keys",
"Atypical Encryption Archives",
"Adaptive Encryptors Capture",
],
"Data Archives": [
"Anomalous Bulk Scan Data",
"Unidentified Scan Archives",
"Classified Scan Databanks",
"Divergent Scan Data",
"Classified Scan Fragment",
],
"Encoded Firmware": [
"Specialised Legacy Firmware",
"Modified Consumer Firmware",
"Cracked Industrial Firmware",
"Security Firmware Patch",
"Modified Embedded Firmware",
],
},
}
@dataclasses.dataclass
class Material:
name: str
category: str
grade: int
def trade_ratio(self, other: "Material") -> fractions.Fraction:
grade_base = 3 if self.grade <= other.grade else 6
grade_ratio = fractions.Fraction(
grade_base ** self.grade, grade_base ** other.grade
)
category_ratio = (
fractions.Fraction(1, 1)
if self.category == other.category
else fractions.Fraction(6, 1)
)
return grade_ratio * category_ratio