Ruhrpottpatriot / GW2.NET

A user friendly wrapper around the official GW2 API
GNU General Public License v2.0
17 stars 17 forks source link

Invalid chat links #37

Closed sliekens closed 8 years ago

sliekens commented 8 years ago

Chat link converters were improved in version 1.4.0, but unfortunately the new converters use wrong header bytes for skills, traits, recipes, skins and outfits.

https://github.com/Ruhrpottpatriot/GW2.NET/blob/20adafec3d61bac8dc7d549a42e91e570d6e3f70/src/GW2NET.Core/ChatLinks/Interop/Header.cs

The Header enumeration must be changed to match the headers listed on the wiki: https://wiki.guildwars2.com/wiki/Chat_link_format#Header

sliekens commented 8 years ago

Actually it appears that the game client was changed to use different header bytes, causing our code to generate invalid chat links.

sliekens commented 8 years ago

As a temporary workaround, you can use these chat link classes instead of the outdated ones in the library. Create an instance and call ToString() to get the chat code.

class TmpSkillChatLink : ChatLink
{
    protected override int CopyTo(ChatLinkStruct value)
    {
        value.header = (Header)0x06;
        value.skill.skillId = SkillId;
        return 5;
    }

    public int SkillId { get; set; }
}

class TmpTraitChatLink : ChatLink
{
    protected override int CopyTo(ChatLinkStruct value)
    {
        value.header = (Header)0x07;
        value.trait.traitId = TraitId;
        return 5;
    }

    public int TraitId { get; set; }
}

class TmpRecipeChatLink : ChatLink
{
    protected override int CopyTo(ChatLinkStruct value)
    {
        value.header = (Header)0x09;
        value.recipe.recipeId = RecipeId;
        return 5;
    }

    public int RecipeId { get; set; }
}

class TmpSkinChatLink : ChatLink
{
    protected override int CopyTo(ChatLinkStruct value)
    {
        value.header = (Header)0x0A;
        value.skin.skinId = SkinId;
        return 5;
    }

    public int SkinId { get; set; }
}

class TmpOutfitChatLink : ChatLink
{
    protected override int CopyTo(ChatLinkStruct value)
    {
        value.header = (Header)0x0B;
        value.outfit.outfitId = OutfitId;
        return 5;
    }

    public int OutfitId { get; set; }
}