Thread: Item Control
View Single Post
  #4  
Unread 04-05-2013, 09:29 AM
Garan's Avatar
Garan Garan is offline
The Undying
Interface Author - Click to view interfaces
 
Join Date: Oct 2010
Posts: 341
Quote:
Originally Posted by Davinna
Thanks Garan.

Let's say I manage to get just the <ExamineItemInstance:ItemInfo:LONGANDUGLYITEMIDCOD E>[Item Name]<\ExamineItemInstance> separated from the message. Would it be possible to determine item quality from that?
No idea at this time. As I mentioned above, it's a really ugly encoded value so determining what any part of it represents is a challenge. It is unlikely that the code directly includes anything such as the item quality. Most likely you would need to hope that one of the generic item IDs is in the code which you could then use to look up a lua iteminfo object and get the quality from there. As I stated above, some form of itemID, the quantity and the location that it is currently stored in are all part of the code and there may be other info in there as well. With enough samples with limited differences between samples it should be possible to determine how each value affects the encoded value and then slowly pick the code apart and create a formula to decode it (or even encode one from scratch). Unfortunately, while I enjoy such puzzles, it is a very time consuming process and I just don't have time available for it right now.

EDIT: If you choose to tackle this yourself, then I would first recommend writing a small plugin to capture examination tooltips, strip out the code, convert it to hexcodes and then display those in a control that allows copying and pasting them to notepad so that you can more easily explore them.
The code below will generate a hex code for a UTF-8 encoded string:
Code:
function gethexcode(tmp)
local hexcode=""
for index=1,string.len(tmp) do
if hexcode=="" then
hexcode=string.format("%x",string.byte(string.sub(tmp,index,index+1)))
else
hexcode=hexcode.." "..string.format("%x",string.byte(string.sub(tmp,index,index+1)))
end
end
return hexcode
end
Unfortunately, it may be that the string is supposed to be decoded as Unicode since after a bit of examination that seems to yield more obvious patterns.

Last edited by Garan : 04-05-2013 at 10:14 AM.
Reply With Quote