Jump to content
Game-Labs Forum
raskolnikoff

Public "API" for Naval Action

Recommended Posts

surfimp    692

Guys, relax. "Information wants to be free." Someone will make a sweet, publicly -available website / map incorporating this data soon enough. I have no idea who, but I've been around the Internet long enough to know that this is the way of things.

Share this post


Link to post
Share on other sites
jodgi    2,312

This is great!

I just did a quick copy-paste of the tradertool (I'll kill it if it's not allowed), while we wait for the real web dudes.

Share this post


Link to post
Share on other sites
Jan van Santen    165

So we still don't have a sextant and a chronometer to tell us were we are on the map....but we know now w/o ever visiting a port what is sold there. 

Nobody needs to explore anymore, you get all the info served on a silver platter. Another part of the fun of this game was burried...

 

The good thing: we can finally forget words like "simulation" or "realism" when discussing Naval Action.

 

 

 

.

Edited by Jan van Santen

Share this post


Link to post
Share on other sites
Mored    83

Because so many people have problems with the API i will give you a sample how to get all Ports.

Result can be seen here (https://docs.google.com/spreadsheets/d/1M-wUC6pK3eQL8rwNHGH4uoAqVE-UOkGhQdML6NFQYLA/edit#gid=1565570060)

and this is the function (in Google Sheet open Tools->Scripteditor and copy this code)

function getAllTowns(){
 var options = {
     "contentType" : "ContentService.MimeType.JAVASCRIPT",
   };

var url_ports = "http://storage.googleapis.com/nacleanopenworldprodshards/Ports_cleanopenworldprodeu1.json";
eval(UrlFetchApp.fetch(url_ports,options).getContentText());// Ports
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("Ports");
  sheet.getRange(1, 1, 368, 4).clearContent();

  sheet.getRange(1, 1).setValue("Id");
  sheet.getRange(1, 2).setValue("Name");
  sheet.getRange(1, 3).setValue("NationId");
  sheet.getRange(1, 4).setValue("Nation Name");
  sheet.getRange(1, 5).setValue("ConquestFlagTimeSlot");
  sheet.getRange(1, 6).setValue("LordProtector");
  
  var index = 0;
  var Nation = "not set";
  for(index = 0; index < Ports.length; index++){
    switch(Ports[index].Nation)
    {
      case 0: Nation = "Neutral";
      break;
      case 1: Nation = "Pirates";
      break;
      case 2: Nation = "Espana";
      break;
      case 3: Nation = "France";
      break;
      case 4: Nation = "Great Britain";
      break;
      case 5: Nation = "Verenigde Provincien";
      break;
      case 6: Nation = "Danmark-Norge";
      break;
      case 7: Nation = "Sverige";
      break;
      case 8: Nation = "United States";
      break;
      case 9: Nation = "Free Towns";
      break;
      default: Nation = "not set";
    }
  sheet.getRange(index+2, 1).setValue(Ports[index].Id);
  sheet.getRange(index+2, 2).setValue(Ports[index].Name);
  sheet.getRange(index+2, 3).setValue(Ports[index].Nation);
  sheet.getRange(index+2, 4).setValue(Nation);
  sheet.getRange(index+2, 5).setValue(Ports[index].ConquestFlagTimeSlot);
  sheet.getRange(index+2, 6).setValue(Ports[index].Capturer);
  }
}
Edited by Mored

Share this post


Link to post
Share on other sites
Martin    7

 

Because so many people have problems with the API i will give you a sample how to get all Ports.

Result can be seen here (https://docs.google.com/spreadsheets/d/1M-wUC6pK3eQL8rwNHGH4uoAqVE-UOkGhQdML6NFQYLA/edit#gid=1565570060)

and this is the function (in Google Sheet open Tools->Scripteditor and copy this code)

function getAllTowns(){
 var options = {
     "contentType" : "ContentService.MimeType.JAVASCRIPT",
   };

var url_ports = "http://storage.googleapis.com/nacleanopenworldprodshards/Ports_cleanopenworldprodeu1.json";
eval(UrlFetchApp.fetch(url_ports,options).getContentText());// Ports
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("Ports");
  sheet.getRange(1, 1, 368, 4).clearContent();

  sheet.getRange(1, 1).setValue("Id");
  sheet.getRange(1, 2).setValue("Name");
  sheet.getRange(1, 3).setValue("NationId");
  sheet.getRange(1, 4).setValue("Nation Name");
  sheet.getRange(1, 5).setValue("ConquestFlagTimeSlot");
  sheet.getRange(1, 6).setValue("LordProtector");
  
  var index = 0;
  var Nation = "not set";
  for(index = 0; index < Ports.length; index++){
    switch(Ports[index].Nation)
    {
      case 0: Nation = "Neutral";
      break;
      case 1: Nation = "Pirates";
      break;
      case 2: Nation = "Espana";
      break;
      case 3: Nation = "France";
      break;
      case 4: Nation = "Great Britain";
      break;
      case 5: Nation = "Verenigde Provincien";
      break;
      case 6: Nation = "Danmark-Norge";
      break;
      case 7: Nation = "Sverige";
      break;
      case 8: Nation = "United States";
      break;
      case 9: Nation = "Free Towns";
      break;
      default: Nation = "not set";
    }
  sheet.getRange(index+2, 1).setValue(Ports[index].Id);
  sheet.getRange(index+2, 2).setValue(Ports[index].Name);
  sheet.getRange(index+2, 3).setValue(Ports[index].Nation);
  sheet.getRange(index+2, 4).setValue(Nation);
  sheet.getRange(index+2, 5).setValue(Ports[index].ConquestFlagTimeSlot);
  sheet.getRange(index+2, 6).setValue(Ports[index].Capturer);
  }
}

Don't hardcode your making all of us sad :(

Share this post


Link to post
Share on other sites
Gatsu    29

And what use the would this API be? We get an update once every day (maintenance) making almost every data we can get inaccurate except within maybe 30 minutes after maintenance. This seems quite pointless to me, someone please enlighten me.

Share this post


Link to post
Share on other sites
Ratline    283

So we still don't have a sextant and a chronometer to tell us were we are on the map....but we know now w/o ever visiting a port what is sold there. 

Nobody needs to explore anymore, you get all the info served on a silver platter. Another part of the fun of this game was burried...

 

The good thing: we can finally forget words like "simulation" or "realism" when discussing Naval Action.

 

 

 

.

 

Aye, don't like this at all. A step closer to being an evelike spreadsheets online game.

Share this post


Link to post
Share on other sites
Wyspa    89

I don't see a problem with that at least for two reasons.

1) API is mainly for out of game use since it is not implemented ingame, so it is not obligatory.

2) Tools like that already exists and will exist regardles of the API existance (example: http://www.navalactioncraft.com/shop-price).What this API does is only making it easier for guys working on community tools in development of such tools.

So basically API doesn't change much, we have tools already, only difference is now they can be made more reliable.

Those kinds of tools really help any MMO community and will exist regardless, but developers helping community in developing such tools is a good move showing us they care and want to share information we can find useful, so community tool makers don't have to reverse engineer everything.

Edited by Wyspa

Share this post


Link to post
Share on other sites
jodgi    2,312

You eco guys are a funny bunch.

I've heard so much about "EVE" this and "EVE" that over the last year that my ears are bleeding. But the minute we get a feature that is EVE-like it's suddenly terrible!?

Share this post


Link to post
Share on other sites
victor    690

You eco guys are a funny bunch.

I've heard so much about "EVE" this and "EVE" that over the last year that my ears are bleeding. But the minute we get a feature that is EVE-like it's suddenly terrible!?

 

Thay are blasphemous infiels: EVE is wonderful! And such is everything is EVE-like! Also goons ... oh wait!

Edited by victor

Share this post


Link to post
Share on other sites
Mored    83

Don't hardcode your making all of us sad :(

Yeah sorry,  it was only a short example and to keep it simple i decided to hardcode the nations in there. Also the code to enter the data into the table is really bad but easy to read.

In my version i use a array and write the data as a block.

function print_data(shart,data){
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName(shart);
  sheet.clearContents();
  sheet.getRange(1,1,data.length,data[0].length).setValues(data);
}

Edited by Mored

Share this post


Link to post
Share on other sites
Pagan Pete    943

WARNING:

 

 

Community tools often (always) risk hackers and exploits!

 

DONT API the game! For the love of Pig Cloud!

Share this post


Link to post
Share on other sites
Prater    5,325

Once the AI stops producing resources this tool won't have any negative impact.  I think we need to think of AI producing goods as temporary and not long term, as devs have stated it will be removed or very much reduced.

 

Also, I'm not sure how you can hack this or exploit it.  It is separate from Naval Action.  It is a deposit, not a connection into the game servers.

Share this post


Link to post
Share on other sites
Mored    83

There are some disadvantages but they are really low in comparison what you can get on other information.

For Example a google docs sheet can now show you the times when a port is attackable, so you dont have to use the *sorry* crap ingame function to find out which citys are when attackable.

Share this post


Link to post
Share on other sites
ObiQuiet    465

Once the AI stops producing resources this tool won't have any negative impact.

Can you explain more, not sure I follow your reasoning... and you're usually right.

Share this post


Link to post
Share on other sites
Prater    5,325

Can you explain more, not sure I follow your reasoning... and you're usually right.

 

I could be wrong, but once npc port resources are eliminated, prices and quantities will be set by players.    I am guessing that trade hubs will be set up.  Players won't want to spread out across the map because not all ports can have guaranteed protection.  US players will probably produce mainly around Cabo.  Because production will be up to the player, there won't be a guaranteed "so many resources are produced each hour by the server" and these are typically bought for a cheaper price.  There will be less advantage for players who play right after Maintenance.

 

I still don't think shop data should be published, but I don't think it will really matter.  Once npcs are taken out of production, I think the economy will drastically change and this tool won't really affect it or give a major advantage.  It will mostly show where the trading hubs are.  Maybe some player will set up in a remote spot and put up gold for 130 gold each, but I doubt it.

Share this post


Link to post
Share on other sites
ClovenLife    0

Any hopes of getting access to nation/clan/player data?  (not positional)
I would love to be able to put together a site with player stats. Clan rankings, Nation numbers. 
A JSON dump like this once a day would be perfect

Share this post


Link to post
Share on other sites
Tristana    1

Cool looks good. Thx.

 

Recently we've finished preparing server data for public access and now we are ready to share it with community

Currently we prefer to avoid extra load on our servers so "API" does not contain run-time information, instead we're making dump of all data each time when we do maintenance and export it to google storage

All information about shard contained in 4 files:
- ItemTemplates_*.json
- Shops_*.json
- Ports_*.json
- Nations_*.json
where '*' replaced by internal shard name (ex. ItemTemplates_cleanopenworldprodeu1.json) and stored at google storage (ex. https://storage.googleapis.com/nacleanopenworldprodshards/ItemTemplates_cleanopenworldprodeu1.json)

From this data you can access description about all item templates in game (not items), shop content, port statuses and national information, but there is no player specific data

Also, in here (http://pastebin.com/Q68M53ev) you can find simple tool based on top of this data - TradersTool, which allows to find specific items/resources/materials/... within specified range from port and filtered by nation

Edited by Joo

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

×