feat: check if a creature really sweepable
This commit is contained in:
@@ -18,8 +18,14 @@ public:
|
|||||||
return m_CreatureId;
|
return m_CreatureId;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatureDiedEvent(uint32_t creatureId) :
|
const std::vector<int32_t>& GetCreatureInfo() const
|
||||||
m_CreatureId(creatureId)
|
{
|
||||||
|
return m_CreatureInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
CreatureDiedEvent(uint32_t creatureId, const std::vector<int32_t>& creatureInfo) :
|
||||||
|
m_CreatureId(creatureId),
|
||||||
|
m_CreatureInfo(creatureInfo)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -29,4 +35,5 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
const uint32_t m_CreatureId;
|
const uint32_t m_CreatureId;
|
||||||
|
const std::vector<int32_t> m_CreatureInfo;
|
||||||
};
|
};
|
@@ -119,7 +119,7 @@ namespace Interlude
|
|||||||
|
|
||||||
int __fastcall NetworkHandlerWrapper::__OnDie_hook(NetworkHandler* This, int, User* creature, L2ParamStack& stack)
|
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);
|
return (*__OnDie)(This, creature, stack);
|
||||||
}
|
}
|
||||||
|
@@ -93,7 +93,8 @@ namespace Interlude
|
|||||||
const auto casted = static_cast<const CreatureDiedEvent&>(evt);
|
const auto casted = static_cast<const CreatureDiedEvent&>(evt);
|
||||||
if (m_Spoiled.find(casted.GetCreatureId()) != m_Spoiled.end())
|
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;
|
m_Spoiled[casted.GetCreatureId()] = Enums::SpoilStateEnum::sweepable;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user