fix(Core/GameObjects): Lockpicking timer on gameobjects should reset … (#9203)

* fix(Core/GameObjects): Lockpicking timer on gameobjects should reset after 10 minutes.

Fixes #8936
This commit is contained in:
UltraNix
2021-11-22 16:07:55 +01:00
committed by GitHub
parent 4099c38072
commit dc9c3a5fe4
2 changed files with 38 additions and 11 deletions

View File

@@ -430,6 +430,22 @@ void GameObject::Update(uint32 diff)
}
}
for (std::unordered_map<ObjectGuid, int32>::iterator itr = m_SkillupList.begin(); itr != m_SkillupList.end();)
{
if (itr->second > 0)
{
if (itr->second > static_cast<int32>(diff))
{
itr->second -= static_cast<int32>(diff);
++itr;
}
else
{
itr = m_SkillupList.erase(itr);
}
}
}
switch (m_lootState)
{
case GO_NOT_READY:
@@ -2848,3 +2864,22 @@ SpellInfo const* GameObject::GetSpellForLock(Player const* player) const
return nullptr;
}
void GameObject::AddToSkillupList(ObjectGuid playerGuid)
{
int32 timer = GetMap()->IsDungeon() ? -1 : 10 * MINUTE * IN_MILLISECONDS;
m_SkillupList[playerGuid] = timer;
}
bool GameObject::IsInSkillupList(ObjectGuid playerGuid) const
{
for (auto const& itr : m_SkillupList)
{
if (itr.first == playerGuid)
{
return true;
}
}
return false;
}