Jump to content
  • Sign Up

finding correct wiki page via info gained from the API


GODh.3892

Recommended Posts

I am playing a bit with the gw2 API and i am building a tool that allows me to search for pshyical items (in my bank, bags, equipment, material storage, etc). The result also shows a link to the item on wikipedia. But that sometimes fails, because i am using the item's name that the API gives me. That often works well, but sometimes it does not...

 

Example: (name according to API) Cosmic Mining Tool --> replace spaces with underscores -> Cosmic_Mining_Tool --> wikipedia (english): https://wiki.guildwars2.com/wiki/Cosmic_Mining_Tool (correct)

 

But for some items, especially skins, this goes wrong:

 

Example: (name according to API) Exalted Shoulders --> replace spaces with underscores -> Exalted_Shoulders --> wikipedia (english): https://wiki.guildwars2.com/wiki/Exalted_Shoulders (fails)

 

The last example fails as the correct page for Exalted Shoulders is https://wiki.guildwars2.com/wiki/Exalted_Shoulders_Skin (_Skin added)

 

A more safe way to find an item is via searching via the gamelink (like [&AgGaXwEA]) but afaik you cant do that while combining it with https://wiki.guildwars2.com/wiki/, so https://wiki.guildwars2.com/wiki/[&AgGaXwEA] fails... :s

 

Anyone knows a good way to do this correctly?

 

Thanks in advance <3

Link to comment
Share on other sites

> @"GODh.3892" said:

> A more safe way to find an item is via searching via the gamelink (like [&AgGaXwEA]) but afaik you cant do that while combining it with https://wiki.guildwars2.com/wiki/, so https://wiki.guildwars2.com/wiki/[&AgGaXwEA] fails... :s

>

> Anyone knows a good way to do this correctly?

>

> Thanks in advance <3

 

Something like this:

https:/ /wiki.guildwars2.com/index.php?title=Special%3ASearch&search=%5B%26AgGaXwEA%5D&go=Go

Link to comment
Share on other sites

> @"GODh.3892" said:

> That seems to work, thank you <3

>

> This does not solve all my wiki problems as that gamelink is not always available (especially when item is transmuted and i want the link for the new skin), but at least its solves a part of my problems :3

 

I think this could help, but you need to do a bit of math to get skin link separately: https://wiki.guildwars2.com/wiki/Chat_link_format#Wardrobe_skins_and_upgrades

Link to comment
Share on other sites

> @"GODh.3892" said:

> Ok, i think i got it working (no guarantees, but so far, i dont see any wrong wiki pages anymore). Thanks for the help <3

 

Ok, glad it worked. Just for information, you can get chatlink from item/skin number from api. For example:

 

Skin number - 7490, in hex 1D42, it's a skin so first byte is 0x0A (Wardrobe link), so full hex string is 0A 42 1D 00 00, convert it to base64 - CkIdAAA=, chat link is [&CkIdAAA=]

Link to comment
Share on other sites

> @"WIR BRAUCHEN ONE EIGHTY.4257" said:

> Skin number - 7490, in hex 1D42, it's a skin so first byte is 0x0A (Wardrobe link), so full hex string is 0A 42 1D 00 00, convert it to base64 - CkIdAAA=, chat link is [&CkIdAAA=]

 

Ok, that sounds interesting, but i have little experience in that direction (C#). In my app i know its a skin and i know it's skin-id, but after that i kinda lost you :'(

Link to comment
Share on other sites

> @"GODh.3892" said:

> Ok, that sounds interesting, but i have little experience in that direction (C#). In my app i know its a skin and i know it's skin-id, but after that i kinda lost you :'(

 

I wrote some code in C#:

> int skin_id = 5583;

> skin_id <<= 8;

> skin_id |= 0X0A;

>

> byte[] bytes = BitConverter.GetBytes(skin_id);

>

> string chat_link;

>

> int addition = 0;

>

> if(skin_id > 0XFFFF)

> addition = 2;

> if(skin_id > 0XFF)

> addition = 1;

>

> byte[] newBytes = new byte[bytes.Length + addition];

> bytes.CopyTo(newBytes, 0);

> chat_link = Convert.ToBase64String(newBytes);

 

Tried it with online compiler and it's working.

Don't expect it to be perfect, I'm C++ programmer and have very little knowledge of C#.

Link to comment
Share on other sites

Thank you very much! This seems to work perfectly <3

 

Part of my log:

 

20:10:18: DEBUG created chatlink for item: 8319 name: 'Springer Kit Backpack' chatlink: [&Cn8gAAA=]

20:10:18: DEBUG created chatlink for item: 1253 name: 'Flamekissed Vest' chatlink: [&CuUEAAA=]

20:10:18: DEBUG created chatlink for item: 1255 name: 'Flamekissed Shoes' chatlink: [&CucEAAA=]

20:10:18: DEBUG created chatlink for item: 1257 name: 'Flamekissed Gloves' chatlink: [&CukEAAA=]

20:10:19: DEBUG created chatlink for item: 1258 name: 'Flamekissed Mask' chatlink: [&CuoEAAA=]

20:10:19: DEBUG created chatlink for item: 1254 name: 'Flamekissed Pants' chatlink: [&CuYEAAA=]

20:10:19: DEBUG created chatlink for item: 1256 name: 'Flamekissed Mantle' chatlink: [&CugEAAA=]

20:10:20: DEBUG created chatlink for item: 4666 name: 'Kraitkin' chatlink: [&CjoSAAA=]

 

I think i am decent with data, but this bit/byte stuff is a bit above my head. Your help is very appreciated :3

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...