tradedangerous 12.7.6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- py.typed +1 -0
- trade.py +49 -0
- tradedangerous/__init__.py +43 -0
- tradedangerous/cache.py +1381 -0
- tradedangerous/cli.py +136 -0
- tradedangerous/commands/TEMPLATE.py +74 -0
- tradedangerous/commands/__init__.py +244 -0
- tradedangerous/commands/buildcache_cmd.py +102 -0
- tradedangerous/commands/buy_cmd.py +427 -0
- tradedangerous/commands/commandenv.py +372 -0
- tradedangerous/commands/exceptions.py +94 -0
- tradedangerous/commands/export_cmd.py +150 -0
- tradedangerous/commands/import_cmd.py +222 -0
- tradedangerous/commands/local_cmd.py +243 -0
- tradedangerous/commands/market_cmd.py +207 -0
- tradedangerous/commands/nav_cmd.py +252 -0
- tradedangerous/commands/olddata_cmd.py +270 -0
- tradedangerous/commands/parsing.py +221 -0
- tradedangerous/commands/rares_cmd.py +298 -0
- tradedangerous/commands/run_cmd.py +1521 -0
- tradedangerous/commands/sell_cmd.py +262 -0
- tradedangerous/commands/shipvendor_cmd.py +60 -0
- tradedangerous/commands/station_cmd.py +68 -0
- tradedangerous/commands/trade_cmd.py +181 -0
- tradedangerous/commands/update_cmd.py +67 -0
- tradedangerous/corrections.py +55 -0
- tradedangerous/csvexport.py +234 -0
- tradedangerous/db/__init__.py +27 -0
- tradedangerous/db/adapter.py +192 -0
- tradedangerous/db/config.py +107 -0
- tradedangerous/db/engine.py +259 -0
- tradedangerous/db/lifecycle.py +332 -0
- tradedangerous/db/locks.py +208 -0
- tradedangerous/db/orm_models.py +500 -0
- tradedangerous/db/paths.py +113 -0
- tradedangerous/db/utils.py +661 -0
- tradedangerous/edscupdate.py +565 -0
- tradedangerous/edsmupdate.py +474 -0
- tradedangerous/formatting.py +210 -0
- tradedangerous/fs.py +156 -0
- tradedangerous/gui.py +1146 -0
- tradedangerous/mapping.py +133 -0
- tradedangerous/mfd/__init__.py +103 -0
- tradedangerous/mfd/saitek/__init__.py +3 -0
- tradedangerous/mfd/saitek/directoutput.py +678 -0
- tradedangerous/mfd/saitek/x52pro.py +195 -0
- tradedangerous/misc/checkpricebounds.py +287 -0
- tradedangerous/misc/clipboard.py +49 -0
- tradedangerous/misc/coord64.py +83 -0
- tradedangerous/misc/csvdialect.py +57 -0
- tradedangerous/misc/derp-sentinel.py +35 -0
- tradedangerous/misc/diff-system-csvs.py +159 -0
- tradedangerous/misc/eddb.py +81 -0
- tradedangerous/misc/eddn.py +349 -0
- tradedangerous/misc/edsc.py +437 -0
- tradedangerous/misc/edsm.py +121 -0
- tradedangerous/misc/importeddbstats.py +54 -0
- tradedangerous/misc/prices-json-exp.py +179 -0
- tradedangerous/misc/progress.py +194 -0
- tradedangerous/plugins/__init__.py +249 -0
- tradedangerous/plugins/edcd_plug.py +371 -0
- tradedangerous/plugins/eddblink_plug.py +861 -0
- tradedangerous/plugins/edmc_batch_plug.py +133 -0
- tradedangerous/plugins/spansh_plug.py +2647 -0
- tradedangerous/prices.py +211 -0
- tradedangerous/submit-distances.py +422 -0
- tradedangerous/templates/Added.csv +37 -0
- tradedangerous/templates/Category.csv +17 -0
- tradedangerous/templates/RareItem.csv +143 -0
- tradedangerous/templates/TradeDangerous.sql +338 -0
- tradedangerous/tools.py +40 -0
- tradedangerous/tradecalc.py +1302 -0
- tradedangerous/tradedb.py +2320 -0
- tradedangerous/tradeenv.py +313 -0
- tradedangerous/tradeenv.pyi +109 -0
- tradedangerous/tradeexcept.py +131 -0
- tradedangerous/tradeorm.py +183 -0
- tradedangerous/transfers.py +192 -0
- tradedangerous/utils.py +243 -0
- tradedangerous/version.py +16 -0
- tradedangerous-12.7.6.dist-info/METADATA +106 -0
- tradedangerous-12.7.6.dist-info/RECORD +87 -0
- tradedangerous-12.7.6.dist-info/WHEEL +5 -0
- tradedangerous-12.7.6.dist-info/entry_points.txt +3 -0
- tradedangerous-12.7.6.dist-info/licenses/LICENSE +373 -0
- tradedangerous-12.7.6.dist-info/top_level.txt +2 -0
- tradegui.py +24 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
unq:rare_id,station_id@Station.station_id,category_id@Category.category_id,unq:name,cost,max_allocation,illegal,suppressed
|
|
2
|
+
6533,128001536,8,'Eranin Pearl Whisky','','','?','?'
|
|
3
|
+
6534,128106744,8,'Lavian Brandy','','','?','?'
|
|
4
|
+
6535,3223234816,4,'HIP 10175 Bush Meat','','','?','?'
|
|
5
|
+
6536,3222822912,4,'Albino Quechua Mammoth Meat','','','?','?'
|
|
6
|
+
6537,128037120,4,'Utgaroar Millennial Eggs','','','?','?'
|
|
7
|
+
6538,3223358720,4,'Witchhaul Kobe Beef','','','?','?'
|
|
8
|
+
6539,3225028096,4,'Karsuki Locusts','','','?','?'
|
|
9
|
+
6540,3225345792,4,'Giant Irukama Snails','','','?','?'
|
|
10
|
+
6541,128088056,4,'Baltah''sine Vacuum Krill','','','?','?'
|
|
11
|
+
6542,3222560000,4,'Ceti Rabbits','','','?','?'
|
|
12
|
+
6543,3221595648,7,'Kachirigin Filter Leeches','','','?','?'
|
|
13
|
+
6544,3226417152,8,'Lyrae Weed','','','?','?'
|
|
14
|
+
6545,128129272,8,'Onionhead','','','?','?'
|
|
15
|
+
6546,128041984,8,'Tarach Spice','','','?','?'
|
|
16
|
+
6547,128084984,8,'Wolf Fesh','','','?','?'
|
|
17
|
+
6548,3229638400,11,'Borasetani Pathogenetics','','','?','?'
|
|
18
|
+
6549,3223177472,11,'HIP 118311 Swarm','','','?','?'
|
|
19
|
+
6550,3226978048,8,'Kongga Ale','','','?','?'
|
|
20
|
+
6551,3222155776,8,'Wuthielo Ku Froth','','','?','?'
|
|
21
|
+
6552,3231373824,12,'Alacarakmo Skin Art','','','?','?'
|
|
22
|
+
6553,3230624768,12,'Eleu Thermals','','','?','?'
|
|
23
|
+
6554,3222295552,12,'Eshu Umbrellas','','','?','?'
|
|
24
|
+
6555,3227333120,12,'Karetii Couture','','','?','?'
|
|
25
|
+
6556,3222416896,12,'Njangari Saddles','','','?','?'
|
|
26
|
+
6557,3229880064,4,'Any Na Coffee','','','?','?'
|
|
27
|
+
6558,3228566016,4,'CD-75 Kitten Brand Coffee','','','?','?'
|
|
28
|
+
6559,3224449792,4,'Goman Yaupon Coffee','','','?','?'
|
|
29
|
+
6560,3227831808,9,'Volkhab Bee Drones','','','?','?'
|
|
30
|
+
6561,3227394304,12,'Kinago Violins','','','?','?'
|
|
31
|
+
6562,3221538304,12,'Nguna Modern Antiques','','','?','?'
|
|
32
|
+
6563,3227512320,12,'Rajukru Multi-Stoves','','','?','?'
|
|
33
|
+
6564,3224141312,12,'Tiolce Waste2Paste Units','','','?','?'
|
|
34
|
+
6565,128128760,4,'Chi Eridani Marine Paste','','','?','?'
|
|
35
|
+
6566,3226919680,4,'Esuseku Caviar','','','?','?'
|
|
36
|
+
6567,128042496,4,'Live Hecate Sea Worms','','','?','?'
|
|
37
|
+
6568,3231094528,1,'Helvetitj Pearls','','','?','?'
|
|
38
|
+
6569,3227995392,4,'HIP Proto-Squid','','','?','?'
|
|
39
|
+
6570,3223832576,4,'Coquim Spongiform Victuals','','','?','?'
|
|
40
|
+
6571,128083448,4,'Eden Apples of Aerial','','','?','?'
|
|
41
|
+
6572,3228206080,4,'Neritus Berries','','','?','?'
|
|
42
|
+
6573,3226719232,4,'Ochoeng Chillies','','','?','?'
|
|
43
|
+
6574,3229713408,4,'Deuringas Truffles','','','?','?'
|
|
44
|
+
6575,3226170880,4,'HR 7221 Wheat','','','?','?'
|
|
45
|
+
6576,3224698112,4,'Jaroua Rice','','','?','?'
|
|
46
|
+
6577,3223537152,5,'Belalans Ray Leather','','','?','?'
|
|
47
|
+
6578,3227751936,5,'Damna Carapaces','','','?','?'
|
|
48
|
+
6579,3222875648,5,'Rapa Bao Snake Skins','','','?','?'
|
|
49
|
+
6580,3227289856,5,'Vanayequi Ceratomorpha Fur','','','?','?'
|
|
50
|
+
6581,128086776,8,'Bast Snake Gin','','','?','?'
|
|
51
|
+
6582,3226522368,8,'Thrutis Cream','','','?','?'
|
|
52
|
+
6583,3221388032,9,'Wulpa Hyperbore Systems','','','?','?'
|
|
53
|
+
6584,128012800,7,'Aganippe Rush','','','?','?'
|
|
54
|
+
6585,128051466,7,'Terra Mater Blood Bores','','','?','?'
|
|
55
|
+
6586,3222713088,11,'Holva Duelling Blades','','','?','?'
|
|
56
|
+
6587,3221669632,11,'Kamorin Historic Weapons','','','?','?'
|
|
57
|
+
6588,3226857216,11,'Gilya Signature Weapons','','','?','?'
|
|
58
|
+
6589,128045312,3,'Delta Phoenicis Palms','','','?','?'
|
|
59
|
+
6590,3230258688,3,'Toxandji Virocide','','','?','?'
|
|
60
|
+
6591,3224133120,10,'Xihe Biomorphic Companions','','','?','?'
|
|
61
|
+
6592,3230331136,4,'Sanuma Decorative Meat','','','?','?'
|
|
62
|
+
6593,3229524992,4,'Ethgreze Tea Buds','','','?','?'
|
|
63
|
+
6594,3227417856,4,'Ceremonial Heike Tea','','','?','?'
|
|
64
|
+
6595,128057866,4,'Tanmark Tranquil Tea','','','?','?'
|
|
65
|
+
6596,3228400128,10,'AZ Cancri Formula 42','','','?','?'
|
|
66
|
+
6597,3225450752,8,'Kamitra Cigars','','','?','?'
|
|
67
|
+
6598,3229255680,8,'Rusani Old Smokey','','','?','?'
|
|
68
|
+
6599,3223088640,8,'Yaso Kondi Leaf','','','?','?'
|
|
69
|
+
6600,3228416768,8,'Chateau De Aegaeon','','','?','?'
|
|
70
|
+
6601,128666762,7,'The Waters of Shintara','','','?','?'
|
|
71
|
+
6602,3228939264,12,'Ophiuch Exino Artefacts','','','?','?'
|
|
72
|
+
6603,3229378560,4,'Baked Greebles','','','?','?'
|
|
73
|
+
6604,3222560256,4,'Aepyornis Egg','','','?','?'
|
|
74
|
+
6605,3227986432,8,'Saxon Wine','','','?','?'
|
|
75
|
+
6606,3228728832,8,'Centauri Mega Gin','','','?','?'
|
|
76
|
+
6607,3230243584,12,'Anduliga Fire Works','','','?','?'
|
|
77
|
+
6608,3228346112,5,'Banki Amphibious Leather','','','?','?'
|
|
78
|
+
6609,3229594624,1,'Cherbones Blood Crystals','','','?','?'
|
|
79
|
+
6610,3229750528,8,'Motrona Experience Jelly','','','?','?'
|
|
80
|
+
6611,3230954752,8,'Geawen Dance Dust','','','?','?'
|
|
81
|
+
6612,3228047360,8,'Gerasian Gueuze Beer','','','?','?'
|
|
82
|
+
6613,3226557696,4,'Haiden Black Brew','','','?','?'
|
|
83
|
+
6614,3221438976,12,'Havasupai Dream Catcher','','','?','?'
|
|
84
|
+
6615,3230224384,8,'Burnham Bile Distillate','','','?','?'
|
|
85
|
+
6616,3227036160,3,'HIP Organophosphates','','','?','?'
|
|
86
|
+
6617,3230754816,12,'Jaradharre Puzzle Box','','','?','?'
|
|
87
|
+
6618,3228726272,3,'Koro Kung Pellets','','','?','?'
|
|
88
|
+
6619,3229028864,4,'Void Extract Coffee','','','?','?'
|
|
89
|
+
6620,3229561344,7,'Honesty Pills','','','?','?'
|
|
90
|
+
6621,3224135424,9,'Non Euclidian Exotanks','','','?','?'
|
|
91
|
+
6622,3224166400,4,'LTT Hyper Sweet','','','?','?'
|
|
92
|
+
6623,3228398848,4,'Mechucos High Tea','','','?','?'
|
|
93
|
+
6624,3228762368,3,'Medb Starlube','','','?','?'
|
|
94
|
+
6625,3229612800,4,'Mokojing Beast Feast','','','?','?'
|
|
95
|
+
6626,3221719296,4,'Mukusubii Chitin-os','','','?','?'
|
|
96
|
+
6627,3228892672,4,'Mulachi Giant Fungus','','','?','?'
|
|
97
|
+
6628,3226127872,1,'Ngadandari Fire Opals','','','?','?'
|
|
98
|
+
6629,3227726848,5,'Tiegfries Synth Silk','','','?','?'
|
|
99
|
+
6630,3226474496,12,'Uzumoku Low-G Wings','','','?','?'
|
|
100
|
+
6631,3228959232,7,'V Herculis Body Rub','','','?','?'
|
|
101
|
+
6632,3225032704,4,'Wheemete Wheat Cakes','','','?','?'
|
|
102
|
+
6633,128149240,7,'Vega Slimweed','','','?','?'
|
|
103
|
+
6634,128151032,12,'Altairian Skin','','','?','?'
|
|
104
|
+
6635,128117240,8,'Pavonis Ear Grubs','','','?','?'
|
|
105
|
+
6636,128078840,5,'Jotun Mookah','','','?','?'
|
|
106
|
+
6637,128121336,9,'Giant Verrix','','','?','?'
|
|
107
|
+
6638,128118520,8,'Indi Bourbon','','','?','?'
|
|
108
|
+
6639,128098040,4,'Arouca Conventual Sweets','','','?','?'
|
|
109
|
+
6640,128134648,12,'Tauri Chimes','','','?','?'
|
|
110
|
+
6641,128125432,12,'Zeessze Ant Grub Glue','','','?','?'
|
|
111
|
+
6642,3228824064,7,'Pantaa Prayer Sticks','','','?','?'
|
|
112
|
+
6643,128134392,4,'Fujin Tea','','','?','?'
|
|
113
|
+
6644,3223418880,5,'Chameleon Cloth','','','?','?'
|
|
114
|
+
6645,128166392,4,'Orrerian Vicious Brew','','','?','?'
|
|
115
|
+
6646,128164856,4,'Uszaian Tree Grub','','','?','?'
|
|
116
|
+
6647,128075256,12,'Momus Bog Spaniel','','','?','?'
|
|
117
|
+
6648,128161016,4,'Diso Ma Corn','','','?','?'
|
|
118
|
+
6649,128639992,8,'Leestian Evil Juice','','','?','?'
|
|
119
|
+
6650,128639992,4,'Azure Milk','','','?','?'
|
|
120
|
+
6651,128164088,12,'Leathery Eggs','','','?','?'
|
|
121
|
+
6652,3221638400,7,'Alya Body Soap','','','?','?'
|
|
122
|
+
6653,3231082240,12,'Vidavantian Lace','','','?','?'
|
|
123
|
+
6654,128057866,8,'Lucan Onionhead','','','?','?'
|
|
124
|
+
6655,128667761,12,'Jaques Quinentian Still','','','?','?'
|
|
125
|
+
6656,3225348096,12,'Soontill Relics','','','?','?'
|
|
126
|
+
6657,3227172352,12,'Ultra-Compact Processor Prototypes','','','?','?'
|
|
127
|
+
6658,3228728832,12,'The Hutton Mug','','','?','?'
|
|
128
|
+
6659,128668557,1,'Sothis Crystalline Gold','','','?','?'
|
|
129
|
+
6660,128123640,13,'Master Chefs','','','?','?'
|
|
130
|
+
6661,3223105792,16,'Festive Gifts','','','?','?'
|
|
131
|
+
6662,128059402,16,'Crystalline Spheres','','','?','?'
|
|
132
|
+
6663,3226977024,8,'Onionhead Alpha Strain','','','?','?'
|
|
133
|
+
6664,3223027200,8,'Onionhead Beta Strain','','','?','?'
|
|
134
|
+
6665,128673074,16,'Galactic Travel Guide','','','?','?'
|
|
135
|
+
6666,3228463360,8,'Crom Silver Fesh','','','?','?'
|
|
136
|
+
6667,128107768,12,'Shan''s Charis Orchid','','','?','?'
|
|
137
|
+
6668,128745551,12,'Buckyball Beer Mats','','','?','?'
|
|
138
|
+
6669,3221575424,8,'Harma Silver Sea Rum','','','?','?'
|
|
139
|
+
6670,3223779840,1,'Platinum Alloy','','','?','?'
|
|
140
|
+
6671,3226651904,7,'Nanomedicines','','','?','?'
|
|
141
|
+
6672,3223453184,12,'Duradrives','','','?','?'
|
|
142
|
+
6673,128958681,8,'Apa Vietii','','','?','?'
|
|
143
|
+
6674,128986325,10,'Classified Experimental Equipment','','','?','?'
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
-- Definitions for all of the tables used in the SQLite
|
|
2
|
+
-- cache database.
|
|
3
|
+
--
|
|
4
|
+
-- Source data for TradeDangerous is stored in various
|
|
5
|
+
-- ".csv" files which provide relatively constant data
|
|
6
|
+
-- such as star names, the list of known tradeable items,
|
|
7
|
+
-- etc.
|
|
8
|
+
--
|
|
9
|
+
-- Per-station price data is sourced from ".prices" files
|
|
10
|
+
-- which are designed to be human readable text that
|
|
11
|
+
-- closely aproximates the in-game UI.
|
|
12
|
+
--
|
|
13
|
+
-- When the .SQL file or the .CSV files change, TD will
|
|
14
|
+
-- destroy and rebuild the cache next time it is run.
|
|
15
|
+
--
|
|
16
|
+
-- When the .prices file is changed, only the price data
|
|
17
|
+
-- is reset.
|
|
18
|
+
--
|
|
19
|
+
-- You can edit this file, if you really need to, if you know
|
|
20
|
+
-- what you are doing. Or you can use the 'sqlite3' command
|
|
21
|
+
-- to edit the .db database and then use the '.dump' command
|
|
22
|
+
-- to regenerate this file, except then you'll lose this nice
|
|
23
|
+
-- header and I might have to wag my finger at you.
|
|
24
|
+
--
|
|
25
|
+
-- -Oliver
|
|
26
|
+
|
|
27
|
+
PRAGMA foreign_keys=ON;
|
|
28
|
+
PRAGMA synchronous=OFF;
|
|
29
|
+
PRAGMA temp_store=MEMORY;
|
|
30
|
+
PRAGMA journal_mode=WAL;
|
|
31
|
+
PRAGMA auto_vacuum=INCREMENTAL;
|
|
32
|
+
|
|
33
|
+
BEGIN TRANSACTION;
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
CREATE TABLE Added
|
|
37
|
+
(
|
|
38
|
+
added_id INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
39
|
+
name VARCHAR(40) COLLATE nocase,
|
|
40
|
+
|
|
41
|
+
UNIQUE(name)
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
CREATE TABLE System
|
|
46
|
+
(
|
|
47
|
+
system_id BIGINT PRIMARY KEY,
|
|
48
|
+
name VARCHAR(40) COLLATE nocase,
|
|
49
|
+
pos_x DOUBLE NOT NULL,
|
|
50
|
+
pos_y DOUBLE NOT NULL,
|
|
51
|
+
pos_z DOUBLE NOT NULL,
|
|
52
|
+
added_id INTEGER,
|
|
53
|
+
modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
54
|
+
|
|
55
|
+
UNIQUE (system_id),
|
|
56
|
+
|
|
57
|
+
FOREIGN KEY (added_id) REFERENCES Added(added_id)
|
|
58
|
+
ON UPDATE CASCADE
|
|
59
|
+
ON DELETE CASCADE
|
|
60
|
+
);
|
|
61
|
+
CREATE INDEX idx_system_by_pos ON System (pos_x, pos_y, pos_z, system_id);
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
CREATE TABLE Station
|
|
65
|
+
(
|
|
66
|
+
station_id BIGINT PRIMARY KEY,
|
|
67
|
+
name VARCHAR(40) COLLATE nocase,
|
|
68
|
+
system_id BIGINT NOT NULL,
|
|
69
|
+
ls_from_star INTEGER NOT NULL DEFAULT 0
|
|
70
|
+
CHECK (ls_from_star >= 0),
|
|
71
|
+
blackmarket TEXT(1) NOT NULL DEFAULT '?'
|
|
72
|
+
CHECK (blackmarket IN ('?', 'Y', 'N')),
|
|
73
|
+
max_pad_size TEXT(1) NOT NULL DEFAULT '?'
|
|
74
|
+
CHECK (max_pad_size IN ('?', 'S', 'M', 'L')),
|
|
75
|
+
market TEXT(1) NOT NULL DEFAULT '?'
|
|
76
|
+
CHECK (market IN ('?', 'Y', 'N')),
|
|
77
|
+
shipyard TEXT(1) NOT NULL DEFAULT '?'
|
|
78
|
+
CHECK (shipyard IN ('?', 'Y', 'N')),
|
|
79
|
+
modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
80
|
+
outfitting TEXT(1) NOT NULL DEFAULT '?'
|
|
81
|
+
CHECK (outfitting IN ('?', 'Y', 'N')),
|
|
82
|
+
rearm TEXT(1) NOT NULL DEFAULT '?'
|
|
83
|
+
CHECK (rearm IN ('?', 'Y', 'N')),
|
|
84
|
+
refuel TEXT(1) NOT NULL DEFAULT '?'
|
|
85
|
+
CHECK (refuel IN ('?', 'Y', 'N')),
|
|
86
|
+
repair TEXT(1) NOT NULL DEFAULT '?'
|
|
87
|
+
CHECK (repair IN ('?', 'Y', 'N')),
|
|
88
|
+
planetary TEXT(1) NOT NULL DEFAULT '?'
|
|
89
|
+
CHECK (planetary IN ('?', 'Y', 'N')),
|
|
90
|
+
type_id INTEGER DEFAULT 0 NOT NULL,
|
|
91
|
+
|
|
92
|
+
UNIQUE (station_id),
|
|
93
|
+
|
|
94
|
+
FOREIGN KEY (system_id) REFERENCES System(system_id)
|
|
95
|
+
ON DELETE CASCADE
|
|
96
|
+
) WITHOUT ROWID;
|
|
97
|
+
CREATE INDEX idx_station_by_system ON Station (system_id);
|
|
98
|
+
CREATE INDEX idx_station_by_name ON Station (name);
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
CREATE TABLE Ship
|
|
102
|
+
(
|
|
103
|
+
ship_id INTEGER PRIMARY KEY,
|
|
104
|
+
name VARCHAR(40) COLLATE nocase,
|
|
105
|
+
cost INTEGER,
|
|
106
|
+
|
|
107
|
+
UNIQUE (ship_id)
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
CREATE TABLE ShipVendor
|
|
112
|
+
(
|
|
113
|
+
ship_id INTEGER NOT NULL,
|
|
114
|
+
station_id BIGINT NOT NULL,
|
|
115
|
+
modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
116
|
+
|
|
117
|
+
PRIMARY KEY (ship_id, station_id),
|
|
118
|
+
|
|
119
|
+
FOREIGN KEY (ship_id) REFERENCES Ship(ship_id)
|
|
120
|
+
ON UPDATE CASCADE
|
|
121
|
+
ON DELETE CASCADE,
|
|
122
|
+
FOREIGN KEY (station_id) REFERENCES Station(station_id)
|
|
123
|
+
ON UPDATE CASCADE
|
|
124
|
+
ON DELETE CASCADE
|
|
125
|
+
) WITHOUT ROWID
|
|
126
|
+
;
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
CREATE TABLE Upgrade
|
|
130
|
+
(
|
|
131
|
+
upgrade_id INTEGER PRIMARY KEY,
|
|
132
|
+
name VARCHAR(40) COLLATE nocase,
|
|
133
|
+
class NUMBER NOT NULL,
|
|
134
|
+
rating CHAR(1) NOT NULL,
|
|
135
|
+
ship VARCHAR(40) COLLATE nocase,
|
|
136
|
+
|
|
137
|
+
UNIQUE (upgrade_id)
|
|
138
|
+
);
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
CREATE TABLE UpgradeVendor
|
|
142
|
+
(
|
|
143
|
+
upgrade_id INTEGER NOT NULL,
|
|
144
|
+
station_id BIGINT NOT NULL,
|
|
145
|
+
modified DATETIME NOT NULL,
|
|
146
|
+
|
|
147
|
+
PRIMARY KEY (upgrade_id, station_id),
|
|
148
|
+
|
|
149
|
+
FOREIGN KEY (upgrade_id) REFERENCES Upgrade(upgrade_id)
|
|
150
|
+
ON UPDATE CASCADE
|
|
151
|
+
ON DELETE CASCADE,
|
|
152
|
+
FOREIGN KEY (station_id) REFERENCES Station(station_id)
|
|
153
|
+
ON UPDATE CASCADE
|
|
154
|
+
ON DELETE CASCADE
|
|
155
|
+
) WITHOUT ROWID
|
|
156
|
+
;
|
|
157
|
+
CREATE INDEX idx_vendor_by_station_id ON UpgradeVendor (station_id);
|
|
158
|
+
|
|
159
|
+
CREATE TABLE RareItem
|
|
160
|
+
(
|
|
161
|
+
rare_id INTEGER PRIMARY KEY,
|
|
162
|
+
station_id INTEGER NOT NULL,
|
|
163
|
+
category_id INTEGER NOT NULL,
|
|
164
|
+
name VARCHAR(40) COLLATE nocase,
|
|
165
|
+
cost INTEGER,
|
|
166
|
+
max_allocation INTEGER,
|
|
167
|
+
illegal TEXT(1) NOT NULL DEFAULT '?'
|
|
168
|
+
CHECK (illegal IN ('?', 'Y', 'N')),
|
|
169
|
+
suppressed TEXT(1) NOT NULL DEFAULT '?'
|
|
170
|
+
CHECK (suppressed IN ('?', 'Y', 'N')),
|
|
171
|
+
|
|
172
|
+
UNIQUE (name),
|
|
173
|
+
|
|
174
|
+
FOREIGN KEY (station_id) REFERENCES Station(station_id)
|
|
175
|
+
ON UPDATE CASCADE
|
|
176
|
+
ON DELETE CASCADE,
|
|
177
|
+
FOREIGN KEY (category_id) REFERENCES Category(category_id)
|
|
178
|
+
ON UPDATE CASCADE
|
|
179
|
+
ON DELETE CASCADE
|
|
180
|
+
)
|
|
181
|
+
;
|
|
182
|
+
|
|
183
|
+
CREATE TABLE Category
|
|
184
|
+
(
|
|
185
|
+
category_id INTEGER PRIMARY KEY,
|
|
186
|
+
name VARCHAR(40) COLLATE nocase,
|
|
187
|
+
|
|
188
|
+
UNIQUE (category_id)
|
|
189
|
+
);
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
CREATE TABLE Item
|
|
193
|
+
(
|
|
194
|
+
item_id INTEGER PRIMARY KEY,
|
|
195
|
+
name VARCHAR(40) COLLATE nocase,
|
|
196
|
+
category_id INTEGER NOT NULL,
|
|
197
|
+
ui_order INTEGER NOT NULL DEFAULT 0,
|
|
198
|
+
avg_price INTEGER,
|
|
199
|
+
fdev_id INTEGER,
|
|
200
|
+
|
|
201
|
+
UNIQUE (item_id),
|
|
202
|
+
|
|
203
|
+
FOREIGN KEY (category_id) REFERENCES Category(category_id)
|
|
204
|
+
ON UPDATE CASCADE
|
|
205
|
+
ON DELETE CASCADE
|
|
206
|
+
);
|
|
207
|
+
CREATE INDEX idx_item_by_fdev_id ON Item (fdev_id);
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
CREATE TABLE StationItem
|
|
211
|
+
(
|
|
212
|
+
station_id BIGINT NOT NULL,
|
|
213
|
+
item_id INTEGER NOT NULL,
|
|
214
|
+
demand_price INT NOT NULL,
|
|
215
|
+
demand_units INT NOT NULL,
|
|
216
|
+
demand_level INT NOT NULL,
|
|
217
|
+
supply_price INT NOT NULL,
|
|
218
|
+
supply_units INT NOT NULL,
|
|
219
|
+
supply_level INT NOT NULL,
|
|
220
|
+
modified DATETIME DEFAULT CURRENT_TIMESTAMP NOT NULL,
|
|
221
|
+
from_live INTEGER DEFAULT 0 NOT NULL,
|
|
222
|
+
|
|
223
|
+
PRIMARY KEY (station_id, item_id),
|
|
224
|
+
FOREIGN KEY (station_id) REFERENCES Station(station_id)
|
|
225
|
+
ON UPDATE CASCADE ON DELETE CASCADE,
|
|
226
|
+
FOREIGN KEY (item_id) REFERENCES Item(item_id)
|
|
227
|
+
ON UPDATE CASCADE ON DELETE CASCADE
|
|
228
|
+
) WITHOUT ROWID;
|
|
229
|
+
CREATE INDEX si_mod_stn_itm ON StationItem(modified, station_id, item_id);
|
|
230
|
+
CREATE INDEX si_itm_dmdpr ON StationItem(item_id, demand_price) WHERE demand_price > 0;
|
|
231
|
+
CREATE INDEX si_itm_suppr ON StationItem(item_id, supply_price) WHERE supply_price > 0;
|
|
232
|
+
|
|
233
|
+
-- Not used yet
|
|
234
|
+
CREATE TABLE IF NOT EXISTS StationDemand
|
|
235
|
+
(
|
|
236
|
+
station_id INTEGER NOT NULL,
|
|
237
|
+
item_id INTEGER NOT NULL,
|
|
238
|
+
price INTEGER NOT NULL,
|
|
239
|
+
units INTEGER NOT NULL,
|
|
240
|
+
level INTEGER NOT NULL,
|
|
241
|
+
modified INTEGER NOT NULL,
|
|
242
|
+
from_live INTEGER NOT NULL DEFAULT 0,
|
|
243
|
+
CONSTRAINT pk_StationDemand PRIMARY KEY (station_id, item_id),
|
|
244
|
+
CONSTRAINT fk_StationDemand_station_id_Station FOREIGN KEY (station_id) REFERENCES Station (station_id) ON DELETE CASCADE,
|
|
245
|
+
CONSTRAINT fk_StationDemand_item_id_Item FOREIGN KEY (item_id) REFERENCES Item (item_id) ON DELETE CASCADE
|
|
246
|
+
) WITHOUT ROWID;
|
|
247
|
+
DELETE FROM StationDemand;
|
|
248
|
+
CREATE INDEX idx_StationDemand_item ON StationDemand (item_id);
|
|
249
|
+
|
|
250
|
+
-- Not used yet
|
|
251
|
+
CREATE TABLE IF NOT EXISTS StationSupply
|
|
252
|
+
(
|
|
253
|
+
station_id INTEGER NOT NULL,
|
|
254
|
+
item_id INTEGER NOT NULL,
|
|
255
|
+
price INTEGER NOT NULL,
|
|
256
|
+
units INTEGER NOT NULL,
|
|
257
|
+
level INTEGER NOT NULL,
|
|
258
|
+
modified INTEGER NOT NULL,
|
|
259
|
+
from_live INTEGER NOT NULL DEFAULT 0,
|
|
260
|
+
CONSTRAINT pk_StationSupply PRIMARY KEY (station_id, item_id),
|
|
261
|
+
CONSTRAINT fk_StationSupply_station_id_Station FOREIGN KEY (station_id) REFERENCES Station (station_id) ON DELETE CASCADE,
|
|
262
|
+
CONSTRAINT fk_StationSupply_item_id_Item FOREIGN KEY (item_id) REFERENCES Item (item_id) ON DELETE CASCADE
|
|
263
|
+
) WITHOUT ROWID;
|
|
264
|
+
DELETE FROM StationSupply;
|
|
265
|
+
CREATE INDEX idx_StationSupply_item ON StationSupply (item_id);
|
|
266
|
+
|
|
267
|
+
CREATE VIEW StationBuying AS
|
|
268
|
+
SELECT station_id,
|
|
269
|
+
item_id,
|
|
270
|
+
demand_price AS price,
|
|
271
|
+
demand_units AS units,
|
|
272
|
+
demand_level AS level,
|
|
273
|
+
modified
|
|
274
|
+
FROM StationItem
|
|
275
|
+
WHERE demand_price > 0
|
|
276
|
+
;
|
|
277
|
+
|
|
278
|
+
CREATE VIEW StationSelling AS
|
|
279
|
+
SELECT station_id,
|
|
280
|
+
item_id,
|
|
281
|
+
supply_price AS price,
|
|
282
|
+
supply_units AS units,
|
|
283
|
+
supply_level AS level,
|
|
284
|
+
modified
|
|
285
|
+
FROM StationItem
|
|
286
|
+
WHERE supply_price > 0
|
|
287
|
+
;
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
--
|
|
291
|
+
-- The next two tables (FDevShipyard, FDevOutfitting) are
|
|
292
|
+
-- used to map the FDev API IDs to data ready for EDDN.
|
|
293
|
+
--
|
|
294
|
+
-- The column names are the same as the header line from
|
|
295
|
+
-- the EDCD/FDevIDs csv files, so we can just download the
|
|
296
|
+
-- files (shipyard.csv, outfitting.csv) and save them
|
|
297
|
+
-- as (FDevShipyard.csv, FDevOutfitting.csv) into the
|
|
298
|
+
-- data directory.
|
|
299
|
+
--
|
|
300
|
+
-- see https://github.com/EDCD/FDevIDs
|
|
301
|
+
--
|
|
302
|
+
-- The commodity.csv is not needed because TD and EDDN
|
|
303
|
+
-- are using the same names.
|
|
304
|
+
--
|
|
305
|
+
-- -Bernd
|
|
306
|
+
|
|
307
|
+
CREATE TABLE FDevShipyard
|
|
308
|
+
(
|
|
309
|
+
id INTEGER NOT NULL,
|
|
310
|
+
symbol VARCHAR(40),
|
|
311
|
+
name VARCHAR(40) COLLATE nocase,
|
|
312
|
+
entitlement VARCHAR(50),
|
|
313
|
+
|
|
314
|
+
UNIQUE (id)
|
|
315
|
+
);
|
|
316
|
+
|
|
317
|
+
|
|
318
|
+
CREATE TABLE FDevOutfitting
|
|
319
|
+
(
|
|
320
|
+
id INTEGER NOT NULL,
|
|
321
|
+
symbol VARCHAR(40),
|
|
322
|
+
category CHAR(10)
|
|
323
|
+
CHECK (category IN ('hardpoint','internal','standard','utility')),
|
|
324
|
+
name VARCHAR(40) COLLATE nocase,
|
|
325
|
+
mount CHAR(10)
|
|
326
|
+
CHECK (mount IN (NULL, 'Fixed','Gimballed','Turreted')),
|
|
327
|
+
guidance CHAR(10)
|
|
328
|
+
CHECK (guidance IN (NULL, 'Dumbfire','Seeker','Swarm')),
|
|
329
|
+
ship VARCHAR(40) COLLATE nocase,
|
|
330
|
+
class CHAR(1) NOT NULL,
|
|
331
|
+
rating CHAR(1) NOT NULL,
|
|
332
|
+
entitlement VARCHAR(50),
|
|
333
|
+
|
|
334
|
+
UNIQUE (id)
|
|
335
|
+
);
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
COMMIT;
|
tradedangerous/tools.py
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# --------------------------------------------------------------------
|
|
2
|
+
# Copyright (C) Oliver 'kfsone' Smith 2014 <oliver@kfs.org>:
|
|
3
|
+
# Copyright (C) Bernd 'Gazelle' Gollesch 2016, 2017
|
|
4
|
+
# Copyright (C) Jonathan 'eyeonus' Jones 2018, 2019
|
|
5
|
+
#
|
|
6
|
+
# You are free to use, redistribute, or even print and eat a copy of
|
|
7
|
+
# this software so long as you include this copyright notice.
|
|
8
|
+
# I guarantee there is at least one bug neither of us knew about.
|
|
9
|
+
# --------------------------------------------------------------------
|
|
10
|
+
# TradeDangerous :: Modules :: Tools
|
|
11
|
+
"""This module contains various tools that could be used
|
|
12
|
+
externally and internally.
|
|
13
|
+
"""
|
|
14
|
+
from . import tradedb, utils
|
|
15
|
+
|
|
16
|
+
__all__ = ['test_derp']
|
|
17
|
+
|
|
18
|
+
def test_derp(tdb=None, tdenv=None):
|
|
19
|
+
"""
|
|
20
|
+
Test whether the station names in a trade database are free of derp.
|
|
21
|
+
|
|
22
|
+
Examples:
|
|
23
|
+
import tradedb
|
|
24
|
+
tdb = tradedb.TradeDB()
|
|
25
|
+
test_derp(tdb)
|
|
26
|
+
|
|
27
|
+
python -i cache.py
|
|
28
|
+
>>> test_derp()
|
|
29
|
+
"""
|
|
30
|
+
tdb = tdb or tradedb.TradeDB()
|
|
31
|
+
tdenv = tdenv or tdb.tdenv
|
|
32
|
+
matches = 0
|
|
33
|
+
for stn in tdb.stationByID.values():
|
|
34
|
+
m = utils.checkForOcrDerp(tdenv, stn.system.dbname, stn.dbname)
|
|
35
|
+
if m:
|
|
36
|
+
print("Match", m.groups(1))
|
|
37
|
+
matches += 1
|
|
38
|
+
if not matches:
|
|
39
|
+
print("Current data is free of known derp")
|
|
40
|
+
tdb.close()
|