TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
HostileRefManager.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef _HOSTILEREFMANAGER
20 #define _HOSTILEREFMANAGER
21 
22 #include "Common.h"
23 #include "RefManager.h"
24 
25 class Unit;
26 class ThreatManager;
27 class HostileReference;
28 class SpellInfo;
29 
30 //=================================================
31 
32 class TC_GAME_API HostileRefManager : public RefManager<Unit, ThreatManager>
33 {
34  private:
36  public:
37  explicit HostileRefManager(Unit* owner) { iOwner = owner; }
39 
40  Unit* GetOwner() { return iOwner; }
41 
42  // send threat to all my hateres for the victim
43  // The victim is hated than by them as well
44  // use for buffs and healing threat functionality
45  void threatAssist(Unit* victim, float baseThreat, SpellInfo const* threatSpell = NULL);
46 
47  void addTempThreat(float threat, bool apply);
48 
49  void addThreatPercent(int32 percent);
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  // Remove specific faction references
56  void deleteReferencesForFaction(uint32 faction);
57 
59 
60  void updateThreatTables();
61 
62  void setOnlineOfflineState(bool isOnline);
63 
64  // set state for one reference, defined by Unit
65  void setOnlineOfflineState(Unit* creature, bool isOnline);
66 
67  // delete one reference, defined by Unit
68  void deleteReference(Unit* creature);
69 
70  void UpdateVisibility();
71 };
72 //=================================================
73 #endif
Definition: SpellInfo.h:326
arena_t NULL
Definition: jemalloc_internal.h:624
HostileRefManager(Unit *owner)
Definition: HostileRefManager.h:37
Definition: ThreatManager.h:201
Unit * iOwner
Definition: HostileRefManager.h:35
Definition: RefManager.h:26
void apply(T *val)
Definition: ByteConverter.h:41
Unit * GetOwner()
Definition: HostileRefManager.h:40
Definition: ThreatManager.h:49
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
HostileReference * getFirst()
Definition: HostileRefManager.h:58
#define TC_GAME_API
Definition: Define.h:134
Definition: Unit.h:1305
Definition: HostileRefManager.h:32