mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-30 13:47:23 +01:00
@@ -47,7 +47,7 @@ GameObject::GameObject() : WorldObject(false), MapObject(),
|
||||
m_respawnTime = 0;
|
||||
m_respawnDelayTime = 300;
|
||||
m_lootState = GO_NOT_READY;
|
||||
m_lootStateUnit = NULL;
|
||||
m_lootStateUnitGUID = 0;
|
||||
m_spawnedByDefault = true;
|
||||
m_usetimes = 0;
|
||||
m_spellId = 0;
|
||||
@@ -561,11 +561,12 @@ void GameObject::Update(uint32 diff)
|
||||
CastSpell(NULL, goInfo->trap.spellId);
|
||||
SetLootState(GO_JUST_DEACTIVATED);
|
||||
}
|
||||
else if (m_lootStateUnit)
|
||||
else if (m_lootStateUnitGUID)
|
||||
if (Unit* target = Unit::GetUnit(*this, m_lootStateUnitGUID))
|
||||
{
|
||||
// Some traps do not have a spell but should be triggered
|
||||
if (goInfo->trap.spellId)
|
||||
CastSpell(m_lootStateUnit, goInfo->trap.spellId);
|
||||
CastSpell(target, goInfo->trap.spellId);
|
||||
|
||||
// Template value or 4 seconds
|
||||
m_cooldownTime = time(NULL) + (goInfo->trap.cooldown ? goInfo->trap.cooldown : uint32(4));
|
||||
@@ -575,7 +576,7 @@ void GameObject::Update(uint32 diff)
|
||||
|
||||
// Battleground gameobjects have data2 == 0 && data5 == 3
|
||||
if (!goInfo->trap.diameter && goInfo->trap.cooldown == 3)
|
||||
if (Player* player = m_lootStateUnit->ToPlayer())
|
||||
if (Player* player = target->ToPlayer())
|
||||
if (Battleground* bg = player->GetBattleground())
|
||||
bg->HandleTriggerBuff(GetGUID());
|
||||
}
|
||||
@@ -2008,7 +2009,7 @@ void GameObject::SetDestructibleState(GameObjectDestructibleState state, Player*
|
||||
void GameObject::SetLootState(LootState state, Unit* unit)
|
||||
{
|
||||
m_lootState = state;
|
||||
m_lootStateUnit = unit;
|
||||
m_lootStateUnitGUID = unit ? unit->GetGUID() : 0;
|
||||
AI()->OnStateChanged(state, unit);
|
||||
sScriptMgr->OnGameObjectLootStateChanged(this, state, unit);
|
||||
if (m_model)
|
||||
|
||||
@@ -841,7 +841,7 @@ class GameObject : public WorldObject, public GridObject<GameObject>, public Map
|
||||
time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
|
||||
uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
|
||||
LootState m_lootState;
|
||||
Unit* m_lootStateUnit;
|
||||
uint64 m_lootStateUnitGUID; // GUID of the unit passed with SetLootState(LootState, Unit*)
|
||||
bool m_spawnedByDefault;
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user