mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-16 10:30:27 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -854,16 +854,8 @@ public:
|
||||
void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
|
||||
void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
|
||||
|
||||
void AddToSkillupList(ObjectGuid playerGuid) { m_SkillupList.push_back(playerGuid); }
|
||||
[[nodiscard]] bool IsInSkillupList(ObjectGuid playerGuid) const
|
||||
{
|
||||
for (ObjectGuid const& guid : m_SkillupList)
|
||||
if (guid == playerGuid)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
void ClearSkillupList() { m_SkillupList.clear(); }
|
||||
void AddToSkillupList(ObjectGuid playerGuid);
|
||||
[[nodiscard]] bool IsInSkillupList(ObjectGuid playerGuid) const;
|
||||
|
||||
void AddUniqueUse(Player* player);
|
||||
void AddUse() { ++m_usetimes; }
|
||||
@@ -991,7 +983,7 @@ protected:
|
||||
bool m_spawnedByDefault;
|
||||
uint32 m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
|
||||
// For traps this: spell casting cooldown, for doors/buttons: reset time.
|
||||
GuidList m_SkillupList;
|
||||
std::unordered_map<ObjectGuid, int32> m_SkillupList;
|
||||
|
||||
ObjectGuid m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
|
||||
GuidSet m_unique_users;
|
||||
|
||||
Reference in New Issue
Block a user