Showing Highly Rated Posts By smiley.1438:

API implementation library "master list"

in API Development

Posted by: smiley.1438

smiley.1438

Ok, i’ve pulled together all my gists and put them into a repo. This is not “Yet-Another-API-Wrapper”, more a collection of “How-To” examples (more to come)

gw2api-tools

(edited by smiley.1438)

HEADS UP: OAuth2 being replaced next week

in API Development

Posted by: smiley.1438

smiley.1438

instead of registering an app and going through the OAuth2 code flow, users simply create and copy-paste an API key into your client.

I doubt that this would make anything better for the users. There are a lot of people out there who hardly know to start a pc and run their game – imagine these to create and use an API key. Despite of it’s flaws, OAuth2 is being used all over the web for way more sensitive applications and most users are used to it. I mean, we’re talking about an API account which reveals little sensitive data, not actual user account info (e.g. real names, address, billing info).
So the only thing you might mitigate is that a user gets their login data scammed (which also happens in so many different ways) at the cost of making the login flow less user friendly. You cannot mitigate PEBCAK.

[API Suggestion] World vs World

in API Development

Posted by: smiley.1438

smiley.1438

once we get a good objective_names.json file

I know, it’s not official, but it’s all you need – i believe, objectives are the least thing which will change

https://gist.github.com/codemasher/bac2b4f87e7af128087e

2 Hopefully quick adds/fixes

in Forum and Website Bugs

Posted by: smiley.1438

smiley.1438

#1: https://forum-en.gw2archive.eu/forum/support/forum/Search-feature-not-working

#2: You can at least display the time of the last message with something like greasemonkey/tampermonkey:

div.topic > span.title > a.topic

holds a dataset value

data-last-message="2014-09-05T18:37:05Z"

see also: https://gist.github.com/codemasher/f8a367b2d202afcc201e#file-ws-forumtweak-js

(edited by smiley.1438)

Flood Control? Seriously?

in Forum and Website Bugs

Posted by: smiley.1438

smiley.1438

I don’t mind the risk of an infraction, but i’d like to share a quote on this topic from #gww:

We’ve added 10 years to your sentence for asking why you’re in jail.

[CSS-Hack] Fluid forum layout

in Guild Wars 2 Discussion

Posted by: smiley.1438

smiley.1438

Ok, i just wanted to adjust the width of the forum, because i’m sick of having 50% space wasted on my 1920 screen, but i ended up in a whole “redesign”. I’d like to share it with you, you just need a browser plug which can handle user stylesheets. Have fun

https://gist.github.com/codemasher/5884119

/*
 * Fluid Layout CSS Hack for the official Guild Wars 2 Forums
 *
 *
 * This stylesheet will override the forums default style and set it to a fluid full width layout
 * with increased font sizes for better readability at high resolutions.
 * It will also fix a few quirks like the unusable language links on the top and margins around smileys,
 * adds a monospace font and background for <pre> tags, increases the size of editor textareas and hides the e-mail address in the forums overall header.
 * (if you ever happen to make screenshots on the forums)
 *
 * intended for use with tools like:
 *
 * Stylebot (developed and tested with that)
 * https://chrome.google.com/webstore/detail/stylebot/oiaejidbmkiecgbjeifoejpgmdaleoha
 *
 * Stylish for Firefox (a few things somehow don't work, like min-height for posts)
 * https://addons.mozilla.org/de/firefox/addon/stylish/
 *
 * ...or any other browser plug-in which lets you add user defined styles.
 *
 * If you have suggestions or encounter problems with this stylesheet, just drop me a line on the gw2 forums
 * or just leave a comment right here on GitHub. (just don't ask me how to install this!)
 *
 *
 * smiley.1438
 *
 */

Attachments:

(edited by smiley.1438)

[API Suggestion] Characters

in API Development

Posted by: smiley.1438

smiley.1438

While we’re at it:

I’m a friend of “let the owner decide what info he wants to reveal” – this won’t need authorisation and would give people full control of their data. The only thing i’d like to see public would be a characters name. People would have to allow in their game options. So:

  • Character name (public)
  • Account name (user decision)
  • Character location (user decision)
  • Character data like achievements and stuff (user decision)

Personal stuff

  • Friendlist (authorized)
  • Chat (authorized)
  • Messages (authorized)
  • Inventory and chest? (authorized)

(edited by smiley.1438)

Search feature not working

in Forum and Website Bugs

Posted by: smiley.1438

smiley.1438

