Core/Gameobject: Respect cooldown for trap and goober gameobjects.

Original patch by VladimirMangos
This commit is contained in:
Machiavelli committed 2011-03-14 23:16:34 +01:00
1 parent cd5744f2c5
commit 1c3082446e
2 files changed
+23 -2

No files matched your search

@@ -451,7 +451,7 @@ void GameObject::Update(uint32 diff)
if (goInfo->trap.spellId)
CastSpell(ok, goInfo->trap.spellId);
m_cooldownTime = time(NULL) + 4; // 4 seconds
m_cooldownTime = time(NULL) + goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4); // template or 4 seconds
if (owner) // || goInfo->trap.charges == 1)
SetLootState(GO_JUST_DEACTIVATED);
@@ -1048,7 +1048,16 @@ void GameObject::Use(Unit* user)
AI()->GossipHello(playerUser);
}
switch(GetGoType())
// If cooldown data present in template
if (uint32 cooldown = GetGOInfo()->GetCooldown())
{
if (m_cooldownTime > sWorld->GetGameTime())
return;
m_cooldownTime = sWorld->GetGameTime() + cooldown;
}
switch (GetGoType())
{
case GAMEOBJECT_TYPE_DOOR: //0
case GAMEOBJECT_TYPE_BUTTON: //1