Showing Posts For cvpcs.5914:

How should we handle maps that overlap

in API Development

Posted by: cvpcs.5914

cvpcs.5914

Hello, I’m not sure if this has been addressed before but I wasn’t able to get the forum search to work.

I have been investigating an issue I have with my mapping program that uses the coordinates from v2/continents to display a website map. Basically, to reduce clutter I only display map data (POIs, Tasks, etc) if the center of the viewport is hovered over a map (determined by looking at the center of the viewport and comparing it to the values in continent_rect across all maps).

This works well except with Silverwastes. Whenever I hover over Silverwastes the Dry Top map data displays.

I investigated the data and it appears that the problem is that continent_rect for dry top is [(3840, 14592), (5888, 17152)], while silverwastes is [(3840, 14208), (5888, 15744)]. As you can see, dry top’s top-left Y value 14592 is less than silverwaste’s bottom-right Y value 15744, effectively overlapping the dry top rect and the silverwastes rect. Since I was short-circuiting my map-find algorithm once one was a map was found, dry top was always given priority because its map id is lower than silverwastes and the for loop was iterating over an ordered array of maps by map ids.

So my question is how should this situation be handled client-side? I know that the X/Z translation depends on map_rect + continent_rect, so making the continent rects not overlap is probably a non-trivial affair from a game perspective. I was able to work around it by simply reversing my search order, but can we always assume that higher map ids should always be overlayed on top of maps with lower ids?

Thanks!

House of Caithe trophy bug

in Bugs: Game, Forum, Website

Posted by: cvpcs.5914

cvpcs.5914

Yep, I just noticed this too. Reported a bug. Noticed if you take the item out of your inventory and then go back you can’t get it again, so for now I’m holding onto it in case it might be important, but hopefully it’s nothing I stumbled upon that will cause issues later. :/

Back pieces disappear when sheathing shields?

in Bugs: Game, Forum, Website

Posted by: cvpcs.5914

cvpcs.5914

Hey all,

I just finished crafting the Dynamic Tempered Spinal Blades for my Pistol/Shield engineer. First back piece I’d put on her and was surprised to find that apparently my back piece is hidden entirely when my shield is sheathed? I expected it to clip through or something, but it’s kind of a bummer that the back piece that I worked for is hidden unless I’m constantly unsheathing my weapons or change my play style.

I was just wondering if this is a known bug or considered a bug at all. If it is luckily I can infuse the backpiece to account bound it again to put it somewhere it’ll be seen, but seriously. Bummer.

Thanks

The response serializations are insane

in API Development

Posted by: cvpcs.5914

cvpcs.5914

@StevenL

I appreciate the offer but at the moment I’m too busy to do much contributing anywhere (the code above I wrote ages ago when the APIs first came out, I haven’t really touched it since).

That said, I’ll keep it in mind if I ever decide to delve deeper into this stuff. Perhaps if ArenaNet ever gets their OAuth and related APIs published.

The response serializations are insane

in API Development

Posted by: cvpcs.5914

cvpcs.5914

It doesn’t seem too hacky to me to handle this (at least in C#). I personally use the RestSharp library to handle REST requests and the corresponding JSON deserialization. From there I just need to pass in the type that I’m deserializing to for REST to do its thing. For example, I have a basic Request class that looks like so:


using System;
using System.Collections.Generic;

using RestSharp;

namespace GuildWars2.ArenaNet.API
{
    public abstract partial class Request<T>
        where T : class, new()
    {
        public static int Timeout = 10000;
        public static readonly string URL = "https://api.guildwars2.com";
        public static readonly string Version = "v1";

        protected abstract string APIPath { get; }

        protected virtual Dictionary<string, string> APIParameters
        {
            get { return new Dictionary<string, string>(); }
        }

        protected virtual Method APIMethod
        {
            get { return Method.GET; }
        }

        public T Execute()
        {
            RestClient client = new RestClient();
            client.BaseUrl = URL;
            client.Timeout = Timeout;

            RestRequest request = new RestRequest();
            request.Method = APIMethod;
            request.Resource = APIPath;

            foreach (KeyValuePair<string, string> parameter in APIParameters)
            {
                request.AddParameter(parameter.Key, parameter.Value);
            }

            IRestResponse<T> response = client.Execute<T>(request);

            if (response.StatusCode == System.Net.HttpStatusCode.OK)
                return response.Data;
            else
                return null;
        }
    }
}

I then have a ContinentRequest file that extends that and looks like so:


using System;
using System.Collections.Generic;

using GuildWars2.ArenaNet.Model;

namespace GuildWars2.ArenaNet.API
{
    public class ContinentsRequest : TranslatableRequest<ContinentsResponse>
    {
        protected override string APIPath
        {
            get { return "/" + Version + "/continents.json"; }
        }

        public ContinentsRequest(LanguageCode lang = LanguageCode.EN)
            : base(lang)
        { }
    }
}

So then RestSharp expects to be deserializing a type of ContinentResponse, which looks like so:


using System;
using System.Collections.Generic;

using GuildWars2.ArenaNet.Model;

namespace GuildWars2.ArenaNet.API
{
    public class ContinentsResponse
    {
        public Dictionary<string, Continent> Continents { get; set; }
    }
}

Thus RestSharp will deserialize the response as a single item which is a dictionary of Continents:


using System;
using System.Collections.Generic;

namespace GuildWars2.ArenaNet.Model
{
    public class Continent
    {
        public string Name { get; set; }

        public List<double> ContinentDims { get; set; }

        public int MinZoom { get; set; }

        public int MaxZoom { get; set; }

        public List<int> Floors { get; set; }
    }
}

So then to cycle through my list of Continents, I just need to call the following:


ContinentResponse response = new ContinentRequest().Execute();

foreach (KeyValuePair<string, Continent> kvp in response.Continents)
{
    string cid = kvp.Key;
    Continent c = kvp.Value;

    ...
}

I personally like having it set up this way, as all of my requests and responses have concrete types that I can modify and add extra logic to if I wish. As you can see, the fact that they nest their response dictionary inside of the Continents variable is a non-issue. If they ever got rid of that, I could just change my ContinentsResponse class to not have any variables and simply extend the Dictionary<string, Continent> class and update any references I’m using.

You can argue about refactoring code until you’re blue in the face and there will always be other people who argue that it needs to be refactored again. Your complaint was specifically around the difficulty of deserializing the response due to the desired content being nested inside of a dictionary variable in the response object, instead of the response object simply being the dictionary variable (or a list).

It sounds more like your deserializer doesn’t handle nested objects very well, otherwise it would be a non-issue. This is very much a solved problem at this point and there should be existing libraries that can handle this quite elegantly for you in Java.

Can't filter achievement leaderboard by guild

in Forum and Website Bugs

Posted by: cvpcs.5914

cvpcs.5914

When logged in to the achievement leaderboards page, there is an option to filter by guilds you are in. This mostly works, but when I try to view the leaderboard for my guild, “Guíld of Dívíne Soldíers”, it never actually loads.

I have suspicions that something may be going amiss with the (í) characters in the guild name, but I’m not sure. Regardless, I was using that form to help manage an out-of-game list of members of the guild, and not having it available is quite troublesome.

If it helps, it hasn’t been working for some time now (not sure how long, maybe 2 months), though it was working at some time ages ago.

Where in the world is Scarlet Briar

in Players Helping Players

Posted by: cvpcs.5914

cvpcs.5914

If you look in the API for events named “Scarlet’s Minions Invade!”, you’ll find that there are 13 of them with that name. These are the global events for the minion invasion events, one for each of the 13 maps she can invade in.

All you need to do is wait for one of those events to come up, and then use the API to track what map it’s in and you know that Scarlet is invading in that map.

There are also tons of sub-events related to the clockwork, aetherblade, and molten alliance events for each map, as well as 2 events per map related to defeating scarlet herself. One of these defeat events is the fake that pops throughout the invasion, the other is the real one. You’d want to track the real one.

Using these it would probably be possible to track which phase an invasion is in using the following algorithm (I haven’t tried it myself yet):

phase 0:
    continually check for scarlet is invading! event
    if it's up find what map its in and goto phase 1
phase 1:
    continually check if any aetherblades or motlen alliance events are up
    if one is, log which type and go to phase 2
phase 2:
    continually check if the other between molten or aether events are up
    if one is, set to phase 3
phase 3:
    check if the real defeat scarlet event is up, if it is move to phase 4
if at any time the invasion event disappears then return to phase 0

Using api on an excel spreadsheet?

in API Development

Posted by: cvpcs.5914

cvpcs.5914

If you’re using a newer version of Excel you can accomplish this with the GW2Spidy API combined with the WEBSERVICE functions. About 6 months ago I submitted a series of patches to provide XML API support specifically so Excel could work with spidy.

Usually what I do is have a hidden column for the item IDs, a column for the XML to download into, and then filter it from there into the various fields. For example

  1. A1 is my ID field for Mithril Ore, it will contain
    19700
  2. B1 is my data field, so it will contain
    =WEBSERVICE(CONCATENATE("http://www.gw2spidy.com/api/v0.9/xml/item/", A1,
        "?excel_filterxml_fix=1"))
  3. C1 is my value field where I want to place the current buy price, so it will contain
    =FILTERXML(B1, "/response/result/max_offer_unit_price")

You’ll notice that I append ?excel_filterxml_fix=1 to the end of my API request. This solves a very specific issue with Excel, where 4 digit numbers between 1900 and 9999 that are returned are interpreted as years, and the value displayed in the cell becomes the number of days since January 1st, 1900. This is a known bug in Excel. This addition to the end of the request URL triggers a workaround, which can be seen here

Cross-domain support for silverlight

in API Development

Posted by: cvpcs.5914

cvpcs.5914

That sounds fantastic! I’m not sure if the file would need to be under tiles.guildwars2.com and render.guildwars2.com domains for those services as well, but I would guess it would for those to be accessible from Silverlight/Flash.

If you need anything from me let me know, and I’ll be happy to test and provide feedback on whether everything is working on my end.

Cross-domain support for silverlight

in API Development

Posted by: cvpcs.5914

cvpcs.5914

I was working on a standalone mapping application and recently ported it to Silverlight for online embedding goodness only to discover that it refuses to access your APIs due to cross-domain security concerns.

It appears that to get it to work you have to place some sort of crossdomain.xml file at the api.guildwars2.com webroot. It appears to be something that flash uses (used to use?) as well.

I was wondering if it would be possible to add this.

MSDN crossdomain.xml Info
Adobe crossdomain.xml Info

Specify multiple of a parameter?

in API Development

Posted by: cvpcs.5914

cvpcs.5914

I’m making the assumption that their various IDs are indexed in a database somewhere, and that the data being returned is essentially the result of a query to that database. If that is the case, then adding multiple keys to the where clause of such a search is trivial and should cause a negligible performance hit.

This is of course my assumption. There may be more processing involved and that might be an issue.

I interpreted Cliff’s response as just that the current APIs don’t support it and that they are fine with you pulling down mass amounts of data you’re going to throw away, but also that if we would prefer to have more filtering support server side, to let him know (and then a smiley face).

Either way, I see several use-cases where multiple filtering would be useful and was just posting a suggestion for efficiency’s sake. 1.) and 3.) involve a ton of data that will be thrown away client side, and 3.) involves excessive server requests. It would be nice to just be able to make 1 request to their server and get only the data needed.

