Skip to content

Commit d3ed98a

Browse files
authored
Events: NWNX_ON_ITEM_AMMO_RELOAD can SetEventResult to item in container (#1830)
1 parent 35f127d commit d3ed98a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Plugins/Events/Events/ItemEvents.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,12 @@ ObjectID FindItemWithBaseItemIdHook(CItemRepository* thisPtr, uint32_t nBaseItem
248248
}
249249
else if (pItem->m_oidPossessor != thisPtr->m_oidParent)
250250
{
251-
LOG_WARNING("Item does not belong to that creature, falling back to original call.");
252-
return false;
251+
auto *pPossessor = Utils::AsNWSItem(Globals::AppManager()->m_pServerExoApp->GetGameObject(pItem->m_oidPossessor));
252+
if (!pPossessor || pPossessor->m_oidPossessor != thisPtr->m_oidParent)
253+
{
254+
LOG_WARNING("Item does not belong to that creature, falling back to original call.");
255+
return false;
256+
}
253257
}
254258
return true;
255259
};

0 commit comments

Comments
 (0)