feat: check if a creature really sweepable

This commit is contained in:
k0t9i
2023-01-24 00:36:12 +04:00
parent e6e20a1e08
commit 3755e45ac6
3 changed files with 12 additions and 4 deletions

View File

@ -119,7 +119,7 @@ namespace Interlude
int __fastcall NetworkHandlerWrapper::__OnDie_hook(NetworkHandler* This, int, User* creature, L2ParamStack& stack)
{
EventDispatcher::GetInstance().Dispatch(CreatureDiedEvent{ creature->objectId });
EventDispatcher::GetInstance().Dispatch(CreatureDiedEvent{ creature->objectId, stack.GetBufferAsVector<int32_t>()});
return (*__OnDie)(This, creature, stack);
}

View File

@ -93,7 +93,8 @@ namespace Interlude
const auto casted = static_cast<const CreatureDiedEvent&>(evt);
if (m_Spoiled.find(casted.GetCreatureId()) != m_Spoiled.end())
{
if (m_Spoiled[casted.GetCreatureId()] == Enums::SpoilStateEnum::spoiled)
const auto isSweepable = casted.GetCreatureInfo()[4] != 0;
if (m_Spoiled[casted.GetCreatureId()] == Enums::SpoilStateEnum::spoiled && isSweepable)
{
m_Spoiled[casted.GetCreatureId()] = Enums::SpoilStateEnum::sweepable;
}