Okay, thanks for the infraction, but this thread should be pinned since it seems noone at anet cares about this issue.
Please just remove the search box (protip: style=“display:none;”) and add a hint that we should better use the google site search instead. You can also add a google custom search box (https://developers.google.com/custom-search/) to save us the hassle typing site:http://forum-en.guildwars2.com/ into googles search.

Thanks.

Online Character Viewer

in API Development

Posted by: smiley.1438

smiley.1438

You will know, however, if an app is requesting access to your credentials before you even allow it since you’ll get a page like this: http://i.imgur.com/E9XKVy3.png which actually sits on ANet’s servers.

After the login screen you’ll get a screen which will be similar like the following (similar as in: the wording will be clarified). Note the URL, the login and the authorization will always happen on Anet’s servers.

€: If you’re interested in how OAuth2 actually works, you might want to read this: https://aaronparecki.com/articles/2012/07/29/1/oauth2-simplified (or just google for OAuth2)

Attachments:

(edited by smiley.1438)

Can we get the current server time?

in API Development

Posted by: smiley.1438

smiley.1438

I don’t think it’s too hard to calculate that

Progress is reset each day at midnight, 00:00 UTC (02:00 UTC+2).

http://wiki.guildwars2.com/wiki/Daily#Notes

PHP-SQL script takes >9hrs to complete db

in API Development

Posted by: smiley.1438

smiley.1438

Yes, 9h to complete seems highly inefficient – it should actually not take longer than a couple minutes to complete when using the bulk feature. Yor script initiates a new (single) cURL instance for each request and doesn’t queue these up to process them asynchronous which means it has to wait for the whole lifecycle of one request until it fires another one. You might want to take a look at rolling (multi) curl and maybe also at my database project on GitHub which uses it. (takes about half an hour to download the whole items database in 4 languages on my very slow connection)

https://github.com/codemasher/gw2-database/blob/master/classes/rollingcurl.class.php
https://github.com/codemasher/gw2-database/blob/master/classes/gw2items.class.php#L156

€: also you need to connect through https since the http URL redirects you to the https one each time (which probably costs some time) – to make cURL work with https, you need to provide a CA root certificate: http://curl.haxx.se/ca/cacert.pem by passing the parameters:

CURLOPT_SSL_VERIFYPEER = true
CURLOPT_SSL_VERIFYHOST = 2
CURLOPT_CAINFO = ‘path/to/certificates.pem’

(edited by smiley.1438)

HTML module for wvwvw scores in your webpage

in API Development

Posted by: smiley.1438

smiley.1438

the great thing about his stuff was that you can add it to a HTML block in guild sites/server pages. A little widget with the current matchup score.

you can’t really do any php with a guild host layout.

That wouldn’t be much of the problem i think – lets see what i can do for you

Info on these API-things.

in API Development

Posted by: smiley.1438

smiley.1438

These are things which are easily possible with the current API. I think there’s no mod for a forum so far, but since one can write such apps mostly in javascript it would’t require much of a mod, more like one or 2 lines HTML in a forums template, the rest could be managed by the script which would be needed to include.

Online Character Viewer

in API Development

Posted by: smiley.1438

smiley.1438

so, if i understand this right… i would have to be using the app, and then log in to my account on guildwars2.com… and then grant permission. so if i never use any apps, then they’ll never gain access to any of my information.

Exactly this.

[API Suggestion] Few generic API Suggestions

in API Development

Posted by: smiley.1438

smiley.1438

I still wonder why (a very few) people still demand XML as data format. Ok, i can understand that it might be easier to parse in certain languages but i can’t see an advantage over JSON in the case of the GW2 API (and many more…). Don’t get me wrong, but personally i’d kill XML with fire – along with excel. Any decent language has possibilities to parse JSON easily (either native or as library) and also i heard that SQL databases are pretty handy when it comes to statistics. So when you’re working with MS-Office, you should at least favor Access over Excel.

Also for the notes – just for example:

https://twitter.com/thomasfuchs/status/379675885647192065 / https://gist.github.com/madrobby/6584720

Plotting events on a map

in API Development

Posted by: smiley.1438

smiley.1438

For calculation of the map-coordinates -> world-coordinates have a look at this thread:
https://forum-en.gw2archive.eu/forum/community/api/Event-Details-API-location-coordinates/first#post2262330

tl;dr: use the following to recalculate your coords:

function recalc_coords(continent_rect, map_rect, coords){
	return [
		Math.round(continent_rect[0][0]+(continent_rect[1][0]-continent_rect[0][0])*(coords[0]-map_rect[0][0])/(map_rect[1][0]-map_rect[0][0])),
		Math.round(continent_rect[0][1]+(continent_rect[1][1]-continent_rect[0][1])*(1-(coords[1]-map_rect[0][1])/(map_rect[1][1]-map_rect[0][1])))
	]
}

live example (caution, overkill!) http://gw2.chillerlan.net/examples/gw2maps-jquery.html

€: i checked your fiddle, the x coordinates were correct, buy y was far out, you should get [29753,12677]

(edited by smiley.1438)

Why APIs return IDs

in API Development

Posted by: smiley.1438

smiley.1438

Thanks for that information, very interesting read!

Search feature not working

in Forum and Website Bugs

Posted by: smiley.1438

smiley.1438

“There is no spoon.”

Played time (age) api

in API Development

Posted by: smiley.1438

smiley.1438

I think it was mentioned before to expose the account’s/character’s age via the API. When in doubt, just open a pull request over here: https://github.com/arenanet/api-cdi/pulls

The EU Bronze League Thread

in Match-ups

Posted by: smiley.1438

smiley.1438

yes, sir. we do have fun, sir.

Attachments:

The response serializations are insane

in API Development

Posted by: smiley.1438

smiley.1438

At this point, it would be far more damaging to change the spec and break everyone’s stuff, so I would prefer it if no changes were made. However, presenting a consistent format for all new APIs going forward would be a great idea.

I wouldn’t mind at all if it would break stuff in favour of overall consistent responses.

These APIs are in beta, so don’t be surprised if the interfaces change, but we will try to warn you if we have to make any breaking changes.

Ignore functionality for the forum

in Forum and Website Bugs

Posted by: smiley.1438

smiley.1438

There must be an ignore feature – in a way… Feature requests and bug reports about the forums software and website are successfully ignored for months now ^.^

'search' forums [i know there's a red post]

in Forum and Website Bugs

Posted by: smiley.1438

smiley.1438

Just use the proposed “fix”, google:

site:https://forum-en.gw2archive.eu/forum/[DESIRED_SUBFORUM] search term (the site: is important here)

https://www.google.com/?q=site:https:%2F%2Fforum-en.guildwars2.com%2Fforum%2Fsupport%2Fforum%2F+search+broken

I use it all the time in case i search stuff and it works better than this forum’s search has ever worked (and probably will if it ever gets fixed). Live with it

(edited by smiley.1438)

12/7 RoF/RoS/Dz

in Match-ups

Posted by: smiley.1438

smiley.1438

You know how to use mute in TS, don’t you? :P

Wrong WvW Objective Coordinates ?

in API Development

Posted by: smiley.1438

smiley.1438

Wait no. (it’s been a hard day…)

The above answer is correct when you get the coordinates from ingame, e.g. the Mumble link or the /v1/event_details API. It translates the relative map coordinate system into the continent’s absolute.
The solution to your problem is simpler: just don’t use the map_rect at all. continent_rect is what you need since the coordinates in the /v2/ APIs are already calculated to absolute.

[API Suggestion] Skills and Traits

in API Development

Posted by: smiley.1438

smiley.1438

Even if it would only deliver the current skill descriptions along with professions & ids and icons it’d be great!

UI Mod

in API Development

Posted by: smiley.1438

smiley.1438

This is the wrong subforum – we’re just talking about the REST API service here

However, GW2 doesn’t support any addons. In addition, that what you’re asking for is currently not possible via the API.

Created a json file for Mystic Forge recipes

in API Development

Posted by: smiley.1438

smiley.1438

You can also use http://gw2wbot.darthmaim.de/smiley/ and https://gw2treasures.com/ to reverse lookup IDs and chatcodes (well, as long as the items are / or were at one point in the API )

(edited by smiley.1438)

Bugged thread displays no posts

in Forum and Website Bugs

Posted by: smiley.1438

smiley.1438

Forum's search feature doesn't work? A tip...

in Players Helping Players

Posted by: smiley.1438

smiley.1438

I’d just like to add this one here, now that the old thread has been archived:

Anyway, i’ve posted a GitHub link to a little greasemonkey script along with a stylesheet in reply to this thread last week which is a temporary fix for the search, using Google’s custom search. However, my post got deleted and i got infracted for it because the moderator thought i posted bad stuff, which clearly wasn’t the case. I hope that’s now sorted out (thanks to Gaile!), so i’ll post it again:

https://gist.github.com/codemasher/654f05a7cdf1c268d404

In order to use this script, you’ll need a google account where you have to create a custom search engine and an API key (links inluded in the script’s comments). For now i assume you know how to use greasemonkey etc. and you know a little Javascript to see that is no malicious stuff at all – i’ll write up some instructions when i got some time on my hands. Enjoy.

There are a few minor bugs and possible enhancements to this script, however, i haven’t had time on my hands to fix it yet. Feel free to use and/or fork it!

I agree on the topic about the forum’s software. I wonder if this (fangamer forum) was so much cheaper than a commercial license of the Invision Power Board (Wildstar forums for example). Why can’t we have nice things?

Attachments:

(edited by smiley.1438)

Adding Karma Cost to Items API

in API Development

Posted by: smiley.1438

smiley.1438

A more paranoid person would say it’s a conspiracy to sell bank space!

Personally, I’d find it more believable if it were a conspiracy to sell character slots.

Yup, exactly that. Thick leather was invented to sell bank tabs…

wiki standardization

in API Development

Posted by: smiley.1438

smiley.1438

Why don’t you start a discussion on the wiki’s talk page where this topic would be more appropirate?
https://wiki.guildwars2.com/wiki/API_talk:2

Launching /v2/account (w/ Authentication)

in API Development

Posted by: smiley.1438

smiley.1438

but at the end of the callback method I now know that the browser I’m talking to is that person, and I could (kind of) use it authenticate users into my website without having to have my own user/pass system.

That’s basically what the “Login with Google/Facebook/Twitter” button on many websites does.

Btw. for PHP users: https://code.google.com/p/simple-php-oauth/

class GuildWars2 extends SimpleOauth{
	protected $_prefix = 'guildwars2';
	protected $_authorize_url = 'https://account.guildwars2.com/oauth2/authorization';
	protected $_access_token_url = 'https://account.guildwars2.com/oauth2/token';
	protected $_scope = ['account', 'offline'];

	protected function authorize(array $scope = [], $scope_separator = '+', $attach = null){
		parent::authorize($scope, $scope_separator, '&response_type=code');
	}

	protected function requestAccessToken(
		$method = 'GET', 
		array $params = ['grant_type' =&gt; 'authorization_code'], 
		$returnType = 'json', 
		array $values = ['access_token', 'token_type', 'scope', 'refresh_token']
	){
		parent::requestAccessToken($method, $params, $returnType, $values);
	}

}

€: https://gist.github.com/codemasher/89a909626724d929fd04

(edited by smiley.1438)

What are the WvW map bound value?

in API Development

Posted by: smiley.1438

smiley.1438

(edited by smiley.1438)

Are these available on the render service?

in API Development

Posted by: smiley.1438

smiley.1438

aswell as the WvW icons for forts, towers and camps

Especially these. We’ve been asking for those icons at least since the ruins icons have been added to the render service.

https://forum-en.gw2archive.eu/forum/community/api/API-Suggestion-World-vs-World/4345366

(edited by smiley.1438)

XML Output

in API Development

Posted by: smiley.1438

smiley.1438

Not to speak of the overhead XML has compared to JSON.

Exposing custom headers for CORS

in API Development

Posted by: smiley.1438

smiley.1438

Simply put: preflight requests are not supported. Thats why the access_token parameter exists in first place.

WvW objective names

in API Development

Posted by: smiley.1438

smiley.1438

I’ve added the spanish translations and a .json to my gist:

https://gist.github.com/codemasher/bac2b4f87e7af128087e

re the map names: i’ve kept them short since they’re for internal use only, you’ll need to add translation anyway if you want to use them out of the DB – i didn’t want to add 3 more columns for just 4 different words

Quick Q: Midnight Ice dye more blue-ish?

in API Development

Posted by: smiley.1438

smiley.1438

According to the colors API it doesn’t seem to have changed. The base color values are:

rgb(0, 0, 8) on cloth
rgb(15, 21, 24) on leather
rgb(1, 17, 23) on metal

Note that the color’s outcome also depends on the base color value of the armor piece to be dyed, so mileage may vary. Maybe they’ve changed the base color of that armor piece when the vault was introduced?
But on the other hand, it also looks “brighter” in the color list, maybe confused it with Midnight Blue dye?

You may also have a look at this: http://gw2.chillerlan.net/examples/gw2color.php

(edited by smiley.1438)

PHP-SQL script takes >9hrs to complete db

in API Development

Posted by: smiley.1438

smiley.1438

I’m sure you’ll get below 30 min, RollingCurl is da bomb!

How often is the event data updated?

in API Development

Posted by: smiley.1438

smiley.1438

Yes, please! Or even better: create a stickied (non discussion) FAQ thread where we could qoute or link important information.

Along with these qoutes from Cliff:

caching:

Yes, please cache the results!

The names are guaranteed to be static between game patches/builds, but it’s possible for the list to grow between patches. The Events API, like the Item API, only shows events and maps that have been discovered by players.

So the ‘perfect’ logic would be to cache the results, and only do a lookup after a patch or if you don’t have a cached result for a particular event ID. And you probably don’t really need to do it between patches, as event names will rarely if ever change after being created.

item discovery:

If any player in the world participates in an event, then it is considered discovered.
If any player in the world acquires an item, then it is considered discovered.

How quickly an item or event is discovered depends on how well-hidden it is in the world. It’s possible that an event or item might never be discovered.

Edit: To clarify, once something is discovered on any world, it is considered discovered on all worlds.

(edited by smiley.1438)

[Data dump] SQL data for static stuff

in API Development

Posted by: smiley.1438

smiley.1438

Hey,

i’ve created some SQL tables for the static data in order to cache results and reduce API requests like Cliff recommended over here. Currently i have tables for events, maps, worlds and WvW objectives, recipes and items are still WIP since these are huge databases :o

Let me know if you need this in a different format, e.g. XML, CSV or even Excel…

Happy coding!

(edited by smiley.1438)

Is this application in allowed by the TOS ?

in API Development

Posted by: smiley.1438

smiley.1438

All good!

(see my Overwolf app, which basically sums up your post)

(edited by smiley.1438)

Getting Guild Rank Icons?

in API Development

Posted by: smiley.1438

smiley.1438

No, these icons are not yet pat of the API. Let’s hope for the /v2/guilds API which is to be released soon™ along with OAuth2 support.
However, it’s possible to extract the files from the GW2.dat. Have a look at https://github.com/rhoot/Gw2Browser (grey zone, you have been warned).

Can't the find the right API for even timers.

in API Development

Posted by: smiley.1438

smiley.1438

The event timers are static now. The /v1/events.json API has been disabled back when the megaservers were introduced.

We can type /ip to get our instance of a map, would be nice if we could feed that to the events API and get something like the old one.

The event timers are static now.

This means there is no need at all for an endpoint. The event timers have been published in a blog post and are available on the wiki. Hardcode all the things!

Pirate weapons and API

in API Development

Posted by: smiley.1438

smiley.1438

Most of the karma items are still missing in the API – hope this is gonna be fixed soon™.

Exposing custom headers for CORS

in API Development

Posted by: smiley.1438

smiley.1438

(apparently the presence of the Authorization header prompts the library/browser to preflight the request, and I don’t know enough of CORS to say if this is correct or not)

Just to add: you are right here. If there’s a custom header set, a preflight request is being sent in order to determine if the main request is safe to send.

See https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS#Preflighted_requests

How frequently is it OK to access the API?

in API Development

Posted by: smiley.1438

smiley.1438

Items are added as soon they are discovered and like other APIs, items.json is updated in realtime, so you may want to check this frequently. However, renaming of items (especially translations) or other changes to them only happen during patches. A list of changed items during an update has been requested more than once, hope this is going to happen soon

Transparency!? It was here - now its gone!

in PvP

Posted by: smiley.1438

smiley.1438

Call me crazy, but I do believe some info about the next update, even if it’s just "hey, we’ll give you a potato in 4 weeks" would calm down the people impatience... such is the gw2 community hunger.

While we’d love to give you a time and date of when we’re sending out the potato, remember that during the development process we may discover that a baked potato would be even better. So instead of getting the potato of your dreams you end up with something completely unexpected.

It often happens that a mashed potato with gravy is even better still, unfortunately gravy requires more dev time. So we end up shipping a mashed potato without gravy to meet our promise of ship time or we push back the time and date of when we are shipping again and again. You get your mashed potato with gravy but it is delivered much later than it was expected.

Worst of all that is when we realize that potatoes are way too mainstream and that yams are where it’s at now. And I think we all know how reactions seem to go when we ship yams instead of potatoes.

So in a lot of cases the best we can do is tell you that we are still in the kitchen cooking things up, we’re reading your feedback, and that we’re excited to get the meal out to you soon™.

Sorry, but i can’t resist: https://twitter.com/CraigLuna/status/448299001410908161 *TOOT*

How frequently is it OK to access the API?

in API Development

Posted by: smiley.1438

smiley.1438

Each entry in my case contains the item ID, name, type, rarity and level.

In the UI the user selects a type filter and level/rarity if they desire, then the app queries the database for all matching, puts their names into a dynamic list and holds on to only the item_id.

What about storing the JSON in your database too, so you don’t need to request the api to get the data (and keep in mind that you need to request the api 4 times for an item if you need all languages…)
have a look at this:

http://gw2wbot.darthmaim.de/itemlist.php
http://gw2wbot.darthmaim.de/smiley/gw2itemsearch.html

(edited by smiley.1438)