Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't apply dungeon item validation to town items #7612

Merged
merged 1 commit into from
Jan 2, 2025

Conversation

StephenCWills
Copy link
Member

This PR fixes up the logic in IsItemValid() based on the validation logic located in UnPackNetItem().

devilutionX/Source/pack.cpp

Lines 443 to 457 in a12b536

uint16_t creationFlags = SDL_SwapLE16(packedItem.item.wCI);
uint32_t dwBuff = SDL_SwapLE16(packedItem.item.dwBuff);
if (idx != IDI_GOLD)
ValidateField(creationFlags, IsCreationFlagComboValid(creationFlags));
if ((creationFlags & CF_TOWN) != 0)
ValidateField(creationFlags, IsTownItemValid(creationFlags, player));
else if ((creationFlags & CF_USEFUL) == CF_UPER15)
ValidateFields(creationFlags, dwBuff, IsUniqueMonsterItemValid(creationFlags, dwBuff));
else if ((dwBuff & CF_HELLFIRE) != 0 && AllItemsList[idx].iMiscId == IMISC_BOOK)
return RecreateHellfireSpellBook(player, packedItem.item, &item);
else
ValidateFields(creationFlags, dwBuff, IsDungeonItemValid(creationFlags, dwBuff));
RecreateItem(player, packedItem.item, item);
return true;

Prior to this fix, items bought from Wirt by a clvl 50 character would always be unusable, despite Net Validation indicating success.

image

@AJenbo AJenbo merged commit 0d188dd into diasurgical:master Jan 2, 2025
23 checks passed
@StephenCWills StephenCWills deleted the fix-item-validation branch January 2, 2025 01:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants