Core/Gameobject: Respect cooldown for trap and goober gameobjects.
Original patch by VladimirMangos
This commit is contained in:
@@ -451,7 +451,7 @@ void GameObject::Update(uint32 diff)
|
|||||||
if (goInfo->trap.spellId)
|
if (goInfo->trap.spellId)
|
||||||
CastSpell(ok, 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)
|
if (owner) // || goInfo->trap.charges == 1)
|
||||||
SetLootState(GO_JUST_DEACTIVATED);
|
SetLootState(GO_JUST_DEACTIVATED);
|
||||||
@@ -1048,7 +1048,16 @@ void GameObject::Use(Unit* user)
|
|||||||
AI()->GossipHello(playerUser);
|
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_DOOR: //0
|
||||||
case GAMEOBJECT_TYPE_BUTTON: //1
|
case GAMEOBJECT_TYPE_BUTTON: //1
|
||||||
|
|||||||
@@ -495,6 +495,7 @@ struct GameObjectInfo
|
|||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GetGossipMenuId() const
|
uint32 GetGossipMenuId() const
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
@@ -504,6 +505,7 @@ struct GameObjectInfo
|
|||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GetEventScriptId() const
|
uint32 GetEventScriptId() const
|
||||||
{
|
{
|
||||||
switch(type)
|
switch(type)
|
||||||
@@ -514,6 +516,16 @@ struct GameObjectInfo
|
|||||||
default: return 0;
|
default: return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell
|
||||||
|
{
|
||||||
|
switch (type)
|
||||||
|
{
|
||||||
|
case GAMEOBJECT_TYPE_TRAP: return trap.cooldown;
|
||||||
|
case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown;
|
||||||
|
default: return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
class OPvPCapturePoint;
|
class OPvPCapturePoint;
|
||||||
|
|||||||
Reference in New Issue
Block a user