Grim DeGrim Posted March 18, 2016 Posted March 18, 2016 Stick to the Topic please. Dorian - his comment is on topic. He is asking if the port attack timers is available in the app data.
Capt. Rice Posted March 18, 2016 Posted March 18, 2016 I did the same at http://www.ddz.net/navalaction did some actually look for tuna fish?
Taranis Posted March 18, 2016 Posted March 18, 2016 Relax sunshine.... The data we can access is NOT live data. Â I don't think that live data is the concern he is referring to.
ObiQuiet Posted March 18, 2016 Posted March 18, 2016 (edited) I don't think that live data is the concern he is referring to. * a file dump or read-only api that is hosted separately from the game servers causes no concern over hacks or injection or denial of service to affect the game. Since its hosted separately, the machine is also not likely a vector past a game labs firewall. The point that apis should be secured is a fair one, but is just part of being a software professional and doesn't deserve mention here unless we notice a mistake. * making information about the state of the game world readily available CAN lead to unintended consequences in terms of advantages to players, new exploits, etc. That's what we're here to discuss in specifcs. And, it's one reason to start with a simple data export like this one instead of a functional API. An example of the second case might have been revealing a player's location by including player shop contracts by name. But, that's not there so we're ok on that one. Edited March 18, 2016 by ObiQuiet 1
Black Spawn Posted March 18, 2016 Posted March 18, 2016 it's called recipe template Can you please clarify this?
raskolnikoff Posted March 19, 2016 Author Posted March 19, 2016 Can you please clarify this? blueprint "class" called RecipeTemplate
Mored Posted March 19, 2016 Posted March 19, 2016 blueprint "class" called RecipeTemplate And where is the data for it? There is only Meta information in the ItemTemplates array. and no other array available
raskolnikoff Posted March 19, 2016 Author Posted March 19, 2016 And where is the data for it? There is only Meta information in the ItemTemplates array. and no other array available  There is multiple recipe classes - Recipe*Template, where * can be Module, Ship, .. (ex. RecipeModuleTemplate)
ObiQuiet Posted March 19, 2016 Posted March 19, 2016 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. [...] 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.  Good points.  I agree that without NPC production the ability to make lots of money on small price spreads will diminish, especially if NPC shops don't buy anything either.
Black Spawn Posted March 20, 2016 Posted March 20, 2016 blueprint "class" called RecipeTemplate  Thanks for the reply. But still i don't quite get it. How would one get the required parts for a lets say Bellona? As for a question of Mored you stated earlier:   all the data is in blueprint template, it has all references and FullRequirements field which contains all required materials  I dont see anything pointing from RecipeTemplate to the contained  "RecipeResourceTemplate"s. Sorry for bothering again, but did i miss something?
raskolnikoff Posted March 20, 2016 Author Posted March 20, 2016  Thanks for the reply. But still i don't quite get it. How would one get the required parts for a lets say Bellona? As for a question of Mored you stated earlier:   I dont see anything pointing from RecipeTemplate to the contained  "RecipeResourceTemplate"s. Sorry for bothering again, but did i miss something?  Ok, I've found the issue - part of the data is not being exported. I will fix this in a next couple of weeks (most likely with a next content patch) Sorry for messing things up 2
Black Spawn Posted March 20, 2016 Posted March 20, 2016 Ok, I've found the issue - part of the data is not being exported. I will fix this in a next couple of weeks (most likely with a next content patch) Sorry for messing things up  Thanks again for checking, really appreciate it.
marioch Posted March 20, 2016 Posted March 20, 2016 (edited) Just created a simple website with a port timers quadrant. Â http://mdb-dev.es/NavalPorts/ Â It's simply awesome to finally have an API Â BTW, What charset is it encoded in? UTF-8 seems to be unable to read the special characters :S Edited March 20, 2016 by marioch 2
Erekel Posted March 21, 2016 Posted March 21, 2016 Thanks for the data, makes things a lot easier for me, instead of relying on people to enter data into my site, I can use this. Â Although, I'd prefer pure JSON as opposed to JSONP, as not everyone uses pure Javascript, and I dislike the need to sanitize the data before parsing (also, if I was being picky, its not even truly valid JSONP anyway). Â JSONP: Callback( { "Hello": "World" } ); Also, the UTF-8 issue is a bit of a deal breaker so far for me. Â Once at least the UTF-8 issue is resolved, I'll integrate this into my tool (https://www.navalaction.tools), and make a public API available for all data. Â In-case anyone is curious, I'm planning on creating a file hash from the json files, storing those in reddis and then on subsequent imports, creating a new hash and comparing to see if anything has changed before attempting a full blown import, and then using a differential algorithm to work out exactly what changed, so I have no need to perform a full loop of the data, although I'll have to create a benchmark to see the differences in time to see if the differential is necessary. Â Â
thewuif Posted March 21, 2016 Posted March 21, 2016 Thanks for the data, makes things a lot easier for me, instead of relying on people to enter data into my site, I can use this. Â Although, I'd prefer pure JSON as opposed to JSONP, as not everyone uses pure Javascript, and I dislike the need to sanitize the data before parsing (also, if I was being picky, its not even truly valid JSONP anyway). Â JSONP: Callback( { "Hello": "World" } ); Also, the UTF-8 issue is a bit of a deal breaker so far for me. Â Once at least the UTF-8 issue is resolved, I'll integrate this into my tool (https://www.navalaction.tools), and make a public API available for all data. Â In-case anyone is curious, I'm planning on creating a file hash from the json files, storing those in reddis and then on subsequent imports, creating a new hash and comparing to see if anything has changed before attempting a full blown import, and then using a differential algorithm to work out exactly what changed, so I have no need to perform a full loop of the data, although I'll have to create a benchmark to see the differences in time to see if the differential is necessary. Â i'm having the same problem with UTF-8 and the JSONP (would also prefere JSON). Also it would be nice to have a timestamp to know when the data was created.
Martin Posted March 21, 2016 Posted March 21, 2016 i'm having the same problem with UTF-8 and the JSONP (would also prefere JSON). Also it would be nice to have a timestamp to know when the data was created. All of this, you have the option in javascript to parse as standard JSON so JSONP adds nothing for us! Â Some integer fields are exported as Strings, Id and Nation come to mind.
ObiQuiet Posted March 21, 2016 Posted March 21, 2016 Best pracrice is to treat ids as strings. Ids are not necessarily numbers, could be guids if moved to a non-sql database. I would prefer they treat ids as strings to avoid issues with that, leading zeros, null keys, etc etc... of course these modern loosely typed languages... but, I digress...
Capt. Rice Posted March 22, 2016 Posted March 22, 2016 Just created a simple website with a port timers quadrant. Â http://mdb-dev.es/NavalPorts/ Â It's simply awesome to finally have an API Â BTW, What charset is it encoded in? UTF-8 seems to be unable to read the special characters :S nice work i like this format.
Mored Posted March 23, 2016 Posted March 23, 2016 There is no problem with jsonp and jacasvript, if you have trouble just search for the example i made in this tread before
Taralin Snow Posted March 23, 2016 Posted March 23, 2016 It's a problem if you are using a language other than JavaScript. Â My JSON parser is written in C# and while it was able to parse JSON value expressions it was not able to parse JavaScript statements that assign JSON value expressions to variables.
slik Posted March 23, 2016 Posted March 23, 2016 It's a problem if you are using a language other than JavaScript.  My JSON parser is written in C# and while it was able to parse JSON value expressions it was not able to parse JavaScript statements that assign JSON value expressions to variables. I use regexp to extract the json. Like /\W+=\s+([{\[].*?[\]}]);/
Taralin Snow Posted March 23, 2016 Posted March 23, 2016 (edited) I use regexp to extract the json. Like /\W+=\s+([{\[].*?[\]}]);/  That would work if you read the entire JSON into an in-memory string before you start parsing any of it, but my parser reads directly from the incoming http stream to avoid needless use of memory.  By the time I read the last few bytes of the http response, the bulk of the JSON has already been parsed.  I suppose it's possible to apply regex scanning to a stream rather than an in-memory string but I wouldn't call it easy.  Of course this idea of using a regex may still be a useful tactic for others, even if it does not help me.  I don't want to give the wrong impression that I think this is a bad idea, it just happens that it doesn't help in my particular situation.  Incidentally, I have already solved the problem for myself although I didn't go into details on how because I didn't think anyone would be interested.  What I did was amend the expression parser to also recognize a limited class of statements (specifically "var identifier = json-value-expression" but I can add others such as callback function definitions). Edited March 23, 2016 by Taralin Snow
Svartschegg Posted March 25, 2016 Posted March 25, 2016 (edited) This is neither JSON nor JSONP. It is Javascript. Why they name the files .json is beyond me  JSON is data in a javascript object notation format. JSONP is data passed to a callback function which is named according to a request query parameter (commonly called "callback" for simplicity). In reality, JSONP is essentially Javascript that has been twisted  into a data-loading method to circumvent CORS. This is a variable declaration in Javascript. Edited March 25, 2016 by Svartschegg
LethaK Maas Posted March 30, 2016 Posted March 30, 2016 (edited)  This is neither JSON nor JSONP. It is Javascript. Why they name the files .json is beyond me   Indeed...   Here is a quick PHP function to transform this javascript declaration into proper JSON  returns null if something is wrong, or a PHP array containing datas from the "API" function fetchEndpoint($endpointUrl) { $content = file_get_contents($endpointUrl); if($content!==null && is_string($content)) { $equalPos = strpos($content, '='); if($equalPos!==false) $content = trim(print_r(substr($content, $equalPos+1), true), ' ;'); $JSON = json_decode($content,1); return $JSON; } return null; } Edited March 30, 2016 by LethaK Maas
Recommended Posts