cursey / kanan-new

A reimagining of Kanan for Mabinogi written in C++
The Unlicense
147 stars 69 forks source link

[IDEA] Make unpickupable items name red #87

Open LoneDev6 opened 5 years ago

LoneDev6 commented 5 years ago

It would be REALLY nice to have an option that sets item name color to red of dropped items that can't be picked up

Rydian commented 5 years ago

There's a number of things that go into that though. The attribute flag on the class, the tags on the class, and then personalization data on the item itself, and I don't think that last bit is actually sent out by the server (since most stats don't show up on equipment other people drop if you right-click it on the floor).

LoneDev6 commented 5 years ago

I see, that's something I hoped was clientside

LoneDev6 commented 5 years ago

But for example "(EVENT)" items are always not pickupable, right?

Rydian commented 5 years ago

Pickup status is not tied to name or description, both are arbitrary strings typed up by the translators. They can include incorrect info, and often do not bother to include restrictions like "(Not tradable)".

As an example of how arbitrary things can be, look at these four upgrade stones. https://i.imgur.com/D1QLdIZ.png

I just checked and everything with "(Event)" in the name happens to not be able to be picked up right now in r293 NA, but that could change next patch. It also doesn't cover many cases/items, since only 184 or so items have that in the name (the majority of locked items lack it). So some other method would be needed.

I had somebody drop two upgrade stones, one that could be picked up and one that couldn't. I had them drop them in front of me, and also drop them out of render distance so I'd run up to them to find them. Logging the item info from the server...

00 00 00 00 10 30 00 00 80 80 80 00 80 80 80 00
80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 01 00 00 00 2D 01 00 00 30 4C 01 00
92 75 01 00 00 00 86 00 00 00 00 00 00 00 00 00
00 00 00 00 FF FF 00 00
00 00 00 00 FC 2F 00 00 80 80 80 00 80 80 80 00
80 80 80 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 01 00 00 00 2D 01 00 00 3A 4C 01 00
CF 75 01 00 00 00 2F 00 00 00 00 00 00 00 00 00
00 00 00 00 FF FF 00 00

The bytes that varied between the two items were as such.

+4: 2 bytes different (class ID) +2C: 1 byte different ? +30: 1 byte different ? +36: 1 byte different ?

These offsets don't match useful info in the normal client item structure, so it's some other structure I don't have any info for. That said, the bytes that vary do not denote any sort of trade status (which is a single byte flag that only goes up to like 15 or so), nor do they contain the tags for the item class (which would be pretty large).

So Kanan's would have to look at the item class and dig the tags and Attr_ActionFlag up out of the DB and look at those to see. In general any Attr flag other than 0 means it can't be picked up, and there's certain tags that prevent an item from being picked up off the floor regardless of the flag, like one of the tags on many item/shop bags prevents them from being picked up even if their flag is 0 (but I don't know specifically which tag it is).

And then we get to personalized/upgraded items like this pair of boots they dropped.

00 00 00 00 9D 65 00 00 DC CF D4 00 12 A9 E2 00
48 B5 FF 00 00 00 00 00 3B A1 EF 00 4D A0 E6 00
78 76 9B 00 00 00 00 00 2D 01 00 00 12 4C 01 00
44 87 01 00 00 00 A9 00 00 00 00 00 00 00 00 00
00 00 00 00 FF FF 00 00

And I don't know what represents what in there outside of the item class, so I don't know what Kanan's would look for to denote that we can't pick it up (since the item class is unmodified and would normally be able to be picked up).

And yes, the client does try to pick up the item regardless of info it knows, and the server responds with the result of the attempt (1 for success, 0 for failure, failure has extra info tagged onto it).