[2] | 1 | /* |
---|
| 2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
| 3 | * |
---|
| 4 | * This program is free software; you can redistribute it and/or modify |
---|
| 5 | * it under the terms of the GNU General Public License as published by |
---|
| 6 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 7 | * (at your option) any later version. |
---|
| 8 | * |
---|
| 9 | * This program is distributed in the hope that it will be useful, |
---|
| 10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 12 | * GNU General Public License for more details. |
---|
| 13 | * |
---|
| 14 | * You should have received a copy of the GNU General Public License |
---|
| 15 | * along with this program; if not, write to the Free Software |
---|
| 16 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
| 17 | */ |
---|
| 18 | |
---|
| 19 | #ifndef _HOSTILEREFMANAGER |
---|
| 20 | #define _HOSTILEREFMANAGER |
---|
| 21 | |
---|
| 22 | #include "Common.h" |
---|
| 23 | #include "Utilities/LinkedReference/RefManager.h" |
---|
| 24 | |
---|
| 25 | class Unit; |
---|
| 26 | class ThreatManager; |
---|
| 27 | class HostilReference; |
---|
| 28 | struct SpellEntry; |
---|
| 29 | |
---|
| 30 | //================================================= |
---|
| 31 | |
---|
| 32 | class HostilRefManager : public RefManager<Unit, ThreatManager> |
---|
| 33 | { |
---|
| 34 | private: |
---|
| 35 | Unit *iOwner; |
---|
| 36 | public: |
---|
| 37 | explicit HostilRefManager(Unit *pOwner) { iOwner = pOwner; } |
---|
| 38 | ~HostilRefManager(); |
---|
| 39 | |
---|
| 40 | Unit* getOwner() { return iOwner; } |
---|
| 41 | |
---|
| 42 | // send threat to all my hateres for the pVictim |
---|
| 43 | // The pVictim is hated than by them as well |
---|
| 44 | // use for buffs and healing threat functionality |
---|
| 45 | void threatAssist(Unit *pVictim, float threat, SpellEntry const *threatSpell = 0, bool pSingleTarget=false); |
---|
| 46 | |
---|
| 47 | void addThreatPercent(int32 pValue); |
---|
| 48 | |
---|
| 49 | // The references are not needed anymore |
---|
| 50 | // tell the source to remove them from the list and free the mem |
---|
| 51 | void deleteReferences(); |
---|
| 52 | |
---|
| 53 | HostilReference* getFirst() { return ((HostilReference* ) RefManager<Unit, ThreatManager>::getFirst()); } |
---|
| 54 | |
---|
| 55 | void updateThreatTables(); |
---|
| 56 | |
---|
| 57 | void setOnlineOfflineState(bool pIsOnline); |
---|
| 58 | |
---|
| 59 | // set state for one reference, defined by Unit |
---|
| 60 | void setOnlineOfflineState(Unit *pCreature,bool pIsOnline); |
---|
| 61 | |
---|
| 62 | // delete one reference, defined by Unit |
---|
| 63 | void deleteReference(Unit *pCreature); |
---|
| 64 | }; |
---|
| 65 | //================================================= |
---|
| 66 | #endif |
---|