TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
AreaTrigger.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  *
4  * This program is free software; you can redistribute it and/or modify it
5  * under the terms of the GNU General Public License as published by the
6  * Free Software Foundation; either version 2 of the License, or (at your
7  * option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but WITHOUT
10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12  * more details.
13  *
14  * You should have received a copy of the GNU General Public License along
15  * with this program. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef TRINITYCORE_AREATRIGGER_H
19 #define TRINITYCORE_AREATRIGGER_H
20 
21 #include "Object.h"
22 
23 class Unit;
24 class SpellInfo;
25 
26 class TC_GAME_API AreaTrigger : public WorldObject, public GridObject<AreaTrigger>
27 {
28  public:
29  AreaTrigger();
30  ~AreaTrigger();
31 
32  void AddToWorld() override;
33  void RemoveFromWorld() override;
34 
35  bool CreateAreaTrigger(ObjectGuid::LowType guidlow, uint32 triggerEntry, Unit* caster, SpellInfo const* spell, Position const& pos);
36  void Update(uint32 p_time) override;
37  void Remove();
39  int32 GetDuration() const { return _duration; }
40  void SetDuration(int32 newDuration) { _duration = newDuration; }
41  void Delay(int32 delaytime) { SetDuration(GetDuration() - delaytime); }
42 
43  protected:
45 };
46 #endif
bool Remove(ContainerUnorderedMap< SPECIFIC_TYPE, KEY_TYPE > &elements, KEY_TYPE const &handle, SPECIFIC_TYPE *)
Definition: TypeContainerFunctions.h:104
int32 _duration
Definition: AreaTrigger.h:44
uint32 GetSpellId() const
Definition: AreaTrigger.h:38
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
int32 GetDuration() const
Definition: AreaTrigger.h:39
void SetDuration(int32 newDuration)
Definition: AreaTrigger.h:40
Definition: SpellInfo.h:326
Definition: UpdateFields.h:378
Definition: Object.h:355
Definition: Object.h:423
uint64 LowType
Definition: ObjectGuid.h:199
void Delay(int32 delaytime)
Definition: AreaTrigger.h:41
virtual void RemoveFromWorld() override
Definition: Object.cpp:1515
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
virtual void AddToWorld()
Definition: Object.cpp:142
#define TC_GAME_API
Definition: Define.h:134
Definition: Position.h:27
Definition: Unit.h:1305
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
Definition: AreaTrigger.h:26