LoTROInterface

LoTROInterface (https://www.lotrointerface.com/forums/index.php)
-   General Authoring Discussion (L) (https://www.lotrointerface.com/forums/forumdisplay.php?f=22)
-   -   Item Control (https://www.lotrointerface.com/forums/showthread.php?t=2001)

Davinna 04-04-2013 03:30 PM

Item Control
 
I'm playing around with an idea of capturing the chat output for items looted and then displaying the item or a list in a window by item quality. You could choose to show only items above a certain quality and who received it. I don't think there's a plugin that does this?

I've got it so I can filter the text and capture the message with the looted item in it. I don't seem to understand how to get the "Item" singled out of the captured message to do any comparison or manipulation. Any pointers?

Garan 04-05-2013 07:29 AM

Loot messages contain an examination tooltip entry in the form:
<ExamineItemInstance:ItemInfo:LONGANDUGLYITEMIDCOD E>[Item Name]<\ExamineItemInstance>
where LONGANDUGLYITEMCODE is an encoded item id. I haven't bothered figuring out what part of the code is the actual item, and it may be that the "generic" item ID is not in the code, only the unique instance ID since if you examine several of the codes you will see that the code changes from the examine tooltip generated by dragging an item from the loot window, the tooltip from the loot message, the tooltip from dragging from your backpack or dragging from an equipped slot. Even dragging the same exact item from two different bag slots will generate a different code so it would take quite a few samples and a lot of time to try to figure out how to decode it. It should be eaiser to decode the loot versions since they don't appear to be dependant on the slot in which the item is placed, just the unique item/stack ID. FWIW, the stack quantity is also included in the code since the same stack in the same bag slot will generate a different examination iteminfo for different quantities.

If you convert the characters to Unicode hex codes and ignore the upper byte it becomes a bit easier to see the data they represent. For instance, the first 5 codes appear to represent a number "0100 0100 0100 0100 0136" would be hex 0000000036. The next 5 codes seem to always be the same, "0100 0100 0100 0178 019C" or hex 000000789c. After that comes the encoded iteminfo.

I'm not sure why Turbine chose to use such a cryptic code but it may have something to do with fear that people would misrepresent items in links in chat when advertising/selling items. Of course, that's a pretty silly reason for this since anyone doing that could be easily caught and banned using the server chat logs. It is more likely that they included all of the info they did so that the item can be more easily represented and encoded it to limit the size of the data sent to the server and back when the client resolves the tooltip - the client probably caches the tooltip info since it definately takes longer to display the tooltip the first time, especially for things like identified LIs.

If I find some time I may go back to playing with the IDs as it is an interesting puzzle but I've got more than enough things already vying for attention. Oh look! A shiny... *wanders off in pursuit of yet another distraction*

Davinna 04-05-2013 07:49 AM

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?

Garan 04-05-2013 09:29 AM

Quote:

Originally Posted by Davinna (Post 8569)
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.

Davinna 04-05-2013 09:45 AM

I understand. I wouldn't expect you to do it for me. Not sure I have the muster to take on such a task either. Again, Thanks for the info.


All times are GMT -5. The time now is 02:20 AM.

vBulletin® - Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
© MMOUI