Skip to content

Never free a reused crafted potion when recreating traded items - #10

Merged
absol89 merged 1 commit into
codex/player-trading-1.6.1170from
claude/crafted-potion-trade-r45fjg
Oct 7, 2026
Merged

absol89 merged 1 commit into
codex/player-trading-1.6.1170from
claude/crafted-potion-trade-r45fjg

Conversation

@absol89

@absol89 absol89 commented Oct 7, 2026 •

Copy link
Copy Markdown
Owner

Before: when the engine's AddPotion/AddPoison returned a potion whose effects didn't exactly match the traded recipe (including its gold cost), the client dropped that potion's created-object reference and refused the item. The engine can hand back an existing potion with the same effects, so this could free a form still held in an inventory. On 1.8.3-25, the receiving player crashed the next time that inventory was searched: Cast<AlchemyItem> in AlchemyItem::Find, called from TESObjectREFR::AddOrRemoveItem while removing a crafted potion from the partner's character (symbolized from the playtest crash log). The other player never received the refused potion.

After: a mismatched result is refused without touching its reference, effect cost is ignored in the check because it only affects gold value, and both recipes are written to the client log when a potion is refused.

How: AlchemyItem::Create compares effect, magnitude, area and duration (order-insensitive), never calls DecrementRef, and logs wanted and returned effects on a mismatch. The now-unused AlchemyItem::Release is removed, so no client code drops a created-object reference anymore.

🤖 Generated with Claude Code

https://claude.ai/code/session_01SSW5HGXzi9kAVm4zdsSaid

AddPotion/AddPoison can return an existing created potion, including one
the player already holds. Releasing it on a recipe mismatch could free a
form an inventory still points at. Refuse it without releasing, ignore
effect cost (gold value only) in the check, and log both recipes so a
refused potion can be diagnosed from the client log.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SSW5HGXzi9kAVm4zdsSaid
@absol89
absol89 marked this pull request as ready for review October 7, 2026 09:40
@absol89
absol89 merged commit 4915680 into codex/player-trading-1.6.1170 Oct 7, 2026
3 checks passed
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