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