Jump to content
Game-Labs Forum
raskolnikoff

Public "API" for Naval Action

Recommended Posts

Taralin Snow    74

I've found more duplicate ResourcesAdded values in the Shops API (these are on us2, aka PVP Global):

Port=La Habana [38], Item=Iberian Dried Pork [790]

Port=Kingston / Port Royal [79], Item=Lancashire Iron [806]

Port=Les Gonaïves [93], Item=Fine Fabrics [824]

Port=La Tortue [96], Item=Provence Oak [829]

Port=Fajardo [116], Item=Iberian Dried Pork [790]

Port=Christiansted [129], Item=Norwegian Fox Fur [819]

Port=Gustavia [133], Item=Cape Coast Honey [833]

Port=La Désirade [139], Item=Languedoc Violins [825]

Port=Fort-Royal [156], Item=Corsican Mint [823]

Port=Carriacou [163], Item=Textile Machinery [811]

Port=Cartagena de Indias [212], Item=Spanish Dried Fruits [796]

Port=Atchafalaya [294], Item=Normandy Cider [827]

It is unclear what to do when the same item is found in the list twice. Should the correct value be taken as the first one in the list, the last one in the list, or the sum of all the entries with the same item id?

(sorry if formatting is bad, I still have that bug that removes all styles from the forum web pages) Edited by Taralin Snow

Share this post


Link to post
Share on other sites
Taralin Snow    74

to answer my own question:

When the same Item ID appears twice in a ResourcesAdded array, then both entries apply.  The daemon that processes these lists does not appear to notice or care that it already saw that item in that port previously, when it reaches the duplicate entry.

Share this post


Link to post
Share on other sites
jodgi    2,312

Halp, pls!

I would like to set up a way to extract the speed data from the api file after a patch or when changes are made. It would be cool to make it fairly auto, but it doesn't have to be full auto. I'm aware of bash scripts, grep, regex and some fancy editors but I'm afraid I do not know all that well enough to make it do what I want. I'm pretty sure some of you in here could, though.

Here's the idea in my head:

This is the part of the apt file I'm looking for:

{"__type":"MegaChaka.Services.Items.ShipTemplate, MegaChaka","RepairPriceCoefficient":0.1,"Class":6,"ShipTemplateName":"Brig","Specs":{"MaxPassableHeight":3,"MaxSpeed":169.487991333008,"MaxTurningSpeed":16.6299991607666,"Acceleration":0.5,"Deceleration":0.5,"SpeedToWind":[0.907904624938965,0.9187992811203,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.49501097202301,0.57897675037384,0.323229432106018,0.239175021648407,-0.259320199489594],

For now I'd like to isolate every occurence of 

"ShipTemplateName":"Brig"

and the related

"SpeedToWind":[0.907904624938965,0.9187992811203,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.49501097202301,0.57897675037384,0.323229432106018,0.239175021648407,-0.259320199489594],

^This is the meat of the matter but it would be helpful to include the "ShipTemplateName":"..." of every "SpeedToWind":[...]

Anything is *simple* for those who know how to do it ;) Maybe @Black Spawn, @Remus, @Prater, @qw569, @balticsailor, @BungeeLemming, @woodenfish or any of you other technical guys could help me out?

Share this post


Link to post
Share on other sites
qw569    1,170
2 hours ago, jodgi said:

Halp, pls!

I would like to set up a way to extract the speed data from the api file after a patch or when changes are made. It would be cool to make it fairly auto, but it doesn't have to be full auto. I'm aware of bash scripts, grep, regex and some fancy editors but I'm afraid I do not know all that well enough to make it do what I want. I'm pretty sure some of you in here could, though.

Here's the idea in my head:

This is the part of the apt file I'm looking for:


{"__type":"MegaChaka.Services.Items.ShipTemplate, MegaChaka","RepairPriceCoefficient":0.1,"Class":6,"ShipTemplateName":"Brig","Specs":{"MaxPassableHeight":3,"MaxSpeed":169.487991333008,"MaxTurningSpeed":16.6299991607666,"Acceleration":0.5,"Deceleration":0.5,"SpeedToWind":[0.907904624938965,0.9187992811203,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.49501097202301,0.57897675037384,0.323229432106018,0.239175021648407,-0.259320199489594],

For now I'd like to isolate every occurence of 


"ShipTemplateName":"Brig"

and the related


"SpeedToWind":[0.907904624938965,0.9187992811203,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.49501097202301,0.57897675037384,0.323229432106018,0.239175021648407,-0.259320199489594],

^This is the meat of the matter but it would be helpful to include the "ShipTemplateName":"..." of every "SpeedToWind":[...]

Anything is *simple* for those who know how to do it ;) Maybe @Black Spawn, @Remus, @Prater, @qw569, @balticsailor, @BungeeLemming, @woodenfish or any of you other technical guys could help me out?

My command line Kung Fu

require curl and jq

	curl http://storage.googleapis.com/nacleanopenworldprodshards/ItemTemplates_cleanopenworldprodeu1.json | cut -c21- | jq -r ".[]|select(.ShipTemplateName!= null)|[.ShipTemplateName,.Specs.SpeedToWind[]]|@csv"
	

Another variant without error message. Require sed

	 curl http://storage.googleapis.com/nacleanopenworldprodshards/ItemTemplates_cleanopenworldprodeu1.json | sed "s/^.\{20\}//" | sed "s/.\{1\}$//" | jq -r ".[]|select(.ShipTemplateName!= null)|[.ShipTemplateName,.Specs.SpeedToWind[]]|@csv"
	

Output like csv

	"Ocean",0.787681877613068,0.901673376560211,0.970308780670166,0.995838046073914,0.961763143539429,0.862410068511963,0.764305830001831,0.477654784917831,0.209703385829926,0.186606153845787,0.167434334754944,0.11640040576458,-0.11904639005661
"RattlesnakeHeavy",0.819048285484314,0.909329354763031,0.97773540019989,0.995458722114563,0.943179130554199,0.922312438488007,0.893748581409454,0.754612565040588,0.569385051727295,0.519350707530975,0.413033157587051,0.253520905971527,-0.179818704724312
"TradersBrig",0.907904624938965,0.9187992811203,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.49501097202301,0.57897675037384,0.323229432106018,0.239175021648407,-0.259320199489594
	
Edited by qw569

Share this post


Link to post
Share on other sites
jodgi    2,312
24 minutes ago, qw569 said:

 


	curl http://storage.googleapis.com/nacleanopenworldprodshards/ItemTemplates_cleanopenworldprodeu1.json | cut -c21- | jq -r ".[]|select(.ShipTemplateName!= null)|[.ShipTemplateName,.Specs.SpeedToWind[]]|@csv"
	

 

 

 

 

Whoa, that was quick! Short and sweet too. I'll get right on it...

edit:

Boom! Just like that, fantastic! :)

"Yacht",0.670284867286682,0.738820016384125,0.740775346755981,0.747335135936737,0.845197737216949,0.948317110538483,0.99591600894928,0.882352113723755,0.875755369663239,0.921960532665253,0.712887465953827,0.446366399526596,-0.0462989956140518
"Bellona",0.816375613212585,0.936930894851685,0.988107442855835,0.996643424034119,0.942412972450256,0.877267062664032,0.868031620979309,0.726795315742493,0.44377401471138,0.361215323209763,0.241659790277481,0.0903672203421593,-0.140772551298141
"Cerberus",0.897633910179138,0.918979048728943,0.974961340427399,0.997262418270111,0.94380784034729,0.922044157981873,0.893744826316834,0.754612565040588,0.569385051727295,0.519350707530975,0.406001746654511,0.238203302025795,-0.179818704724312
"Niagara",0.830660879611969,0.912714421749115,0.972128987312317,0.99762225151062,0.957572162151337,0.896801114082336,0.975587129592896,0.810507297515869,0.630711197853088,0.567409038543701,0.437655121088028,0.243285745382309,-0.259320199489594
"BellePoule",0.832115113735199,0.908546209335327,0.976568460464478,0.996262609958649,0.951885640621185,0.924183785915375,0.852216601371765,0.714987337589264,0.564436972141266,0.476606905460358,0.340712279081345,0.166779562830925,-0.0960397943854332
"Hermione",0.816173374652863,0.894985318183899,0.968717694282532,0.99427318572998,0.964730858802795,0.921610474586487,0.928746402263641,0.832743287086487,0.677251100540161,0.50856339931488,0.258964389562607,0.168681815266609,-0.212512999773026
"GunBoat",0.640058934688568,0.740776479244232,0.775078654289246,0.804588258266449,0.87659740447998,0.93079686164856,0.997636556625366,0.89802485704422,0.908320128917694,0.970084309577942,0.473437815904617,0.475712299346924,-4.07380030083004e-05
"Brig",0.907904624938965,0.9187992811203,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.49501097202301,0.57897675037384,0.323229432106018,0.239175021648407,-0.259320199489594
"Rattlesnake",0.805158197879791,0.856941342353821,0.949949443340302,0.995938658714294,0.96014392375946,0.947647333145142,0.891575217247009,0.79248571395874,0.655579805374146,0.516388893127441,0.391414910554886,0.190061628818512,-0.19681841135025
"Endymion",0.792031824588776,0.910826086997986,0.974677681922913,0.99725329875946,0.961072504520416,0.83906102180481,0.696992337703705,0.63578075170517,0.558015942573547,0.422619998455048,0.258599698543549,0.146300345659256,-0.212512999773026
"Santisima",0.780579745769501,0.905760586261749,0.992659687995911,0.999634623527527,0.962262809276581,0.875864505767822,0.758958458900452,0.466653943061829,0.20929890871048,0.182290479540825,0.152640506625175,0.0910464152693748,-0.11958584189415
"Pickle",0.869210362434387,0.860205590724945,0.860346019268036,0.870565891265869,0.866416037082672,0.934467494487762,0.998558342456818,0.841611683368683,0.900335371494293,0.934787213802338,0.441632241010666,0.389370560646057,-0.0869158059358597
"YachtSilver",0.670284867286682,0.738820016384125,0.740775346755981,0.747335135936737,0.845197737216949,0.948317110538483,0.99591600894928,0.882352113723755,0.875755369663239,0.921960532665253,0.712887465953827,0.446366399526596,-0.0462989956140518
"Ingermanland",0.911585807800293,0.971969425678253,0.993132770061493,1.00037217140198,0.972440004348755,0.93043464422226,0.874004364013672,0.743567526340485,0.537364661693573,0.426011860370636,0.300232023000717,0.156852394342422,-0.140772551298141
"Surprise",0.811527490615845,0.89701509475708,0.970561981201172,0.996279835700989,0.958436250686646,0.963130474090576,0.938672959804535,0.845285594463348,0.685657560825348,0.509530544281006,0.35595914721489,0.163164660334587,-0.196165829896927
"BasicLynx",0.532278835773468,0.646284937858582,0.734185039997101,0.760524809360504,0.812957763671875,0.93157172203064,1.00052952766418,0.927837312221527,0.925526201725006,0.996561944484711,0.838097333908081,0.53007984161377,-0.0525373816490173
"TradersCutter",0.728494167327881,0.790638506412506,0.813238978385925,0.813403606414795,0.857197999954224,0.950983881950378,0.997444868087769,0.945230484008789,0.983980417251587,0.989391446113586,0.700145483016968,0.424478948116302,-0.0562432110309601
"Bucentaure",0.792798578739166,0.934872031211853,0.979838013648987,0.996067643165588,0.942314028739929,0.907004714012146,0.877773106098175,0.726127088069916,0.453525632619858,0.358104646205902,0.255109310150146,0.118876300752163,-0.129784807562828
"TradersSnow",0.972789466381073,0.957600355148315,0.960616827011108,1.0002852678299,0.824447214603424,0.827346682548523,0.946956813335419,0.76895272731781,0.63469785451889,0.582274436950684,0.472966611385345,0.262696743011475,-0.249456852674484
"BasicCutter",0.728494167327881,0.790638506412506,0.813238978385925,0.813403606414795,0.857197999954224,0.950983881950378,0.997444868087769,0.945230484008789,0.983980417251587,0.989391446113586,0.700145483016968,0.424478948116302,-0.0562432110309601
"Frigate",0.833000004291534,0.908535003662109,0.977411866188049,0.996864318847656,0.962958753108978,0.941396236419678,0.867685437202454,0.730434000492096,0.58012443780899,0.493259966373444,0.349891006946564,0.157746911048889,-0.0968957170844078
"PirateFrigate",0.833000004291534,0.908339619636536,0.975726366043091,0.995813369750977,0.962218582630157,0.926429688930511,0.950867652893066,0.821462154388428,0.615883946418762,0.493259966373444,0.349891006946564,0.171594694256783,-0.0968957170844078
"Privateer",0.54330050945282,0.63318920135498,0.68184107542038,0.684400498867035,0.717579066753387,0.808612704277039,0.952417373657227,0.903252720832825,0.919994592666626,1.00288152694702,0.792346060276031,0.495566010475159,-0.0578065179288387
"Indiaman",0.911585807800293,0.971969425678253,0.993132770061493,1.00037217140198,0.972440004348755,0.93043464422226,0.874004364013672,0.743567526340485,0.537364661693573,0.426011860370636,0.300232023000717,0.156852394342422,-0.140772551298141
"Constitution",0.86933159828186,0.96128511428833,0.990749180316925,0.998433411121368,0.953931629657745,0.924036920070648,0.842626214027405,0.683046936988831,0.509362399578094,0.441176950931549,0.310167133808136,0.164526998996735,-0.075474388897419
"Agamemnon",0.857732713222504,0.942265391349792,0.974424362182617,0.999182939529419,0.937313795089722,0.907193541526794,0.871875464916229,0.731563150882721,0.481307208538055,0.398183107376099,0.286346852779388,0.139497011899948,-0.129784807562828
"RookieBrig",0.907904624938965,0.9187992811203,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.49501097202301,0.57897675037384,0.323229432106018,0.239175021648407,-0.259320199489594
"Hamburg",0.907776474952698,0.958565413951874,0.982138693332672,0.997209966182709,0.976651847362518,0.92186564207077,0.885603487491608,0.757991135120392,0.539167761802673,0.43432354927063,0.332670390605927,0.155216112732887,-0.151661023497581
"Lhermione",0.877424120903015,0.964398622512817,0.973493456840515,1.00120043754578,0.969609379768372,0.895467102527618,0.841859221458435,0.718162655830383,0.542236685752869,0.436647295951843,0.323266595602036,0.169001549482346,-0.10212404280901
"Snow",0.972789466381073,0.957600355148315,0.960616827011108,1.0002852678299,0.824447214603424,0.827346682548523,0.946956813335419,0.76895272731781,0.63469785451889,0.582274436950684,0.472966611385345,0.262696743011475,-0.249456852674484
"Pavel",0.792188942432404,0.93561065196991,0.989476144313812,0.974980115890503,0.896185576915741,0.822847306728363,0.846558094024658,0.702219367027283,0.435774922370911,0.358989179134369,0.236988544464111,0.0913731530308723,-0.139976561069489
"TradersLynx",0.532278835773468,0.646284937858582,0.734185039997101,0.760524809360504,0.812957763671875,0.93157172203064,1.00052952766418,0.927837312221527,0.925526201725006,0.996561944484711,0.838097333908081,0.53007984161377,-0.0525373816490173
"Lynx",0.532278835773468,0.646284937858582,0.734185039997101,0.760524809360504,0.812957763671875,0.93157172203064,1.00052952766418,0.927837312221527,0.925526201725006,0.996561944484711,0.838097333908081,0.53007984161377,-0.0525373816490173
"PrincedeNeufchatel",0.848778426647186,0.958301663398743,0.999357461929321,0.976577162742615,0.954367458820343,0.984639763832092,0.996483445167542,0.930646538734436,0.786815643310547,0.712929487228394,0.527663350105286,0.325583338737488,-0.0722597166895866
"Renommee",0.795650064945221,0.89810311794281,0.973023891448975,0.996667683124542,0.960921287536621,0.92350822687149,0.85180652141571,0.719530642032623,0.575601875782013,0.483865916728973,0.360899329185486,0.1506028175354,-0.0968957170844078
"RookieSnow",0.972789466381073,0.957600355148315,0.960616827011108,1.0002852678299,0.824447214603424,0.827346682548523,0.946956813335419,0.76895272731781,0.63469785451889,0.582274436950684,0.472966611385345,0.262696743011475,-0.249456852674484
"Cutter",0.728494167327881,0.790638506412506,0.813238978385925,0.813403606414795,0.857197999954224,0.950983881950378,0.997444868087769,0.945230484008789,0.983980417251587,0.989391446113586,0.700145483016968,0.424478948116302,-0.0562432110309601
"Bellona74",0.816375613212585,0.936930894851685,0.988107442855835,0.996643424034119,0.942412972450256,0.877267062664032,0.868031620979309,0.726795315742493,0.44377401471138,0.361215323209763,0.241659790277481,0.0903672203421593,-0.140772551298141
"Trincomalee",0.832170903682709,0.902271628379822,0.985888719558716,0.989868223667145,0.970807313919067,0.940806329250336,0.840245366096497,0.689770102500916,0.515985190868378,0.419675171375275,0.324815839529037,0.163178458809853,-0.0968957170844078
"Victory",0.816791236400604,0.905348181724548,0.980737447738647,0.998140692710876,0.973226845264435,0.915085315704346,0.849262416362762,0.696688413619995,0.427220493555069,0.249354660511017,0.161347717046738,0.0935477539896965,-0.129566252231598
"Wasa",0.903700172901154,0.964088678359985,0.988447427749634,0.999410033226013,0.97262442111969,0.930889248847961,0.875492870807648,0.744813442230225,0.539288103580475,0.428293406963348,0.300232023000717,0.156852394342422,-0.140772551298141
"Mercury",0.813431262969971,0.905767142772675,0.972116589546204,0.998867750167847,0.960777461528778,0.896881699562073,0.979514062404633,0.821292281150818,0.661518633365631,0.608943700790405,0.457717478275299,0.240569084882736,-0.259320199489594
"Essex",0.833995461463928,0.910735547542572,0.973840832710266,0.99613630771637,0.965568840503693,0.92396092414856,0.892918765544891,0.783014595508575,0.614684402942657,0.437216997146606,0.25872129201889,0.168681815266609,-0.212512999773026
"Indefatiable",0.877352893352509,0.935259401798248,0.973200798034668,1.00120043754578,0.969609379768372,0.897990822792053,0.843265891075134,0.698419153690338,0.532202363014221,0.436647295951843,0.323266595602036,0.169001549482346,-0.10212404280901
"GrosVentre",0.913928985595703,0.963385879993439,0.986935496330261,1.00089359283447,0.987335562705994,0.971958696842194,0.925983369350433,0.930244982242584,0.795269072055817,0.515271663665771,0.397909581661224,0.211106672883034,-0.100666999816895
"Pandora",0.792188942432404,0.93561065196991,0.989476144313812,0.974980115890503,0.896185576915741,0.841043531894684,0.887555301189423,0.73204243183136,0.446264714002609,0.358989834785461,0.236988544464111,0.0913731530308723,-0.139976561069489
"BrigMR",0.826148629188538,0.912718594074249,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.474649310112,0.501676023006439,0.323229432106018,0.239175021648407,-0.259320199489594
"NavyBrig",0.826148629188538,0.912718594074249,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.49501097202301,0.57897675037384,0.323229432106018,0.239175021648407,-0.259320199489594
"Ocean",0.787681877613068,0.901673376560211,0.970308780670166,0.995838046073914,0.961763143539429,0.862410068511963,0.764305830001831,0.477654784917831,0.209703385829926,0.186606153845787,0.167434334754944,0.11640040576458,-0.11904639005661
"RattlesnakeHeavy",0.819048285484314,0.909329354763031,0.97773540019989,0.995458722114563,0.943179130554199,0.922312438488007,0.893748581409454,0.754612565040588,0.569385051727295,0.519350707530975,0.413033157587051,0.253520905971527,-0.179818704724312
"TradersBrig",0.907904624938965,0.9187992811203,0.973850250244141,0.995810508728027,0.953455448150635,0.945964455604553,0.907043993473053,0.674097657203674,0.49501097202301,0.57897675037384,0.323229432106018,0.239175021648407,-0.259320199489594

 

Share this post


Link to post
Share on other sites
jodgi    2,312

Crap! I forgot all about max speed... @qw569, could I bother you to sneak that in? Looking at the syntax I'm still not sure how to do it. 

Share this post


Link to post
Share on other sites
qw569    1,170
2 minutes ago, jodgi said:

Crap! I forgot all about max speed... @qw569, could I bother you to sneak that in? Looking at the syntax I'm still not sure how to do it. 

:)

	curl http://storage.googleapis.com/nacleanopenworldprodshards/ItemTemplates_cleanopenworldprodeu1.json | sed "s/^.\{20\}//" | sed "s/.\{1\}$//" | jq -r ".[]|select(.ShipTemplateName!= null)|[.ShipTemplateName,.Specs.MaxSpeed,.Specs.SpeedToWind[]]|@csv"
	

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×