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

* 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.
This commit is contained in:
VladimirMangos 2009-07-19 07:34:18 +04:00
parent 349216d5d7
commit 39833b0069
3 changed files with 96 additions and 83 deletions

View file

@ -442,6 +442,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)
@ -663,7 +674,6 @@ class MANGOS_DLL_SPEC GameObject : public WorldObject
bool isActiveObject() const { return false; }
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