diasurgical / devilutionX

Diablo build for modern operating systems
Other
8.11k stars 796 forks source link

Make invalid items unusable #7506

Closed kphoenix137 closed 1 week ago

kphoenix137 commented 3 weeks ago

Stops players from equipping illegal items and removes the bonuses of already equipped illegal items when the game recalculates equipped items (for loading players with existing illegal items).

The definition of illegal items are any items that would fail existing multiplayer item validation, resulting in the "invalid packet" message or preventing a game join.

This creates a situation where debug build begins creating items that the developer cannot equip, however one can easily override this check. I believe it's better that way, as it prevents non-developers from utilizing debug build for cheating purposes.

The necessity for this comes from a recent Discord discussion, where a legitimate player was given an illegal item prior to the implementation of item validation. As there was no indication this item was illegal, this caused the player to end up unable to join games and unaware why.

https://github.com/user-attachments/assets/d96e87c3-9189-4167-b835-6da00f19cf37

kphoenix137 commented 2 weeks ago

Can we make it so that this is triggered when the is loaded so that it is reflected in the hero menu and doesn't require that they first interact with there gear like in the second video?

I'll look into that but it's a good idea

kphoenix137 commented 2 weeks ago

Would it be advantageous to create a new item struct variable that's similar to iStatFlag, but for item validity? Then we can have the game treat it a little differently, such as display text in the item box signaling the item is invalid, and perhaps a different character voice line?

kphoenix137 commented 2 weeks ago

Additionally, what are the thoughts on treating items as invalid if 2 of the exact same item data are found in the inventory? For example, if someone duplicates a ring, one of the rings will temporarily become unusable while both exist in the inventory. Removing either copy from the inventory would render the existing one once again usable.

In Diablo, this would only affect rings, as it's the only type of item you can equip 2 of simultaneously. In Hellfire, this would prevent Bard from using 2 duplicate weapons. When players die due to monsters, wearing duped items can create a situation anyway where one of the items get deleted.

AJenbo commented 2 weeks ago

Additionally, what are the thoughts on treating items as invalid if 2 of the exact same item data are found in the inventory?

Lets keep that for a later PR. This one ha a good size and only minor changes are needed for it to get merged. It's also unclear how we should handle legit duplicates. This seems a bit more complex and would have little benefit.

Would it be advantageous to create a new item struct variable that's similar to iStatFlag, but for item validity? Then we can have the game treat it a little differently, such as display text in the item box signaling the item is invalid, and perhaps a different character voice line?

I think it's going overboard, they shouldn't really be a feature :D

kphoenix137 commented 2 weeks ago

Town sourced items exceeding maximum vendor prices are no longer deleted, but made unusable instead.