From bfd631bf29bc23513e30640651ded45388aa1256 Mon Sep 17 00:00:00 2001 From: Colin McLeod Date: Thu, 21 Jan 2016 22:05:11 -0800 Subject: [PATCH] Data clean up, tests added --- Modules.js | 2 +- Ships.js | 2 +- index.js | 135 +++++++++--------- .../internal/auto_field_maintenance_unit.json | 80 +++++------ modules/internal/cargo_rack.json | 16 +-- modules/internal/internal_fuel_tank.json | 16 +-- modules/internal/scanner.json | 8 +- modules/standard/fuel_tank.json | 16 +-- package.json | 2 + ships/adder.json | 2 +- ships/imperial_eagle.json | 2 +- spec/data-spec.js | 105 ++++++++++++++ 12 files changed, 244 insertions(+), 142 deletions(-) create mode 100644 spec/data-spec.js diff --git a/Modules.js b/Modules.js index 6fdc8e8..1031b00 100644 --- a/Modules.js +++ b/Modules.js @@ -35,10 +35,10 @@ module.exports = { dc: require('./modules/internal/docking_computer').dc, fi: require('./modules/internal/frame_shift_drive_interdictor').fi, fs: require('./modules/internal/fuel_scoop').fs, + ft: require('./modules/internal/internal_fuel_tank').ft, fx: require('./modules/internal/fuel_transfer_limpet_controllers').fx, hb: require('./modules/internal/hatch_breaker_limpet_controller').hb, hr: require('./modules/internal/hull_reinforcement_package').hr, - ft: require('./modules/internal/internal_fuel_tank').ft, pv: require('./modules/internal/planetary_vehicle_hanger').pv, psg: require('./modules/internal/pristmatic_shield_generator').psg, pc: require('./modules/internal/prospector_limpet_controllers').pc, diff --git a/Ships.js b/Ships.js index cf701cd..4d60f5a 100644 --- a/Ships.js +++ b/Ships.js @@ -27,5 +27,5 @@ module.exports = { type_9_heavy: require('./ships/type_9_heavy').type_9_heavy, viper: require('./ships/viper').viper, viper_mk_iv: require('./ships/viper_mk_iv').viper_mk_iv, - vulture: require('./ships/vulture').vulture, + vulture: require('./ships/vulture').vulture }; \ No newline at end of file diff --git a/index.js b/index.js index 29180b3..6a2f6a6 100644 --- a/index.js +++ b/index.js @@ -4508,7 +4508,7 @@ module.exports = { "class": 1, rating: "C", cost: 1e3, - capacity: 2 + fuel: 2 }, "2C": { id: "f2", @@ -4517,7 +4517,7 @@ module.exports = { "class": 2, rating: "C", cost: 3750, - capacity: 4 + fuel: 4 }, "3C": { id: "f3", @@ -4526,7 +4526,7 @@ module.exports = { "class": 3, rating: "C", cost: 7060, - capacity: 8 + fuel: 8 }, "4C": { id: "f4", @@ -4535,7 +4535,7 @@ module.exports = { "class": 4, rating: "C", cost: 24730, - capacity: 16 + fuel: 16 }, "5C": { id: "f5", @@ -4544,7 +4544,7 @@ module.exports = { "class": 5, rating: "C", cost: 97750, - capacity: 32 + fuel: 32 }, "6C": { id: "f6", @@ -4553,7 +4553,7 @@ module.exports = { "class": 6, rating: "C", cost: 341580, - capacity: 64 + fuel: 64 }, "7C": { id: "f7", @@ -4562,7 +4562,7 @@ module.exports = { "class": 7, rating: "C", cost: 1780910, - capacity: 128 + fuel: 128 }, "8C": { id: "f8", @@ -4571,7 +4571,7 @@ module.exports = { "class": 8, rating: "C", cost: 5428400, - capacity: 256 + fuel: 256 } } ], hardpoints: { @@ -6385,7 +6385,7 @@ module.exports = { power: 1.8, ammo: 1e4, repair: 120, - ammocost: 100 + ammocost: 1 }, { id: "1e", eddbID: 1343, @@ -6396,7 +6396,7 @@ module.exports = { power: 2.4, ammo: 9e3, repair: 144, - ammocost: 100 + ammocost: 1 }, { id: "1d", eddbID: 1351, @@ -6407,7 +6407,7 @@ module.exports = { power: 3, ammo: 1e4, repair: 200, - ammocost: 100 + ammocost: 1 }, { id: "1c", eddbID: 1359, @@ -6418,7 +6418,7 @@ module.exports = { power: 3.45, ammo: 12e3, repair: 276, - ammocost: 100 + ammocost: 1 }, { id: "1b", eddbID: 1367, @@ -6429,7 +6429,7 @@ module.exports = { power: 4.2, ammo: 11e3, repair: 308, - ammocost: 100 + ammocost: 1 }, { id: "1a", eddbID: 1334, @@ -6440,7 +6440,7 @@ module.exports = { power: 1.58, ammo: 8700, repair: 104.4, - ammocost: 100 + ammocost: 1 }, { id: "19", eddbID: 1342, @@ -6451,7 +6451,7 @@ module.exports = { power: 2.1, ammo: 7800, repair: 124.8, - ammocost: 100 + ammocost: 1 }, { id: "18", eddbID: 1350, @@ -6462,7 +6462,7 @@ module.exports = { power: 2.63, ammo: 8700, repair: 174, - ammocost: 100 + ammocost: 1 }, { id: "17", eddbID: 1358, @@ -6473,7 +6473,7 @@ module.exports = { power: 3.02, ammo: 10400, repair: 239.2, - ammocost: 100 + ammocost: 1 }, { id: "16", eddbID: 1366, @@ -6484,7 +6484,7 @@ module.exports = { power: 3.68, ammo: 9600, repair: 268.8, - ammocost: 100 + ammocost: 1 }, { id: "15", eddbID: 1333, @@ -6495,7 +6495,7 @@ module.exports = { power: 1.4, ammo: 7400, repair: 88.8, - ammocost: 100 + ammocost: 1 }, { id: "14", eddbID: 1341, @@ -6506,7 +6506,7 @@ module.exports = { power: 1.86, ammo: 6700, repair: 107.2, - ammocost: 100 + ammocost: 1 }, { id: "13", eddbID: 1349, @@ -6517,7 +6517,7 @@ module.exports = { power: 2.33, ammo: 7400, repair: 148, - ammocost: 100 + ammocost: 1 }, { id: "12", eddbID: 1357, @@ -6528,7 +6528,7 @@ module.exports = { power: 2.67, ammo: 8900, repair: 204.7, - ammocost: 100 + ammocost: 1 }, { id: "11", eddbID: 1365, @@ -6539,7 +6539,7 @@ module.exports = { power: 3.26, ammo: 8100, repair: 226.8, - ammocost: 100 + ammocost: 1 }, { id: "10", eddbID: 1332, @@ -6550,7 +6550,7 @@ module.exports = { power: 1.17, ammo: 6100, repair: 73.2, - ammocost: 100 + ammocost: 1 }, { id: "0v", eddbID: 1340, @@ -6561,7 +6561,7 @@ module.exports = { power: 1.56, ammo: 5500, repair: 88, - ammocost: 100 + ammocost: 1 }, { id: "0u", eddbID: 1348, @@ -6572,7 +6572,7 @@ module.exports = { power: 1.95, ammo: 6100, repair: 122, - ammocost: 100 + ammocost: 1 }, { id: "0t", eddbID: 1356, @@ -6583,7 +6583,7 @@ module.exports = { power: 2.24, ammo: 7300, repair: 167.9, - ammocost: 100 + ammocost: 1 }, { id: "0s", eddbID: 1364, @@ -6594,7 +6594,7 @@ module.exports = { power: 2.73, ammo: 6700, repair: 187.6, - ammocost: 100 + ammocost: 1 }, { id: "0r", eddbID: 1331, @@ -6605,7 +6605,7 @@ module.exports = { power: .99, ammo: 4900, repair: 58.8, - ammocost: 100 + ammocost: 1 }, { id: "0q", eddbID: 1339, @@ -6616,7 +6616,7 @@ module.exports = { power: 1.32, ammo: 4400, repair: 70.4, - ammocost: 100 + ammocost: 1 }, { id: "0p", eddbID: 1347, @@ -6627,7 +6627,7 @@ module.exports = { power: 1.65, ammo: 4900, repair: 98, - ammocost: 100 + ammocost: 1 }, { id: "0o", eddbID: 1355, @@ -6638,7 +6638,7 @@ module.exports = { power: 1.9, ammo: 5900, repair: 135.7, - ammocost: 100 + ammocost: 1 }, { id: "0n", eddbID: 1363, @@ -6649,7 +6649,7 @@ module.exports = { power: 2.31, ammo: 5400, repair: 151.2, - ammocost: 100 + ammocost: 1 }, { id: "0m", eddbID: 1330, @@ -6660,7 +6660,7 @@ module.exports = { power: .81, ammo: 3600, repair: 43.2, - ammocost: 100 + ammocost: 1 }, { id: "0l", eddbID: 1338, @@ -6671,7 +6671,7 @@ module.exports = { power: 1.08, ammo: 3200, repair: 51.2, - ammocost: 100 + ammocost: 1 }, { id: "0k", eddbID: 1346, @@ -6682,7 +6682,7 @@ module.exports = { power: 1.35, ammo: 3600, repair: 72, - ammocost: 100 + ammocost: 1 }, { id: "0j", eddbID: 1354, @@ -6693,7 +6693,7 @@ module.exports = { power: 1.55, ammo: 4300, repair: 98.9, - ammocost: 100 + ammocost: 1 }, { id: "0i", eddbID: 1362, @@ -6704,7 +6704,7 @@ module.exports = { power: 1.89, ammo: 4e3, repair: 112, - ammocost: 100 + ammocost: 1 }, { id: "0h", eddbID: 1329, @@ -6715,7 +6715,7 @@ module.exports = { power: .68, ammo: 2300, repair: 27.6, - ammocost: 100 + ammocost: 1 }, { id: "0g", eddbID: 1337, @@ -6726,7 +6726,7 @@ module.exports = { power: .9, ammo: 2100, repair: 33.6, - ammocost: 100 + ammocost: 1 }, { id: "0f", eddbID: 1345, @@ -6737,7 +6737,7 @@ module.exports = { power: 1.13, ammo: 2300, repair: 46, - ammocost: 100 + ammocost: 1 }, { id: "0e", eddbID: 1353, @@ -6748,7 +6748,7 @@ module.exports = { power: 1.29, ammo: 2800, repair: 64.4, - ammocost: 100 + ammocost: 1 }, { id: "0d", eddbID: 1361, @@ -6759,7 +6759,7 @@ module.exports = { power: 1.58, ammo: 2500, repair: 70, - ammocost: 100 + ammocost: 1 }, { id: "0c", eddbID: 1328, @@ -6770,7 +6770,7 @@ module.exports = { power: .54, ammo: 1e3, repair: 12, - ammocost: 100 + ammocost: 1 }, { id: "0b", eddbID: 1336, @@ -6781,7 +6781,7 @@ module.exports = { power: .72, ammo: 900, repair: 14.4, - ammocost: 100 + ammocost: 1 }, { id: "0a", eddbID: 1344, @@ -6792,7 +6792,7 @@ module.exports = { power: .9, ammo: 1e3, repair: 20, - ammocost: 100 + ammocost: 1 }, { id: "09", eddbID: 1352, @@ -6803,7 +6803,7 @@ module.exports = { power: 1.04, ammo: 1200, repair: 27.6, - ammocost: 100 + ammocost: 1 }, { id: "08", eddbID: 1360, @@ -6814,7 +6814,7 @@ module.exports = { power: 1.26, ammo: 1100, repair: 30.8, - ammocost: 100 + ammocost: 1 } ], bsg: [ { id: "B6", @@ -6944,7 +6944,7 @@ module.exports = { "class": 1, rating: "E", cost: 1e3, - capacity: 2 + cargo: 2 }, { id: "01", eddbID: 1192, @@ -6952,7 +6952,7 @@ module.exports = { "class": 2, rating: "E", cost: 3250, - capacity: 4 + cargo: 4 }, { id: "02", eddbID: 1193, @@ -6960,7 +6960,7 @@ module.exports = { "class": 3, rating: "E", cost: 10560, - capacity: 8 + cargo: 8 }, { id: "03", eddbID: 1194, @@ -6968,7 +6968,7 @@ module.exports = { "class": 4, rating: "E", cost: 34330, - capacity: 16 + cargo: 16 }, { id: "04", eddbID: 1195, @@ -6976,7 +6976,7 @@ module.exports = { "class": 5, rating: "E", cost: 111570, - capacity: 32 + cargo: 32 }, { id: "05", eddbID: 1196, @@ -6984,7 +6984,7 @@ module.exports = { "class": 6, rating: "E", cost: 362590, - capacity: 64 + cargo: 64 }, { id: "06", eddbID: 1197, @@ -6992,7 +6992,7 @@ module.exports = { "class": 7, rating: "E", cost: 1178420, - capacity: 128 + cargo: 128 }, { id: "07", eddbID: 1198, @@ -7000,7 +7000,7 @@ module.exports = { "class": 8, rating: "E", cost: 3829870, - capacity: 256 + cargo: 256 } ], cc: [ { id: "Cf", @@ -8355,7 +8355,7 @@ module.exports = { "class": 1, rating: "C", cost: 1e3, - capacity: 2 + fuel: 2 }, { id: "f2", eddbID: 1200, @@ -8363,7 +8363,7 @@ module.exports = { "class": 2, rating: "C", cost: 3750, - capacity: 4 + fuel: 4 }, { id: "f3", eddbID: 1201, @@ -8371,7 +8371,7 @@ module.exports = { "class": 3, rating: "C", cost: 7060, - capacity: 8 + fuel: 8 }, { id: "f4", eddbID: 1202, @@ -8379,7 +8379,7 @@ module.exports = { "class": 4, rating: "C", cost: 24730, - capacity: 16 + fuel: 16 }, { id: "f5", eddbID: 1203, @@ -8387,7 +8387,7 @@ module.exports = { "class": 5, rating: "C", cost: 97750, - capacity: 32 + fuel: 32 }, { id: "f6", eddbID: 1204, @@ -8395,7 +8395,7 @@ module.exports = { "class": 6, rating: "C", cost: 341580, - capacity: 64 + fuel: 64 }, { id: "f7", eddbID: 1205, @@ -8403,7 +8403,7 @@ module.exports = { "class": 7, rating: "C", cost: 1780910, - capacity: 128 + fuel: 128 }, { id: "f8", eddbID: 1206, @@ -8411,7 +8411,7 @@ module.exports = { "class": 8, rating: "C", cost: 5428400, - capacity: 256 + fuel: 256 } ], pv: [ { id: "v1", @@ -9006,7 +9006,6 @@ module.exports = { rating: "C", cost: 1545e3, mass: 2, - power: 0, rangeLS: null }, { id: "2g", @@ -9017,7 +9016,6 @@ module.exports = { rating: "D", cost: 505e3, mass: 2, - power: 0, rangeLS: 1e3 }, { id: "2h", @@ -9028,7 +9026,6 @@ module.exports = { rating: "E", cost: 1e3, mass: 2, - power: 0, rangeLS: 500 }, { id: "2i", @@ -9038,9 +9035,7 @@ module.exports = { "class": 1, rating: "C", cost: 25e4, - mass: 1.3, - power: 0, - rangeLS: .33 + mass: 1.3 } ], scb: [ { id: "65", diff --git a/modules/internal/auto_field_maintenance_unit.json b/modules/internal/auto_field_maintenance_unit.json index 65ed53b..48567e7 100755 --- a/modules/internal/auto_field_maintenance_unit.json +++ b/modules/internal/auto_field_maintenance_unit.json @@ -1,51 +1,51 @@ { "am": [ - { "id": "1f", "eddbID": 1335, "grp": "am", "class": 8, "rating": "E", "cost": 612220, "power": 1.8, "ammo": 10000, "repair": 120, "ammocost": 100 }, - { "id": "1e", "eddbID": 1343, "grp": "am", "class": 8, "rating": "D", "cost": 1836660, "power": 2.4, "ammo": 9000, "repair": 144, "ammocost": 100 }, - { "id": "1d", "eddbID": 1351, "grp": "am", "class": 8, "rating": "C", "cost": 5509980, "power": 3, "ammo": 10000, "repair": 200, "ammocost": 100 }, - { "id": "1c", "eddbID": 1359, "grp": "am", "class": 8, "rating": "B", "cost": 16529940, "power": 3.45, "ammo": 12000, "repair": 276, "ammocost": 100 }, - { "id": "1b", "eddbID": 1367, "grp": "am", "class": 8, "rating": "A", "cost": 49589820, "power": 4.2, "ammo": 11000, "repair": 308, "ammocost": 100 }, + { "id": "1f", "eddbID": 1335, "grp": "am", "class": 8, "rating": "E", "cost": 612220, "power": 1.8, "ammo": 10000, "repair": 120, "ammocost": 1 }, + { "id": "1e", "eddbID": 1343, "grp": "am", "class": 8, "rating": "D", "cost": 1836660, "power": 2.4, "ammo": 9000, "repair": 144, "ammocost": 1 }, + { "id": "1d", "eddbID": 1351, "grp": "am", "class": 8, "rating": "C", "cost": 5509980, "power": 3, "ammo": 10000, "repair": 200, "ammocost": 1 }, + { "id": "1c", "eddbID": 1359, "grp": "am", "class": 8, "rating": "B", "cost": 16529940, "power": 3.45, "ammo": 12000, "repair": 276, "ammocost": 1 }, + { "id": "1b", "eddbID": 1367, "grp": "am", "class": 8, "rating": "A", "cost": 49589820, "power": 4.2, "ammo": 11000, "repair": 308, "ammocost": 1 }, - { "id": "1a", "eddbID": 1334, "grp": "am", "class": 7, "rating": "E", "cost": 340120, "power": 1.58, "ammo": 8700, "repair": 104.4, "ammocost": 100 }, - { "id": "19", "eddbID": 1342, "grp": "am", "class": 7, "rating": "D", "cost": 1020370, "power": 2.1, "ammo": 7800, "repair": 124.8, "ammocost": 100 }, - { "id": "18", "eddbID": 1350, "grp": "am", "class": 7, "rating": "C", "cost": 3061100, "power": 2.63, "ammo": 8700, "repair": 174, "ammocost": 100 }, - { "id": "17", "eddbID": 1358, "grp": "am", "class": 7, "rating": "B", "cost": 9183300, "power": 3.02, "ammo": 10400, "repair": 239.2, "ammocost": 100 }, - { "id": "16", "eddbID": 1366, "grp": "am", "class": 7, "rating": "A", "cost": 27549900, "power": 3.68, "ammo": 9600, "repair": 268.8, "ammocost": 100 }, + { "id": "1a", "eddbID": 1334, "grp": "am", "class": 7, "rating": "E", "cost": 340120, "power": 1.58, "ammo": 8700, "repair": 104.4, "ammocost": 1 }, + { "id": "19", "eddbID": 1342, "grp": "am", "class": 7, "rating": "D", "cost": 1020370, "power": 2.1, "ammo": 7800, "repair": 124.8, "ammocost": 1 }, + { "id": "18", "eddbID": 1350, "grp": "am", "class": 7, "rating": "C", "cost": 3061100, "power": 2.63, "ammo": 8700, "repair": 174, "ammocost": 1 }, + { "id": "17", "eddbID": 1358, "grp": "am", "class": 7, "rating": "B", "cost": 9183300, "power": 3.02, "ammo": 10400, "repair": 239.2, "ammocost": 1 }, + { "id": "16", "eddbID": 1366, "grp": "am", "class": 7, "rating": "A", "cost": 27549900, "power": 3.68, "ammo": 9600, "repair": 268.8, "ammocost": 1 }, - { "id": "15", "eddbID": 1333, "grp": "am", "class": 6, "rating": "E", "cost": 188960, "power": 1.4, "ammo": 7400, "repair": 88.8, "ammocost": 100 }, - { "id": "14", "eddbID": 1341, "grp": "am", "class": 6, "rating": "D", "cost": 566870, "power": 1.86, "ammo": 6700, "repair": 107.2, "ammocost": 100 }, - { "id": "13", "eddbID": 1349, "grp": "am", "class": 6, "rating": "C", "cost": 1700610, "power": 2.33, "ammo": 7400, "repair": 148, "ammocost": 100 }, - { "id": "12", "eddbID": 1357, "grp": "am", "class": 6, "rating": "B", "cost": 5101830, "power": 2.67, "ammo": 8900, "repair": 204.7, "ammocost": 100 }, - { "id": "11", "eddbID": 1365, "grp": "am", "class": 6, "rating": "A", "cost": 15305500, "power": 3.26, "ammo": 8100, "repair": 226.8, "ammocost": 100 }, + { "id": "15", "eddbID": 1333, "grp": "am", "class": 6, "rating": "E", "cost": 188960, "power": 1.4, "ammo": 7400, "repair": 88.8, "ammocost": 1 }, + { "id": "14", "eddbID": 1341, "grp": "am", "class": 6, "rating": "D", "cost": 566870, "power": 1.86, "ammo": 6700, "repair": 107.2, "ammocost": 1 }, + { "id": "13", "eddbID": 1349, "grp": "am", "class": 6, "rating": "C", "cost": 1700610, "power": 2.33, "ammo": 7400, "repair": 148, "ammocost": 1 }, + { "id": "12", "eddbID": 1357, "grp": "am", "class": 6, "rating": "B", "cost": 5101830, "power": 2.67, "ammo": 8900, "repair": 204.7, "ammocost": 1 }, + { "id": "11", "eddbID": 1365, "grp": "am", "class": 6, "rating": "A", "cost": 15305500, "power": 3.26, "ammo": 8100, "repair": 226.8, "ammocost": 1 }, - { "id": "10", "eddbID": 1332, "grp": "am", "class": 5, "rating": "E", "cost": 104980, "power": 1.17, "ammo": 6100, "repair": 73.2, "ammocost": 100 }, - { "id": "0v", "eddbID": 1340, "grp": "am", "class": 5, "rating": "D", "cost": 314930, "power": 1.56, "ammo": 5500, "repair": 88, "ammocost": 100 }, - { "id": "0u", "eddbID": 1348, "grp": "am", "class": 5, "rating": "C", "cost": 944780, "power": 1.95, "ammo": 6100, "repair": 122, "ammocost": 100 }, - { "id": "0t", "eddbID": 1356, "grp": "am", "class": 5, "rating": "B", "cost": 2834350, "power": 2.24, "ammo": 7300, "repair": 167.9, "ammocost": 100 }, - { "id": "0s", "eddbID": 1364, "grp": "am", "class": 5, "rating": "A", "cost": 8503060, "power": 2.73, "ammo": 6700, "repair": 187.6, "ammocost": 100 }, + { "id": "10", "eddbID": 1332, "grp": "am", "class": 5, "rating": "E", "cost": 104980, "power": 1.17, "ammo": 6100, "repair": 73.2, "ammocost": 1 }, + { "id": "0v", "eddbID": 1340, "grp": "am", "class": 5, "rating": "D", "cost": 314930, "power": 1.56, "ammo": 5500, "repair": 88, "ammocost": 1 }, + { "id": "0u", "eddbID": 1348, "grp": "am", "class": 5, "rating": "C", "cost": 944780, "power": 1.95, "ammo": 6100, "repair": 122, "ammocost": 1 }, + { "id": "0t", "eddbID": 1356, "grp": "am", "class": 5, "rating": "B", "cost": 2834350, "power": 2.24, "ammo": 7300, "repair": 167.9, "ammocost": 1 }, + { "id": "0s", "eddbID": 1364, "grp": "am", "class": 5, "rating": "A", "cost": 8503060, "power": 2.73, "ammo": 6700, "repair": 187.6, "ammocost": 1 }, - { "id": "0r", "eddbID": 1331, "grp": "am", "class": 4, "rating": "E", "cost": 58320, "power": 0.99, "ammo": 4900, "repair": 58.8, "ammocost": 100 }, - { "id": "0q", "eddbID": 1339, "grp": "am", "class": 4, "rating": "D", "cost": 174960, "power": 1.32, "ammo": 4400, "repair": 70.4, "ammocost": 100 }, - { "id": "0p", "eddbID": 1347, "grp": "am", "class": 4, "rating": "C", "cost": 524880, "power": 1.65, "ammo": 4900, "repair": 98, "ammocost": 100 }, - { "id": "0o", "eddbID": 1355, "grp": "am", "class": 4, "rating": "B", "cost": 1574640, "power": 1.9, "ammo": 5900, "repair": 135.7, "ammocost": 100 }, - { "id": "0n", "eddbID": 1363, "grp": "am", "class": 4, "rating": "A", "cost": 4723920, "power": 2.31, "ammo": 5400, "repair": 151.2, "ammocost": 100 }, + { "id": "0r", "eddbID": 1331, "grp": "am", "class": 4, "rating": "E", "cost": 58320, "power": 0.99, "ammo": 4900, "repair": 58.8, "ammocost": 1 }, + { "id": "0q", "eddbID": 1339, "grp": "am", "class": 4, "rating": "D", "cost": 174960, "power": 1.32, "ammo": 4400, "repair": 70.4, "ammocost": 1 }, + { "id": "0p", "eddbID": 1347, "grp": "am", "class": 4, "rating": "C", "cost": 524880, "power": 1.65, "ammo": 4900, "repair": 98, "ammocost": 1 }, + { "id": "0o", "eddbID": 1355, "grp": "am", "class": 4, "rating": "B", "cost": 1574640, "power": 1.9, "ammo": 5900, "repair": 135.7, "ammocost": 1 }, + { "id": "0n", "eddbID": 1363, "grp": "am", "class": 4, "rating": "A", "cost": 4723920, "power": 2.31, "ammo": 5400, "repair": 151.2, "ammocost": 1 }, - { "id": "0m", "eddbID": 1330, "grp": "am", "class": 3, "rating": "E", "cost": 32400, "power": 0.81, "ammo": 3600, "repair": 43.2, "ammocost": 100 }, - { "id": "0l", "eddbID": 1338, "grp": "am", "class": 3, "rating": "D", "cost": 97200, "power": 1.08, "ammo": 3200, "repair": 51.2, "ammocost": 100 }, - { "id": "0k", "eddbID": 1346, "grp": "am", "class": 3, "rating": "C", "cost": 291600, "power": 1.35, "ammo": 3600, "repair": 72, "ammocost": 100 }, - { "id": "0j", "eddbID": 1354, "grp": "am", "class": 3, "rating": "B", "cost": 874800, "power": 1.55, "ammo": 4300, "repair": 98.9, "ammocost": 100 }, - { "id": "0i", "eddbID": 1362, "grp": "am", "class": 3, "rating": "A", "cost": 2624400, "power": 1.89, "ammo": 4000, "repair": 112, "ammocost": 100 }, + { "id": "0m", "eddbID": 1330, "grp": "am", "class": 3, "rating": "E", "cost": 32400, "power": 0.81, "ammo": 3600, "repair": 43.2, "ammocost": 1 }, + { "id": "0l", "eddbID": 1338, "grp": "am", "class": 3, "rating": "D", "cost": 97200, "power": 1.08, "ammo": 3200, "repair": 51.2, "ammocost": 1 }, + { "id": "0k", "eddbID": 1346, "grp": "am", "class": 3, "rating": "C", "cost": 291600, "power": 1.35, "ammo": 3600, "repair": 72, "ammocost": 1 }, + { "id": "0j", "eddbID": 1354, "grp": "am", "class": 3, "rating": "B", "cost": 874800, "power": 1.55, "ammo": 4300, "repair": 98.9, "ammocost": 1 }, + { "id": "0i", "eddbID": 1362, "grp": "am", "class": 3, "rating": "A", "cost": 2624400, "power": 1.89, "ammo": 4000, "repair": 112, "ammocost": 1 }, - { "id": "0h", "eddbID": 1329, "grp": "am", "class": 2, "rating": "E", "cost": 18000, "power": 0.68, "ammo": 2300, "repair": 27.6, "ammocost": 100 }, - { "id": "0g", "eddbID": 1337, "grp": "am", "class": 2, "rating": "D", "cost": 54000, "power": 0.9, "ammo": 2100, "repair": 33.6, "ammocost": 100 }, - { "id": "0f", "eddbID": 1345, "grp": "am", "class": 2, "rating": "C", "cost": 162000, "power": 1.13, "ammo": 2300, "repair": 46, "ammocost": 100 }, - { "id": "0e", "eddbID": 1353, "grp": "am", "class": 2, "rating": "B", "cost": 486000, "power": 1.29, "ammo": 2800, "repair": 64.4, "ammocost": 100 }, - { "id": "0d", "eddbID": 1361, "grp": "am", "class": 2, "rating": "A", "cost": 1458000, "power": 1.58, "ammo": 2500, "repair": 70, "ammocost": 100 }, + { "id": "0h", "eddbID": 1329, "grp": "am", "class": 2, "rating": "E", "cost": 18000, "power": 0.68, "ammo": 2300, "repair": 27.6, "ammocost": 1 }, + { "id": "0g", "eddbID": 1337, "grp": "am", "class": 2, "rating": "D", "cost": 54000, "power": 0.9, "ammo": 2100, "repair": 33.6, "ammocost": 1 }, + { "id": "0f", "eddbID": 1345, "grp": "am", "class": 2, "rating": "C", "cost": 162000, "power": 1.13, "ammo": 2300, "repair": 46, "ammocost": 1 }, + { "id": "0e", "eddbID": 1353, "grp": "am", "class": 2, "rating": "B", "cost": 486000, "power": 1.29, "ammo": 2800, "repair": 64.4, "ammocost": 1 }, + { "id": "0d", "eddbID": 1361, "grp": "am", "class": 2, "rating": "A", "cost": 1458000, "power": 1.58, "ammo": 2500, "repair": 70, "ammocost": 1 }, - { "id": "0c", "eddbID": 1328, "grp": "am", "class": 1, "rating": "E", "cost": 10000, "power": 0.54, "ammo": 1000, "repair": 12, "ammocost": 100 }, - { "id": "0b", "eddbID": 1336, "grp": "am", "class": 1, "rating": "D", "cost": 30000, "power": 0.72, "ammo": 900, "repair": 14.4, "ammocost": 100 }, - { "id": "0a", "eddbID": 1344, "grp": "am", "class": 1, "rating": "C", "cost": 90000, "power": 0.9, "ammo": 1000, "repair": 20, "ammocost": 100 }, - { "id": "09", "eddbID": 1352, "grp": "am", "class": 1, "rating": "B", "cost": 270000, "power": 1.04, "ammo": 1200, "repair": 27.6, "ammocost": 100 }, - { "id": "08", "eddbID": 1360, "grp": "am", "class": 1, "rating": "A", "cost": 810000, "power": 1.26, "ammo": 1100, "repair": 30.8, "ammocost": 100 } + { "id": "0c", "eddbID": 1328, "grp": "am", "class": 1, "rating": "E", "cost": 10000, "power": 0.54, "ammo": 1000, "repair": 12, "ammocost": 1 }, + { "id": "0b", "eddbID": 1336, "grp": "am", "class": 1, "rating": "D", "cost": 30000, "power": 0.72, "ammo": 900, "repair": 14.4, "ammocost": 1 }, + { "id": "0a", "eddbID": 1344, "grp": "am", "class": 1, "rating": "C", "cost": 90000, "power": 0.9, "ammo": 1000, "repair": 20, "ammocost": 1 }, + { "id": "09", "eddbID": 1352, "grp": "am", "class": 1, "rating": "B", "cost": 270000, "power": 1.04, "ammo": 1200, "repair": 27.6, "ammocost": 1 }, + { "id": "08", "eddbID": 1360, "grp": "am", "class": 1, "rating": "A", "cost": 810000, "power": 1.26, "ammo": 1100, "repair": 30.8, "ammocost": 1 } ] } diff --git a/modules/internal/cargo_rack.json b/modules/internal/cargo_rack.json index 00d46c4..4bceaf8 100755 --- a/modules/internal/cargo_rack.json +++ b/modules/internal/cargo_rack.json @@ -1,12 +1,12 @@ { "cr": [ - { "id": "00", "eddbID": 1191, "grp": "cr", "class": 1, "rating": "E", "cost": 1000, "capacity": 2 }, - { "id": "01", "eddbID": 1192, "grp": "cr", "class": 2, "rating": "E", "cost": 3250, "capacity": 4 }, - { "id": "02", "eddbID": 1193, "grp": "cr", "class": 3, "rating": "E", "cost": 10560, "capacity": 8 }, - { "id": "03", "eddbID": 1194, "grp": "cr", "class": 4, "rating": "E", "cost": 34330, "capacity": 16 }, - { "id": "04", "eddbID": 1195, "grp": "cr", "class": 5, "rating": "E", "cost": 111570, "capacity": 32 }, - { "id": "05", "eddbID": 1196, "grp": "cr", "class": 6, "rating": "E", "cost": 362590, "capacity": 64 }, - { "id": "06", "eddbID": 1197, "grp": "cr", "class": 7, "rating": "E", "cost": 1178420, "capacity": 128 }, - { "id": "07", "eddbID": 1198, "grp": "cr", "class": 8, "rating": "E", "cost": 3829870, "capacity": 256 } + { "id": "00", "eddbID": 1191, "grp": "cr", "class": 1, "rating": "E", "cost": 1000, "cargo": 2 }, + { "id": "01", "eddbID": 1192, "grp": "cr", "class": 2, "rating": "E", "cost": 3250, "cargo": 4 }, + { "id": "02", "eddbID": 1193, "grp": "cr", "class": 3, "rating": "E", "cost": 10560, "cargo": 8 }, + { "id": "03", "eddbID": 1194, "grp": "cr", "class": 4, "rating": "E", "cost": 34330, "cargo": 16 }, + { "id": "04", "eddbID": 1195, "grp": "cr", "class": 5, "rating": "E", "cost": 111570, "cargo": 32 }, + { "id": "05", "eddbID": 1196, "grp": "cr", "class": 6, "rating": "E", "cost": 362590, "cargo": 64 }, + { "id": "06", "eddbID": 1197, "grp": "cr", "class": 7, "rating": "E", "cost": 1178420, "cargo": 128 }, + { "id": "07", "eddbID": 1198, "grp": "cr", "class": 8, "rating": "E", "cost": 3829870, "cargo": 256 } ] } \ No newline at end of file diff --git a/modules/internal/internal_fuel_tank.json b/modules/internal/internal_fuel_tank.json index cac26b1..99efb67 100644 --- a/modules/internal/internal_fuel_tank.json +++ b/modules/internal/internal_fuel_tank.json @@ -1,12 +1,12 @@ { "ft": [ - { "id": "f1", "eddbID": 1199, "grp": "ft", "class": 1, "rating": "C", "cost": 1000, "capacity": 2 }, - { "id": "f2", "eddbID": 1200, "grp": "ft", "class": 2, "rating": "C", "cost": 3750, "capacity": 4 }, - { "id": "f3", "eddbID": 1201, "grp": "ft", "class": 3, "rating": "C", "cost": 7060, "capacity": 8 }, - { "id": "f4", "eddbID": 1202, "grp": "ft", "class": 4, "rating": "C", "cost": 24730, "capacity": 16 }, - { "id": "f5", "eddbID": 1203, "grp": "ft", "class": 5, "rating": "C", "cost": 97750, "capacity": 32 }, - { "id": "f6", "eddbID": 1204, "grp": "ft", "class": 6, "rating": "C", "cost": 341580, "capacity": 64 }, - { "id": "f7", "eddbID": 1205, "grp": "ft", "class": 7, "rating": "C", "cost": 1780910, "capacity": 128 }, - { "id": "f8", "eddbID": 1206, "grp": "ft", "class": 8, "rating": "C", "cost": 5428400, "capacity": 256 } + { "id": "f1", "eddbID": 1199, "grp": "ft", "class": 1, "rating": "C", "cost": 1000, "fuel": 2 }, + { "id": "f2", "eddbID": 1200, "grp": "ft", "class": 2, "rating": "C", "cost": 3750, "fuel": 4 }, + { "id": "f3", "eddbID": 1201, "grp": "ft", "class": 3, "rating": "C", "cost": 7060, "fuel": 8 }, + { "id": "f4", "eddbID": 1202, "grp": "ft", "class": 4, "rating": "C", "cost": 24730, "fuel": 16 }, + { "id": "f5", "eddbID": 1203, "grp": "ft", "class": 5, "rating": "C", "cost": 97750, "fuel": 32 }, + { "id": "f6", "eddbID": 1204, "grp": "ft", "class": 6, "rating": "C", "cost": 341580, "fuel": 64 }, + { "id": "f7", "eddbID": 1205, "grp": "ft", "class": 7, "rating": "C", "cost": 1780910, "fuel": 128 }, + { "id": "f8", "eddbID": 1206, "grp": "ft", "class": 8, "rating": "C", "cost": 5428400, "fuel": 256 } ] } \ No newline at end of file diff --git a/modules/internal/scanner.json b/modules/internal/scanner.json index 86d4c58..9b7b270 100755 --- a/modules/internal/scanner.json +++ b/modules/internal/scanner.json @@ -1,8 +1,8 @@ { "sc": [ - { "id": "2f", "eddbID": 1244, "grp": "sc", "name": "Advanced Discovery Scanner", "class": 1, "rating": "C", "cost": 1545000, "mass": 2, "power": 0, "rangeLS": null }, - { "id": "2g", "eddbID": 1243, "grp": "sc", "name": "Intermediate Discovery Scanner", "class": 1, "rating": "D", "cost": 505000, "mass": 2, "power": 0, "rangeLS": 1000 }, - { "id": "2h", "eddbID": 1242, "grp": "sc", "name": "Basic Discovery Scanner", "class": 1, "rating": "E", "cost": 1000, "mass": 2, "power": 0, "rangeLS": 500 }, - { "id": "2i", "eddbID": 1245, "grp": "sc", "name": "Detailed Surface Scanner", "class": 1, "rating": "C", "cost": 250000, "mass": 1.3, "power": 0, "rangeLS": 0.33 } + { "id": "2f", "eddbID": 1244, "grp": "sc", "name": "Advanced Discovery Scanner", "class": 1, "rating": "C", "cost": 1545000, "mass": 2, "rangeLS": null }, + { "id": "2g", "eddbID": 1243, "grp": "sc", "name": "Intermediate Discovery Scanner", "class": 1, "rating": "D", "cost": 505000, "mass": 2, "rangeLS": 1000 }, + { "id": "2h", "eddbID": 1242, "grp": "sc", "name": "Basic Discovery Scanner", "class": 1, "rating": "E", "cost": 1000, "mass": 2, "rangeLS": 500 }, + { "id": "2i", "eddbID": 1245, "grp": "sc", "name": "Detailed Surface Scanner", "class": 1, "rating": "C", "cost": 250000, "mass": 1.3 } ] } \ No newline at end of file diff --git a/modules/standard/fuel_tank.json b/modules/standard/fuel_tank.json index 99d27b7..26194f3 100755 --- a/modules/standard/fuel_tank.json +++ b/modules/standard/fuel_tank.json @@ -1,10 +1,10 @@ { - "1C": { "id":"f1", "eddbID": 1199, "grp": "ft", "class": 1, "rating": "C", "cost": 1000, "capacity": 2 }, - "2C": { "id":"f2", "eddbID": 1200, "grp": "ft", "class": 2, "rating": "C", "cost": 3750, "capacity": 4 }, - "3C": { "id":"f3", "eddbID": 1201, "grp": "ft", "class": 3, "rating": "C", "cost": 7060, "capacity": 8 }, - "4C": { "id":"f4", "eddbID": 1202, "grp": "ft", "class": 4, "rating": "C", "cost": 24730, "capacity": 16 }, - "5C": { "id":"f5", "eddbID": 1203, "grp": "ft", "class": 5, "rating": "C", "cost": 97750, "capacity": 32 }, - "6C": { "id":"f6", "eddbID": 1204, "grp": "ft", "class": 6, "rating": "C", "cost": 341580, "capacity": 64 }, - "7C": { "id":"f7", "eddbID": 1205, "grp": "ft", "class": 7, "rating": "C", "cost": 1780910, "capacity": 128 }, - "8C": { "id":"f8", "eddbID": 1206, "grp": "ft", "class": 8, "rating": "C", "cost": 5428400, "capacity": 256 } + "1C": { "id":"f1", "eddbID": 1199, "grp": "ft", "class": 1, "rating": "C", "cost": 1000, "fuel": 2 }, + "2C": { "id":"f2", "eddbID": 1200, "grp": "ft", "class": 2, "rating": "C", "cost": 3750, "fuel": 4 }, + "3C": { "id":"f3", "eddbID": 1201, "grp": "ft", "class": 3, "rating": "C", "cost": 7060, "fuel": 8 }, + "4C": { "id":"f4", "eddbID": 1202, "grp": "ft", "class": 4, "rating": "C", "cost": 24730, "fuel": 16 }, + "5C": { "id":"f5", "eddbID": 1203, "grp": "ft", "class": 5, "rating": "C", "cost": 97750, "fuel": 32 }, + "6C": { "id":"f6", "eddbID": 1204, "grp": "ft", "class": 6, "rating": "C", "cost": 341580, "fuel": 64 }, + "7C": { "id":"f7", "eddbID": 1205, "grp": "ft", "class": 7, "rating": "C", "cost": 1780910, "fuel": 128 }, + "8C": { "id":"f8", "eddbID": 1206, "grp": "ft", "class": 8, "rating": "C", "cost": 5428400, "fuel": 256 } } \ No newline at end of file diff --git a/package.json b/package.json index f845b2f..0502bc7 100644 --- a/package.json +++ b/package.json @@ -13,11 +13,13 @@ "license": "MIT", "scripts": { "lint": "eslint --ext .json modules ships", + "test": "jasmine-node spec", "build": "node generate_index.js" }, "devDependencies": { "eslint": "^1.10.3", "eslint-plugin-json": "^1.1.0", + "jasmine-node": "^1.14.5", "uglify-js": "^2.6.1" } } diff --git a/ships/adder.json b/ships/adder.json index bf0e215..8c5c725 100755 --- a/ships/adder.json +++ b/ships/adder.json @@ -35,4 +35,4 @@ "internal": ["01", "44", "00", 0, "2h"] } } -} \ No newline at end of file +} diff --git a/ships/imperial_eagle.json b/ships/imperial_eagle.json index 330ecca..4294883 100644 --- a/ships/imperial_eagle.json +++ b/ships/imperial_eagle.json @@ -32,7 +32,7 @@ "defaults": { "standard": ["3E", "3E", "3E", "1E", "2E", "2E", "2C"], "hardpoints": [0, 17, 17, 0], - "internal": ["44", "00", "2h"] + "internal": ["44", "00", "2h", 0] } } } \ No newline at end of file diff --git a/spec/data-spec.js b/spec/data-spec.js new file mode 100644 index 0000000..9f6c401 --- /dev/null +++ b/spec/data-spec.js @@ -0,0 +1,105 @@ +var Modules = require('../Modules'); +var Ships = require('../Ships'); + +describe('Database', function() { + + var shipProperties = [ + 'name', + 'manufacturer', + 'class', + 'hullCost', + 'speed', + 'boost', + 'boostEnergy', + 'agility', + 'baseShieldStrength', + 'baseArmour', + 'hullMass', + 'masslock', + 'pipSpeed' + ]; + + it('has same number of components as EDDB', function() { + var totalComponentCount = 0, g; + for (g = 0; g < Modules.standard.length; g++) { + var group = Modules.standard[g]; + for (var i in group) { + totalComponentCount++; + } + } + for (g in Modules.bulkheads) { + totalComponentCount += 5; + } + for (g in Modules.hardpoints) { + totalComponentCount += Modules.hardpoints[g].length; + } + for (g in Modules.internal) { + if (g != 'ft') { // EDDB does not have internal fuel tanks listed seperately + totalComponentCount += Modules.internal[g].length; + } + } + }); + + it('has valid standard components', function() { + var ids = {}; + for (var i = 0; i < Modules.standard.length; i++) { + var group = Modules.standard[i]; + for (var c in group) { + var id = group[c].id; + expect(ids[id]).toBeFalsy('ID already exists: ' + id); + expect(group[c].eddbID).toBeDefined('Standard component' + id + ' is missing EDDB ID'); + expect(group[c].grp).toBeDefined('Common component has no group defined, Type: ' + i + ', ID: ' + c); + ids[id] = true; + } + } + }); + + it('has valid hardpoints', function() { + var ids = {}; + var groups = Modules.hardpoints; + + for (var g in groups) { + var group = groups[g]; + for (var i = 0; i < group.length; i++) { + var id = group[i].id; + expect(ids[id]).toBeFalsy('ID already exists: ' + id); + expect(group[i].grp).toBeDefined('Hardpoint has no group defined, ID:' + id); + expect(group[i].eddbID).toBeDefined('Hardpoint ' + id + ' is missing EDDB ID'); + ids[id] = true; + } + } + }); + + it('has valid internal components', function() { + var ids = {}; + var groups = Modules.internal; + + for (var g in groups) { + var group = groups[g]; + for (var i = 0; i < group.length; i++) { + var id = group[i].id; + expect(ids[id]).toBeFalsy('ID already exists: ' + id); + expect(group[i].grp).toBeDefined('Internal component has no group defined, ID:' + id); + expect(group[i].eddbID).toBeDefined('Internal ' + id + ' is missing EDDB ID'); + ids[id] = true; + } + } + }); + + it('has data for every ship', function() { + for (var s in Ships) { + for (var p = 0; p < shipProperties.length; p++) { + expect(Ships[s].properties[shipProperties[p]]).toBeDefined(shipProperties[p] + ' is missing for ' + s); + } + expect(Ships[s].eddbID).toBeDefined(s + ' is missing EDDB ID'); + expect(Ships[s].slots.standard.length).toEqual(7, s + ' is missing standard slots'); + expect(Ships[s].defaults.standard.length).toEqual(7, s + ' is missing standard defaults'); + expect(Ships[s].slots.hardpoints.length).toEqual(Ships[s].defaults.hardpoints.length, s + ' hardpoint slots and defaults dont match'); + expect(Ships[s].slots.internal.length).toEqual(Ships[s].defaults.internal.length, s + ' internal slots and defaults dont match'); + expect(Ships[s].retailCost).toBeGreaterThan(Ships[s].properties.hullCost, s + ' has invalid retail cost'); + expect(Ships[s].bulkheads).toBeDefined(s + ' is missing bulkheads'); + expect(Ships[s].bulkheads.length).toEqual(5, s + ' is missing bulkheads'); + } + }); + +});