2 * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
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.
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.
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
24 class ThreatContainer
;
26 class HostilReference
;
28 //==============================================================
29 //==============================================================
33 // Player/Pet changed on/offline status
34 UEV_THREAT_REF_ONLINE_STATUS
= 1<<0,
36 // Threat for Player/Pet changed
37 UEV_THREAT_REF_THREAT_CHANGE
= 1<<1,
39 // Player/Pet will be removed from list (dead) [for internal use]
40 UEV_THREAT_REF_REMOVE_FROM_LIST
= 1<<2,
42 // Player/Pet entered/left water or some other place where it is/was not accessible for the creature
43 UEV_THREAT_REF_ASSECCIBLE_STATUS
= 1<<3,
45 // Threat list is going to be sorted (if dirty flag is set)
46 UEV_THREAT_SORT_LIST
= 1<<4,
48 // New target should be fetched, could tbe the current target as well
49 UEV_THREAT_SET_NEXT_TARGET
= 1<<5,
51 // A new victim (target) was set. Could be NULL
52 UEV_THREAT_VICTIM_CHANGED
= 1<<6,
55 //UEV_UNIT_KILLED = 1<<7,
58 //UEV_UNIT_HEALTH_CHANGE = 1<<8,
61 #define UEV_THREAT_REF_EVENT_MASK ( UEV_THREAT_REF_ONLINE_STATUS | UEV_THREAT_REF_THREAT_CHANGE | UEV_THREAT_REF_REMOVE_FROM_LIST | UEV_THREAT_REF_ASSECCIBLE_STATUS)
62 #define UEV_THREAT_MANAGER_EVENT_MASK (UEV_THREAT_SORT_LIST | UEV_THREAT_SET_NEXT_TARGET | UEV_THREAT_VICTIM_CHANGED)
63 #define UEV_ALL_EVENT_MASK (0xffffffff)
66 //#define UEV_UNIT_EVENT_MASK (UEV_UNIT_KILLED | UEV_UNIT_HEALTH_CHANGE)
68 //==============================================================
70 class MANGOS_DLL_SPEC UnitBaseEvent
75 UnitBaseEvent(uint32 pType
) { iType
= pType
; }
76 uint32
getType() const { return iType
; }
77 bool matchesTypeMask(uint32 pMask
) const { return iType
& pMask
; }
79 void setType(uint32 pType
) { iType
= pType
; }
83 //==============================================================
85 class MANGOS_DLL_SPEC ThreatRefStatusChangeEvent
: public UnitBaseEvent
88 HostilReference
* iHostilReference
;
95 ThreatManager
* iThreatManager
;
97 ThreatRefStatusChangeEvent(uint32 pType
) : UnitBaseEvent(pType
) { iHostilReference
= NULL
; }
99 ThreatRefStatusChangeEvent(uint32 pType
, HostilReference
* pHostilReference
) : UnitBaseEvent(pType
) { iHostilReference
= pHostilReference
; }
101 ThreatRefStatusChangeEvent(uint32 pType
, HostilReference
* pHostilReference
, float pValue
) : UnitBaseEvent(pType
) { iHostilReference
= pHostilReference
; iFValue
= pValue
; }
103 ThreatRefStatusChangeEvent(uint32 pType
, HostilReference
* pHostilReference
, bool pValue
) : UnitBaseEvent(pType
) { iHostilReference
= pHostilReference
; iBValue
= pValue
; }
105 int32
getIValue() const { return iIValue
; }
107 float getFValue() const { return iFValue
; }
109 bool getBValue() const { return iBValue
; }
111 void setBValue(bool pValue
) { iBValue
= pValue
; }
113 HostilReference
* getReference() const { return iHostilReference
; }
115 void setThreatManager(ThreatManager
* pThreatManager
) { iThreatManager
= pThreatManager
; }
117 ThreatManager
* getThreatManager() const { return iThreatManager
; }
120 //==============================================================
122 class MANGOS_DLL_SPEC ThreatManagerEvent
: public ThreatRefStatusChangeEvent
125 ThreatContainer
* iThreatContainer
;
127 ThreatManagerEvent(uint32 pType
) : ThreatRefStatusChangeEvent(pType
) {}
128 ThreatManagerEvent(uint32 pType
, HostilReference
* pHostilReference
) : ThreatRefStatusChangeEvent(pType
, pHostilReference
) {}
130 void setThreatContainer(ThreatContainer
* pThreatContainer
) { iThreatContainer
= pThreatContainer
; }
132 ThreatContainer
* getThreatContainer() const { return iThreatContainer
; }
135 //==============================================================