mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 16:37:01 +00:00
[11112] Implement use cooldown check for trap/goober gameobjects.
This commit is contained in:
parent
b120464db7
commit
abbd2f09be
3 changed files with 22 additions and 3 deletions
|
|
@ -922,6 +922,15 @@ void GameObject::Use(Unit* user)
|
|||
if (user->GetTypeId() == TYPEID_PLAYER && sScriptMgr.OnGameObjectUse((Player*)user, this))
|
||||
return;
|
||||
|
||||
// test only for exist cooldown data (cooldown timer used for door/buttons reset that not have use cooldown)
|
||||
if (uint32 cooldown = GetGOInfo()->GetCooldown())
|
||||
{
|
||||
if (m_cooldownTime > sWorld.GetGameTime())
|
||||
return;
|
||||
|
||||
m_cooldownTime = sWorld.GetGameTime() + cooldown;
|
||||
}
|
||||
|
||||
switch(GetGoType())
|
||||
{
|
||||
case GAMEOBJECT_TYPE_DOOR: // 0
|
||||
|
|
@ -989,7 +998,7 @@ void GameObject::Use(Unit* user)
|
|||
|
||||
// FIXME: when GO casting will be implemented trap must cast spell to target
|
||||
if (uint32 spellId = GetGOInfo()->trap.spellId)
|
||||
user->CastSpell(user, spellId, true, NULL, NULL, GetGUID());
|
||||
user->CastSpell(user, spellId, true, NULL, NULL, GetObjectGuid());
|
||||
|
||||
// TODO: all traps can be activated, also those without spell.
|
||||
// Some may have have animation and/or are expected to despawn.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue