[8205] Really use trap GO charges and avoid casting in despawned state. Author: VladimirMangos

* Drop horribale hack with stored charges amount, use instead GO info charges data as expected.
    * Count trap activations as charge uses if it have limited charges.
    * Check trap reactions only in ready spawned state.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-07-24 09:33:56 +08:00
parent d80754a480
commit 68134b847c
2 changed files with 85 additions and 72 deletions
+11 -1
View File
@@ -444,6 +444,17 @@ struct GameObjectInfo
}
}
uint32 GetCharges() const // despawn at uses amount
{
switch(type)
{
//case GAMEOBJECT_TYPE_TRAP: return trap.charges;
case GAMEOBJECT_TYPE_GUARDPOST: return guardpost.charges;
case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.charges;
default: return 0;
}
}
uint32 GetLinkedGameObjectEntry() const
{
switch(type)
@@ -692,7 +703,6 @@ class TRINITY_DLL_SPEC GameObject : public WorldObject
uint64 GetRotation() const { return m_rotation; }
protected:
uint32 m_charges; // Spell charges for GAMEOBJECT_TYPE_SPELLCASTER (22)
uint32 m_spellId;
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