As Khisanth said, the events are still going on, so by definition, they should be returned by the API.
Much of the concerns you’re raising, while valid, seem very application-specific problems, and not necessarily the fault of the API service.
That being said, I agree (but not necessarily advocating for change) that it would be nice if there were some grouping of the events aggregated within the API. The community provided dragon event IDs come to mind, but if there was an endpoint that returned event_group_ids for various collections (such as dragon event IDs, crown pavilion, labyrinthine cliffs, scarlet invasions, etc.), it could be something useful, perhaps.
Try Duo Mobile instead: http://guide.duosecurity.com/third-party-accounts
At this moment, there is no official trading-post API provide by ArenaNet (see the API documentation sticky’d at the top of this sub-forum for what is available).
The TP website, gw2spidy.com, might be a place to start looking for what you want. However, I don’t have the foggiest clue about Excel and its capabilities.
Greetings Stefan!
Can’t wait to see OAuth2 get rolled out; thank you for your ongoing work on it! And also, best of luck, Cliff! Thank you for all that you’ve done to get the APIs off the ground, as well as both your immediate and in-game responses.
Updated GW2Kit
GW2Kit on GitHub
Summary
GW2Kit now has a developer wiki page (hosted on GitHub), as well as separate repo for examples using the framework.
Changes
- GitHub wiki page
- Step-by-step guide for OS X apps
- GW2KitExamples Repo (more to come)
Attached is a screenshot of the Events demo from the examples repo.
end communication
(edited by Killer Rhino.6794)
Darkma,
Let’s talk!
Yeah. I think we’ve exhausted the majority of interesting things to do with the current APIs. I come back here twice daily looking for news of OAUTH enabled endpoints…that’s when things will get really going!
GW2Kit – Update (July, 22)
GW2Kit on GitHub
GW2Kit has received a much needed update. I was unable to work on it for the last month due to a major life event.
Separate resource daemons:
The original GW2 client interface, [GW2Client sharedClient], has been removed. Instead, Events, Items, WvW, Guilds, & Maps are now their own separate API client interfaces, referred to as daemons. This might not seem that important, but I’m really proud of this design decision and what it means for the framework’s future.
The daemons in this release are the minimum viable product with respect to their corresponding API endpoints (lots of opportunity to make them individually more sophisticated). Developers can utilize just the daemons their app needs, and expect new daemons as the GW2’s API feature set expands*.
Map Endpoints:
I added the map endpoints (finally):
- v1/continents.json,
- v1/maps.json,
- v1/map_floor.json
Note, I’ve purposefully let out map rendering for the time being, but this won’t always be the case. I plan to add map rendering as part of the framework around the time iOS 7 is released*.
Better cross-platform support
I’m getting much better at writing SDKs that target iOS & OS X simultaneously. To try out some example code, open GW2KitTests.xcodeproj and pick your platform of choice.
(*) “Is this being used?” – A survey:
I’m completely in the dark as to whether GW2Kit has been used by anyone besides myself. I’ve seen a couple of iOS projects posted here, and I’m curious if any of them are using GW2Kit.
It would be really awesome to hear from devs that are making awesome things with GW2Kit (if any)! Feedback is very much welcomed. If there are bugs – etc., I encourage you to open issues on project’s GitHub page.
(edited by Killer Rhino.6794)
Having trouble getting this working in OS X. Cliff, can you verify that the Mac client is writing values to the shared memory object just as the PC version does during its update loop?
If I have Mumble open on my Mac, I’m able to at least get an empty linker object. I didn’t think having Mumble was necessary, but either way, the linker object isn’t being updated with any game values.
Where is the memory mapped file GW2 is writing to?
Afaik it is just a shared memory object.
In that case, somewhere deep within the RAM :PNative windows code should be able open it via
HANDLE hMapObject = OpenFileMappingW(FILE_MAP_ALL_ACCESS, FALSE, L"MumbleLink");
I see that now. It’s right there in the link Cliff pasted.
bad killerrhino
Where is the memory mapped file GW2 is writing to?
The colors you were seeing invalid saturation values for were colors that had a different base_rgb than 128,26,26 (skin, hair, eye, etc. colors).
I just updated the API to show the base_rgb of colors. I also removed the non-dye colors to make it more uniform and reduce confusion (multiple “black” dyes, etc.).
I also created a javascript version of our internal color shifting algorithm here: http://jsfiddle.net/cliff/jQ8ga/ . This example code uses the sylvester javascript matrix library for math.
The way it works is pretty different than the processes previously described — it calculates a transformation matrix which is then applied to the color in one pass.
I also added pre-calculated RGB values to the color API for those who don’t need to deal with HSL transformations and just want an RGB value. It can also be used to test your color shifting algorithm against ours for correctness.
Thanks, Cliff. I updated my library with the new response fields and pushed them up. I’ll update the How-To.
Yeah, some official confirmation would be nice at this point.
From the looks of Rhino’s code, and the documentation he quoted, it looks like iOS handles all of these corrections internally and silently. I’m going to go with correcting S/L before the final RGB conversion.
Not just iOS, the color functions are defined universally. I would check some source material out on the net if you need more affirmative confirmation. Regardless, you shouldn’t need to change any of the values returned by the APis
Edit: take a look again at the detailed example I posted a few responses up.
(edited by Killer Rhino.6794)
GW2Kit is Feature Complete
GW2Kit on GitHub
The SDK has been updated with the past week’s API changes.
Updated with:
- guild_details.json
- colors.json
- build.json
- recipe_details.json (Updated)
- wvw/matches.json (Updated)
Already Had:
- items.json
- item_details.json
- events.json
- event_names.json
- map_names.json
- world_names.json
- wvw/matches.json
- wvw/match_details.json
- wvw/objective_names.json
- recipes.json
- recipe_details.json
Quick Note: The iOS Demo runs the same color demo I’ve been exhibiting in other threads. However, the OS X Demo is not working, currently. I’ll get that fixed as soon as possible.
It still seems weird to me to “clamp” results to a given range “just because”, but I have very little experience with colorspace transforms like this.
So it’s perfectly alright to correct the result of a transformation (like applying contrast to RGB or a saturation-shift to HSL) if said result is outside the allowed range? If G < 0, just kick it up to 0? If S > 1, just smack it back down to 1?
Assuming “0.0 is 0” & “1.0 is 255”, an excerpt from Apple’s official iOS color documentation reads:
Discussion
Values below 0.0 are interpreted as 0.0, and values above 1.0 are interpreted as 1.0.
This is a restriction for any color library. There’s no way to represent an RGB color outside the range of 0 to 255. It’s not that strange.
I get the same colors that are already visible, because Opera will silently clamp negative or excessive RGB values to [0..255], but is this really the way to go?
Sure. The easiest way to know if you’re doing it right: Does #947 White result in R:255 G:255 B:255?
I’m still unsure if these are right, but: https://chillerlan.net/gw2color.php
Nailed it!
Really? Hot Purple, #526
-> rgb(308,-11,308)Same problem as Ish mentioned above, even with clamping, the HSL shift will create values outside of HSL, and subsequently RGB.
Have you tried carrying this through the whole algorithm? What do you get?
I’m still unsure if these are right, but: https://chillerlan.net/gw2color.php
Nailed it!
Edit: added the link to the How-To guide for reference
(edited by Killer Rhino.6794)
Rhino, basically what you’re saying is that I should “correct” any negative RGB value to 0 before converting to HSL? Just want clear confirmation of this before I go put it in my code.
Yes, you should clamp RGB values to the range of 0 – 255. What language are you writing in, btw?
There are eight different blacks and other duplicated colors in the data.
How can I figure out which colors are used in the game?
Copied my response from another thread
I observed that most (perhaps all) colors that have cloth, leather and metal material values represent dyes. For instance, there are many “Black” colors, but only one “Abyss” color. [The Abyss has cloth, leather and metal materials defined].
Furthermore, only one of the “Black” colors has material values for cloth, leather, and metal. I suspect that is our “Black” dye.
The rest are colors for various other things, like skin, and tattoo colors (to name a few). I agree, it might be helpful to add an intent field for the purpose of the color in game.
What are you normalizing? The RGB input? The calculation results? And how are you doing the normalization considering the fact that RGB is only defined on positive values.
Converting RGB 90, -12, -12 results in HSL 1 / 1.30 / 0.15 (rounded) for me.
Look here: http://www.workwithcolor.com/color-converter-01.htm
Notice that
R:90
G:0
B:0
(as you pointed out, -12 clamps to 0 in RGB)
converts to
H:360 deg (0 deg & 360 deg are the same)
S:100%
L:18%
If we normalize the HSL values to be within 0 – 1:
H: 1 (from 360 deg / 360 deg)
S: 1 (from 100% / 100%)
L: 0.18 (from 18%)
Now look at the values in my example:
Now convert RGB to HSL (The library I use normalizes the values between 0 – 1)
R:90 -> H:1 (or 360 deg, if you so prefer)
G:-12 -> S:1 (or 100%, if you so prefer)
B:-12 -> L:0.176471
They’re pretty close. Did that answer your question?
Dr Ishmael, Let’s take a look at an example:
name: "Midnight Fire"
cloth: {
brightness: -38
contrast: 1
hue: 25
saturation: 0.273438
lightness: 1.01563
}
We start with our baseColor: (R:128, G:26, B:26).
Dealing with just “cloth”, for now, apply the brightness:
(128-38, 26-38, 26-38) = (90, -12, -12).
Now apply the contrast:
(90 – 128) * 1 + 128 = 90
(-12 – 128) * 1 + 128 = -12
(-12 – 128) * 1 + 128 = -12
Now convert RGB to HSL
(Not shown: I will normalize the RGB values between 0 – 1. Also, the conversion function I use will output HSL normalized values between 0 – 1)
R:90 -> H:1 (or 360 deg, if you so prefer)
G:-12 -> S:1 (or 100%, if you so prefer)
B:-12 -> L:0.176471 (or 17.6471%, if you so prefer)
Apply the HSL shifts from the response with the “RGB converted-to- HSL” values:
Hue = 1 * (25 / 360)
Saturation = 1 * 0.273438
Lightness = 0.176471 * 1.01563
So at this point the HSL values I have are:
hsl_Hue 0.0694444
hsl_Sat 0.273438
hsl_Light 0.179229
Finally converting back to RGB should produce:
R:0.228237
G:0.171061
B:0.130221
(edited by Killer Rhino.6794)
Saturation & Lightness values are ranged between 0 – 2. A value of 1 means “no change”.
So sorry for the confusion, but the feedback is super helpful.
Edit: I’ve updated the guide to be clearer.
(edited by Killer Rhino.6794)
Ah, yes. Cliff even specifically pointed that out to me in our conversations. I’ll update it again. Thanks, smiley!
Thanks!
I used it to create simple color sheer, here is code:
https://code.google.com/p/gw2api/source/browse/trunk/src/cz/zweistein/gw2/app/color/ColorSheet.java
And here is result:
https://gw2api.googlecode.com/svn/trunk/colorsheet.html
(you might want to save it as html file on local drive and then open in broswer)
Zwei, in your color shift code, try changing:
hsl0 = (float) (hsl0 * 360 + color.getHue()) / 360;
to:
hsl0 = (float) (color.getHue() / 360);
I took a screenshot of your output and mine. Notice the “Celestial” and “Starry Night”, in particular. The colors on the right should be what to expect.
(edited by Killer Rhino.6794)
Thats where the error in my example is. I assumed that the S/L values are already normalized to 0-1, i didn’t check that before. (Hot pink has already a l>1, so i should have noticed, but it was like 4am when i wrote that…
)
Darn it, I’m not doing a very good job explaining this (and it’s 8AM, what’s my excuse
I had it wrong when I said S & L are between 0 – 1. And for that matter, brightness is not a value between 0 – 255. Use the values that come in S & L as-is in our HSL shifts. I’ll correct the guide now.
(edited by Killer Rhino.6794)
Not sure how much help this is, but:
I normalize my base color’s values, and my hue value, between 0 – 1. Part of the reason is that the iOS libraries expect that range. The base color can be represented in HSL as either (0 deg, 66%, 30%), or (360 deg, 66%, 30%). I rely on the later, so that when it comes to my hue shift calculation becomes (360 deg * hue / 360), or rather just hue.
Also, I observed that most (perhaps all) colors that have cloth, leather and metal material values represent dyes. For instance, there are many “Black” colors, but only one “Abyss” color. Furthermore, only one of the “Black” colors has material values for cloth, leather, and metal. I suspect that is our “Black” dye.
(edited by Killer Rhino.6794)
Ok, so let’s see if I got it.
I’m using Hot Pink on cloth.
“cloth”: {
“brightness”: 14,
“contrast”: 1.21094,
“hue”: 340,
“saturation”: 0.820313,
“lightness”: 1.44531
},
- Start with: RGB 128,26,26
- Add Brightness: RGB 142,40,40
- Factor in contrast: RGB 144,21,21
- Convert to HSL: 0° 75% 32%
- Apply Shifts: 0°+320°=320°, 0.75*0.82 = 0.615, 0.32*1.44 = 0.46 -> HSL 320° 61.5% 46%
- Convert back to RGB: 189,45,141
- Hex = #BD2D8D
Any obvious mistakes?
Nice, Think. I just posted a full thread on how to use the Color API, copying your example as well.
Hey all,
I hope the [How To] tag can become a developer-helping-developer thread which can show examples on certain APIs for the betterment of the dev community.
The inaugural thread will be on the Color API (since there’s been a lot of confusion with it), inspired by Cliff’s personal assistance in helping me get it working.
The API
Colors API is here: https://api.guildwars2.com/v1/colors.json
It has a root key of “colors”, and contained within that are keys of color IDs. Plucking out a single color dictionary in the color response looks like this:
691: {
name: "Spring Dew"
cloth: {
brightness: 27
contrast: 1.25
hue: 190
saturation: 0.3125
lightness: 0.644531
}
leather: {
brightness: 27
contrast: 1.28906
hue: 190
saturation: 0.253906
lightness: 0.664063
}
metal: {
brightness: 27
contrast: 1.28906
hue: 190
saturation: 0.234375
lightness: 0.664063
}
}
Materials
Default, cloth, leather, and metal are materials. The dye picker in the game uses the cloth material, so if you plan on doing something similar, use the cloth material (we’ll get to how to produce colors from these values in a second).
Color Components
Each material contains the following: brightness, contrast, hue, saturation, & lightness
brightness:
- A negative or positive number (range unknown)
contrast:
- A value between 0 – 2
hue:
- A value between 0 – 360
saturation:
- A value between 0 – 2
- A value of 1.0 will mean “no change”
lightness:
- A value between 0 – 2
- A value of 1.0 will mean “no change”
The purpose of these components is to shift a reference (base) color. What does that mean? Starting with the base color, we’re going to use these values to perform calculations that will get us the actual color we want.
Base Color
The base color will start in the RGB colorspace. In whatever language, framework, or library you work in, get a color object in the RGB colorspace that has the values:
R:128, G:26, B:26.
The Color Algorithm
I just updated the API to show the base_rgb of colors. I also removed the non-dye colors to make it more uniform and reduce confusion (multiple “black” dyes, etc.).
I also created a javascript version of our internal color shifting algorithm here: http://jsfiddle.net/cliff/jQ8ga/ . This example code uses the sylvester javascript matrix library for math.
The way it works is pretty different than the processes previously described — it calculates a transformation matrix which is then applied to the color in one pass.
I also added pre-calculated RGB values to the color API for those who don’t need to deal with HSL transformations and just want an RGB value. It can also be used to test your color shifting algorithm against ours for correctness.
smiley.1438 has a site with the colors shown correctly: https://chillerlan.net/gw2color.php
(edited by Killer Rhino.6794)
Looks like the most recent API changes have gotten me a lot closer. Thanks for all the effort, Cliff.
Thanks for the update, Cliff.
So, for the first thing, I’m assuming that all values, except for hue, is within a range between 0-255 (even though the prevalence of 128 throughout suggests that it might be 1-256).
Second, I’m still getting weird results for many colors, but I suspect it still might be my math.
I’ve been using a demo I made to try to work through all of this. The band of colors represents the default, cloth, leather, and metal colors, respectively.
Cliff,
We’re getting closer. Thanks for the names; however, some values are still not consistent with what to expect.
For instance, Abyss has values greater than 255
473: {
name: "Abyss"
-cloth: {
brightness: "110"
contrast: "128"
hue: "275"
saturation: "3"
lightness: "140"
}
}
Hey Cliff,
I thought the colors might’ve represented a HSB color with normalized values between 0.0 -> 1.0, but no. Some brightness values are less than 0.0; some hue values are greater than 1.0.
Question #1: How should we be interpreting the color numbers (i.e., hue might be a value in degrees out of 360?)
Question #2: This could be outside the scope of the API, but in regards the “lightness” and “contrast” values, I found this page describing a calculation with how these two values might be used. Is this what you meant by color shifting in the API docs?
Thanks
Edit: I really, really tried to find this all out on the web, but the inconsistency with the number just didn’t make sense. thanks for any info you can provide.
(edited by Killer Rhino.6794)
Keep it up, Pigvomit. I can’t wait to see how this turns out.
Not an immediate concern, but having a bestiary API would be interesting, no?
Yeah, I noticed that, too. Guessing something affected the APIs as part of the update. Most event data seems to have returned by now.
PS: I also noticed that only a portion of the map names were being returned at the time the missing events were happening. My guess is it wasn’t a coincidence.
Updated GW2Kit
GW2Kit on GitHub
Changes:
- Added ability to pull item prices from gw2spidy.com APIs
- Fixes all goofy issues when linking GW2 in iOS or OS X
Here’s an example:
[Spidy itemDetailForID:@"12345"
completion:^(NSError *error, SPYItem *item) {
printf("%s\n", item.description.UTF8String);
}];
(edited by Killer Rhino.6794)
I tried following the instructions you added but I’m still nowhere. I can’t import <GW2kit/GW2kit.h>. If I copy one of the test app’s settings it works.
nvm changed some files in the Header Search path and it worked.
Awesome! Mind if I asked what you changed?
Updated GW2Kit
GW2Kit on GitHub
Thanks to Taleria, and anyone else that downloaded it, for testing it out.
Changes:
- Instructions on adding GW2Kit to a new or existing iOS projects
Great stuff, Parthis. This is a really interesting design, too.
This is so cool!
Just what I was looking for, thanks!
Cliff, sounds like there will be some really neat things to look forward to in the long term. Thanks for the heads up!
zwei++, thanks!
Updated GW2Kit
GW2Kit on GitHub
I’ve updated the SDK with very basic app examples for iOS & OS X.
Changes include:
- Inline documentation for each framework call
- Basic app for iOS (pulls events for Wayfarer Foothills on Maguuma)
- Basic app for OS X (same as iOS, but less UI)
- Examples projects linking frameworks for both iOS & OS X
- Reduced code complexity with the GW2ResourceName class
- Network calls happen asynchronously now
- Temporarily disabled core unit tests
I mostly want to continue focusing on improving the code base, providing sample apps, and writing good documentation, too. However, if you new to Cocoa development (I mean really new), Apple has excellent documentation to get you started.
More to come.
end communication
In regards to the ‘completionBlock’ vs. ‘completionHandler’ thing goes, I think it’s testament that two respected ObjC devs have commented with two different conventions. In fact, I’ve seen all three (completion, completionBlock, completionHandler); Apple’s own frameworks uses all three interchangeably.
If it becomes a big problem for people, I can change it.
Indeed, Apple themselves use all three and there is no standard, just a ton of personal preferences. My preference is the completionBlock naming too, simply because it infers the type/interface without the need to understand the signature of the argument. I know from the highest level that i’ll need to provide a block… and ‘handler’ is such an unfocused term; I’ve seen people name protocols as Handlers instead of Delegates even though they’re using delegation, for example.
But, it’s hardly code-breaking. Author’s choice, surely?
Ha, make no mistake: I love discussions. Let me know if there’s anything else you see, or better yet, fork it on github and send me pull requests (probably best to give me at least one more day for that, though.