diff options
| author | Drahy <none@none> | 2009-07-27 07:40:52 +0200 |
|---|---|---|
| committer | Drahy <none@none> | 2009-07-27 07:40:52 +0200 |
| commit | afd5658de56d471f0e364f19ed13cccc84175d39 (patch) | |
| tree | 55818fb43a749dad720dce1301b9aa68649863ec /src/game/GridNotifiers.h | |
| parent | 6a8484ce25f5f278f6546177c57eb74fa556dfd7 (diff) | |
| parent | 190863e5a58364a9f42336e300c836d9ec6242ad (diff) | |
* Merge
--HG--
branch : trunk
Diffstat (limited to 'src/game/GridNotifiers.h')
| -rw-r--r-- | src/game/GridNotifiers.h | 61 |
1 files changed, 41 insertions, 20 deletions
diff --git a/src/game/GridNotifiers.h b/src/game/GridNotifiers.h index 64deb0d3123..997f0806369 100644 --- a/src/game/GridNotifiers.h +++ b/src/game/GridNotifiers.h @@ -1135,48 +1135,69 @@ namespace Trinity Unit const* pUnit; }; - class AllGameObjectsWithEntryInGrid + class AllGameObjectsWithEntryInRange { public: - AllGameObjectsWithEntryInGrid(uint32 ent) : entry(ent) {} - bool operator() (GameObject* g) + AllGameObjectsWithEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {} + bool operator() (GameObject* pGo) { - if(g->GetEntry() == entry) + if (pGo->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pGo,m_fRange,false)) return true; return false; } private: - uint32 entry; + const WorldObject* m_pObject; + uint32 m_uiEntry; + float m_fRange; }; - class GameObjectInRangeCheck + class AllCreaturesOfEntryInRange { - public: - GameObjectInRangeCheck(float _x, float _y, float _z, float _range) : x(_x), y(_y), z(_z), range(_range) {} - bool operator() (GameObject* go) - { - return go->IsInRange(x, y, z, range); - } - private: - float x, y, z, range; + public: + AllCreaturesOfEntryInRange(const WorldObject* pObject, uint32 uiEntry, float fMaxRange) : m_pObject(pObject), m_uiEntry(uiEntry), m_fRange(fMaxRange) {} + bool operator() (Unit* pUnit) + { + if (pUnit->GetEntry() == m_uiEntry && m_pObject->IsWithinDist(pUnit,m_fRange,false)) + return true; + + return false; + } + + private: + const WorldObject* m_pObject; + uint32 m_uiEntry; + float m_fRange; }; - class AllCreaturesOfEntryInRange + class PlayerAtMinimumRangeAway { public: - AllCreaturesOfEntryInRange(Unit const* obj, uint32 ent, float ran) : pUnit(obj), entry(ent), range(ran) {} - bool operator() (Unit* u) + PlayerAtMinimumRangeAway(Unit const* unit, float fMinRange) : pUnit(unit), fRange(fMinRange) {} + bool operator() (Player* pPlayer) { - if(u->GetEntry() == entry && pUnit->IsWithinDistInMap(u, range)) + //No threat list check, must be done explicit if expected to be in combat with creature + if (!pPlayer->isGameMaster() && pPlayer->isAlive() && !pUnit->IsWithinDist(pPlayer,fRange,false)) return true; return false; } + private: Unit const* pUnit; - uint32 entry; - float range; + float fRange; + }; + + class GameObjectInRangeCheck + { + public: + GameObjectInRangeCheck(float _x, float _y, float _z, float _range) : x(_x), y(_y), z(_z), range(_range) {} + bool operator() (GameObject* go) + { + return go->IsInRange(x, y, z, range); + } + private: + float x, y, z, range; }; // Player checks and do |
