Talk:Chat link format
Archive
WvW Objective Codes[edit]
I was working with the API recently and had to work out how the WvW chat codes are encoded. It's not hard but it wasn't on the wiki. An example: Y'lan Academy (Green BL tower) has a chat code of [&DGYAAABOBAAA]. From the API, the objectives ID is 1102-102. First byte is 0x0C as the wiki states, next four bytes are the last part of the objective ID (102, unique to the objective) as a little endian int. The three bytes after that are the first part of the objective ID (1102, map ID) again as a little endian int and finish it up with a null byte terminator and a Base64 encode. ZedTheYeti (talk) 04:10, 31 January 2016 (UTC)
Wardrobe and Outfit codes[edit]
So in this page, it seems to label outfits as a 0x0C codes, and wardrobe skins as 0x0B. However it seems like outfits are 0x0B and skins are 0x0A. Is this a typo on the page, or something that I just completely and totally got wrong? -Darqam 23:49, 15 November 2016 (UTC)
- Ishmael's edit to the game link widget back in may 2015 suggested 10 = 0x0A = skins, and 11 = 0x0B = outfits.
- The section at the top of this page agrees with that widget edit, however the pages linked from the bottom of this page doesn't seem to have been moved too. Good catch, but not something I want to fix tonight. -Chieftain Alex 00:26, 16 November 2016 (UTC)
- Ok, well when you are done not fixing this, I can try to clean-up the remnants. Since I was not mistaken, then I understand what is wrong and where. -Darqam 00:38, 16 November 2016 (UTC)
0x08 - User[edit]
Is this even a thing? I tried multiple entries with this header and they all came out as simple text, seemingly not recognized as a chat code by the game. If it is a thing, then it might be worth expanding on what it is, since "User" is not very descriptive... -Darqam 18:49, 17 November 2016 (UTC)
- they are, but the text parser doesn't expect them unless behind quote markup. the format is
0x08
16 byte account GUID, or zeros
null terminated wchar_t name
, eg.08 00000000 0000 0000 0000 000000000000 41004100410041004100410041004100 0000
converted into base64 should give you a AAAAAAAA in a chat bubble with the channel's colour that it in. 99.231.213.98 01:39, 26 December 2016 (UTC)
Question regarding chat code conversion[edit]
I don't know where else to ask this.
I need to know how it works to get the ID out of an chat code. I simply don't get it.
Conversion from chat code to hex-code is easy and matches the exampels in the article. But i don't understand how to get from hex-code to ID. Maybe I miss something. Could someone here explain it to me? --DarxMaster (talk) 21:04, 4 June 2017 (UTC)
- Use a calculator 185.189.14.230 21:21, 4 June 2017 (UTC)
Well I tried that of course. But I don't get the correct result. An example from the article:
- Weapon - Zojja's Claymore (Id: 46762 - Hex:
AA B6
)
If i give the AA B6
to the calculator I get 43702 insted of the ID above. --DarxMaster (talk) 07:12, 5 June 2017 (UTC)
- It's little endian so you have to swap the byte order. You would use
B6 AA
52.15.228.241 10:49, 5 June 2017 (UTC)
- It's little endian so you have to swap the byte order. You would use
Thank you! Now it works. --DarxMaster (talk) 11:14, 5 June 2017 (UTC)
Some of the example links in the article are wrong[edit]
There are links with the header byte conflicting to what they should be an example to:
[&B+cCAAA=]
, hex:07e7020000
(id: 743), Trait link[&B3MVAAA=]
, hex:0773150000
(id: 5491), Trait link[&B30VAAA=]
, hex:077d150000
(id: 5501), Trait link[&CgEAAAA=]
, hex:0a01000000
(id: 1), Wardrobe link[&CgIAAAA=]
, hex:0a02000000
(id: 2), Wardrobe link[&CgcAAAA=]
, hex:0a07000000
(id: 7), Wardrobe link[&CwQAAAA=]
, hex:0b04000000
(id: 4), Outfit link[&DAQAAAA=]
, hex:0c04000000
(id: 4), WwW objective link
I fixed them but can't edit the article, I tested them in-game and they are working, here they are:
Skills:
[&BucCAAA=]
– Aegis (Id: 743)[&BnMVAAA=]
– Fireball (Id: 5491)[&Bn0VAAA=]
– Meteor Shower (Id: 5501)
Recipes:
[&CQEAAAA=]
– Recipe: Soft Wood Plank (Id: 1)[&CQIAAAA=]
– Recipe: Ancient Wood Plank (Id: 2)[&CQcAAAA=]
– Recipe: Bolt of Cotton (Id: 7)
Wardrobe:
[&CgQAAAA=]
– Apprentice Coat (Id: 4)
Outfit:
[&CwQAAAA=]
– Witch's Outfit (Id: 4)
Sprsrpr (talk) 00:25, 16 June 2017 (UTC)
- Thanks for pointing this out. We didn't get around to fixing the examples after they removed the Player header. I've applied your suggested changes, and also removed the protection because I expect the spam to not be as unbearable nowadays. -Chieftain Alex 16:49, 16 June 2017 (UTC)
Changing the item's quantity in the link[edit]
If I have a generic item, for exemple Iron Ingot [&AgHjTAAA], which is the rule to change the single-quantity link to show another quantity? (27 Iron Ingots for exemple=[????????]) 79.56.68.128 23:29, 15 February 2018 (UTC)
- You need to decode the base64 encoded part:
AgHjTAAA
-->0201e34c0000
(note that the decoded data is binary, this is the hexadecimal representation of it) - the second octet (marked in red here) is the quantity, 27 would be 0x1b in hexadecimal so
021be34c0000
then base64 encode it back and add[&
and]
, the final result would be[&AhvjTAAA]
- Sprsrpr (talk) 15:09, 17 February 2018 (UTC)
- Thanks for explaining. (I hope you don't mind but I've tweaked the colour above to make it a bit more obvious) -Chieftain Alex 15:18, 17 February 2018 (UTC)
Sample decoding implementation[edit]
Here is a short decoding implementation example, complete for coin and item types:
var parseChatLink = function(chatLink) { const base64Code = chatLink.replace(/[\[&\]]/g, ""); const base64Decoded = atob(base64Code).split(""); const hexCodes = base64Decoded.map(c => "0x" + c.charCodeAt(0).toString(16)) const bytes = hexCodes.map(h => parseInt(h, 16)) const type = bytes[0]; const retval = { type }; switch (type) { case 0x01: var amount = bytes[1] << 0 | bytes[2] << 8 | bytes[3] << 16 retval.amount = amount; break; case 0x02: retval.count = bytes[1]; retval.id = bytes[2] << 0 | bytes[3] << 8 | bytes[4] << 16 const flag = bytes[5]; const hasSkin = (flag & 0x80) === 0x80; const hasUpg1 = (flag & 0x40) === 0x40; const hasUpg2 = (flag & 0x20) === 0x20; var iter = 6; if (hasSkin) { retval.skin = bytes[iter++] << 0 | bytes[iter++] << 8 | bytes[iter++] << 16 ++iter; } if (hasUpg1) { retval.upgrade1 = bytes[iter++] << 0 | bytes[iter++] << 8 | bytes[iter++] << 16 ++iter; } if (hasUpg2) { retval.upgrade2 = bytes[iter++] << 0 | bytes[iter++] << 8 | bytes[iter++] << 16 ++iter; } break; default: throw new Error("type not implemented: " + type); } return retval; } parseChatLink("[&AdsnAAA=]") // Object { type: 1, amount: 10203 } parseChatLink("AgGqtgBg/18AACdgAAA=") // Object { type: 2, count: 1, id: 46762, upgrade1: 24575, upgrade2: 24615 } parseChatLink("AgGqtgDgfQ4AAP9fAAAnYAAA") // Object { type: 2, count: 1, id: 46762, skin: 3709, upgrade1: 24575, upgrade2: 24615 }
Skill palette ids[edit]
Regarding this removal, I think these are worth recording somewhere. Retrieving the correct IDs from the API is not straightforward, particularly as at least one Palette ID I checked in the API (Elite Mortar Kit) is incorrect vs the decoded ingame skill template, and Revenant skill ids share the same palette ID, and the Blank skill slot id 0.
I have written a bit of JS to extract the info (User:Chieftain Alex/API javascripts#Skill palette ids), and used that to come up with the current version of User:Chieftain Alex/sandbox6. The palette ids don't seem to change often, so we could add them to skill infoboxes + have an automated SMW query - perhaps on a subpage? -Chieftain Alex 12:57, 29 January 2023 (UTC)
- Created Property:Has skill palette id. Populating with a bot. -Chieftain Alex 10:43, 4 February 2023 (UTC)
- Feel free to change it, it's only used on Elite Mortar Kit (where the ingame ping vs the api disagree). -Chieftain Alex 13:16, 4 February 2023 (UTC)
Coin links[edit]
Coin links seem to work in /me chat messages Darkskyz.5716 (talk) 21:05, 7 September 2024 (UTC)