Specify multiple of a parameter?

in API Development

Posted by: cvpcs.5914

cvpcs.5914

I would love to see the ability to filter multiple items, specifically in the event API by event_id.

My use case is as such: I am tracking several meta-events, and as such am looking for information on every event in those meta-events at the same time. My options are:

1.) Pull all events and filter client-side (quite a bit of processing)
2.) Pull single events, all at once (60+ requests to arenanet simultaneously)
3.) Pull events by map (combo of the previous)

It would be nice to just let the server filter, since I’m assuming it’s using a DB backend with indexing so filtering is much easier on your end.

Disconnected at the final phase! [Merged]

in The Lost Shores

Posted by: cvpcs.5914

cvpcs.5914

I am thoroughly displeased at the moment with the 5-or-so-minute despawn on the quest chest. I was here for the entire 2.5 hours of the event on my overflow, dealt with the lag, everything. I actually was trying to hold off leaving even though I had a flight to catch.

Finally I had to leave so I tethered my laptop to my phone while a friend drove me to the airport. When I logged back in the event was over, and I saw a chest but I had to run to it from where I had left myself. By the time I got there the chest was gone.

This means that I spent 2.5 hours of hard time and effort, as well as potential risk of missing my flight, all for nothing. No quest completion XP/Karma rewards, no chest rewards. All I walked away with were my massive armor repair fees.

ArenaNet tracks your progress during a quest. That’s how they trigger your Gold/Silver/Bronze rating. For a huge 1-time event like this they should use that data to determine who was in the event, and then have the chest stay for those people for an extended period. Otherwise all this told me was that, for future events, the only important thing is being there for the last 5-10 minutes.

Issues with the guild system: please post here [MERGED]

in Bugs: Game, Forum, Website

Posted by: cvpcs.5914

cvpcs.5914

After the most recent update a few moments ago I can’t access my guild chat. When I type in the Guild channel it says “You are not in a Guild”. However, I can see myself as “online” on my Guilds roster. It’s on all characters accross my account.

Same thing happened to me. When I relog’d last night after the patch it said I wasn’t in a guild when I tried to guild chat. When I opened the guild window it said I wasn’t in one as well. When I went to character select however it said I was.

Relog’d in again immediately and I was able to access my guild window and queue features as a guild leader, but have yet to be able to see or use /guild chat.

Edit:
Server: Gate of Madness
Guild: Syntax Error
Leader: me

Post here if you have BEAT the Tower!

in Halloween Event

Posted by: cvpcs.5914

cvpcs.5914

Sylvari Elementalist
No speed boost

Beat it after about 1 hr 45 min or so. It was incredibly frustrating but I liked the challenge of it. I’ve done it about 5-10 times now to get the various chests strewn about. Very enjoyable. Gets my heart racing and palms sweating every time! :D