mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 10:37:02 +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))
|
if (user->GetTypeId() == TYPEID_PLAYER && sScriptMgr.OnGameObjectUse((Player*)user, this))
|
||||||
return;
|
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())
|
switch(GetGoType())
|
||||||
{
|
{
|
||||||
case GAMEOBJECT_TYPE_DOOR: // 0
|
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
|
// FIXME: when GO casting will be implemented trap must cast spell to target
|
||||||
if (uint32 spellId = GetGOInfo()->trap.spellId)
|
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.
|
// TODO: all traps can be activated, also those without spell.
|
||||||
// Some may have have animation and/or are expected to despawn.
|
// Some may have have animation and/or are expected to despawn.
|
||||||
|
|
|
||||||
|
|
@ -456,6 +456,16 @@ struct GameObjectInfo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 GetCooldown() const // not triggering at detection target or use until coolodwn expire
|
||||||
|
{
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
case GAMEOBJECT_TYPE_TRAP: return trap.cooldown;
|
||||||
|
case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint32 GetLinkedGameObjectEntry() const
|
uint32 GetLinkedGameObjectEntry() const
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
|
|
@ -711,7 +721,7 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
|
||||||
LootState m_lootState;
|
LootState m_lootState;
|
||||||
bool m_spawnedByDefault;
|
bool m_spawnedByDefault;
|
||||||
time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
|
time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
|
||||||
// For traps this: spell casting cooldown, for doors/buttons: reset time.
|
// For traps/goober this: spell casting cooldown, for doors/buttons: reset time.
|
||||||
|
|
||||||
typedef std::set<ObjectGuid> GuidsSet;
|
typedef std::set<ObjectGuid> GuidsSet;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "11111"
|
#define REVISION_NR "11112"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue