1 | /* |
---|
2 | * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/> |
---|
3 | * |
---|
4 | * Copyright (C) 2008 Trinity <http://www.trinitycore.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 _OBJECT_H |
---|
22 | #define _OBJECT_H |
---|
23 | |
---|
24 | #include "Common.h" |
---|
25 | #include "ByteBuffer.h" |
---|
26 | #include "UpdateFields.h" |
---|
27 | #include "UpdateData.h" |
---|
28 | #include "GameSystem/GridReference.h" |
---|
29 | #include "ObjectDefines.h" |
---|
30 | #include "GridDefines.h" |
---|
31 | |
---|
32 | #include <set> |
---|
33 | #include <string> |
---|
34 | |
---|
35 | #define CONTACT_DISTANCE 0.5f |
---|
36 | #define INTERACTION_DISTANCE 5.0f |
---|
37 | #define ATTACK_DISTANCE 5.0f |
---|
38 | #define MAX_VISIBILITY_DISTANCE (5*SIZE_OF_GRID_CELL/2.0f) // max distance for visible object show, limited by active zone for player based at cell size (active zone = 5x5 cells) |
---|
39 | #define DEFAULT_VISIBILITY_DISTANCE (SIZE_OF_GRID_CELL) // default visible distance |
---|
40 | |
---|
41 | #define DEFAULT_WORLD_OBJECT_SIZE 0.388999998569489f // player size, also currently used (correctly?) for any non Unit world objects |
---|
42 | |
---|
43 | enum TypeMask |
---|
44 | { |
---|
45 | TYPEMASK_OBJECT = 0x0001, |
---|
46 | TYPEMASK_ITEM = 0x0002, |
---|
47 | TYPEMASK_CONTAINER = 0x0006, // TYPEMASK_ITEM | 0x0004 |
---|
48 | TYPEMASK_UNIT = 0x0008, |
---|
49 | TYPEMASK_PLAYER = 0x0010, |
---|
50 | TYPEMASK_GAMEOBJECT = 0x0020, |
---|
51 | TYPEMASK_DYNAMICOBJECT = 0x0040, |
---|
52 | TYPEMASK_CORPSE = 0x0080, |
---|
53 | TYPEMASK_AIGROUP = 0x0100, |
---|
54 | TYPEMASK_AREATRIGGER = 0x0200 |
---|
55 | }; |
---|
56 | |
---|
57 | enum TypeID |
---|
58 | { |
---|
59 | TYPEID_OBJECT = 0, |
---|
60 | TYPEID_ITEM = 1, |
---|
61 | TYPEID_CONTAINER = 2, |
---|
62 | TYPEID_UNIT = 3, |
---|
63 | TYPEID_PLAYER = 4, |
---|
64 | TYPEID_GAMEOBJECT = 5, |
---|
65 | TYPEID_DYNAMICOBJECT = 6, |
---|
66 | TYPEID_CORPSE = 7, |
---|
67 | TYPEID_AIGROUP = 8, |
---|
68 | TYPEID_AREATRIGGER = 9 |
---|
69 | }; |
---|
70 | |
---|
71 | uint32 GuidHigh2TypeId(uint32 guid_hi); |
---|
72 | |
---|
73 | enum TempSummonType |
---|
74 | { |
---|
75 | TEMPSUMMON_TIMED_OR_DEAD_DESPAWN = 1, // despawns after a specified time OR when the creature disappears |
---|
76 | TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN = 2, // despawns after a specified time OR when the creature dies |
---|
77 | TEMPSUMMON_TIMED_DESPAWN = 3, // despawns after a specified time |
---|
78 | TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT = 4, // despawns after a specified time after the creature is out of combat |
---|
79 | TEMPSUMMON_CORPSE_DESPAWN = 5, // despawns instantly after death |
---|
80 | TEMPSUMMON_CORPSE_TIMED_DESPAWN = 6, // despawns after a specified time after death |
---|
81 | TEMPSUMMON_DEAD_DESPAWN = 7, // despawns when the creature disappears |
---|
82 | TEMPSUMMON_MANUAL_DESPAWN = 8 // despawns when UnSummon() is called |
---|
83 | }; |
---|
84 | |
---|
85 | class WorldPacket; |
---|
86 | class UpdateData; |
---|
87 | class ByteBuffer; |
---|
88 | class WorldSession; |
---|
89 | class Creature; |
---|
90 | class Player; |
---|
91 | class Map; |
---|
92 | class UpdateMask; |
---|
93 | class InstanceData; |
---|
94 | class GameObject; |
---|
95 | |
---|
96 | typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType; |
---|
97 | |
---|
98 | struct WorldLocation |
---|
99 | { |
---|
100 | uint32 mapid; |
---|
101 | float x; |
---|
102 | float y; |
---|
103 | float z; |
---|
104 | float o; |
---|
105 | explicit WorldLocation(uint32 _mapid = 0, float _x = 0, float _y = 0, float _z = 0, float _o = 0) |
---|
106 | : mapid(_mapid), x(_x), y(_y), z(_z), o(_o) {} |
---|
107 | WorldLocation(WorldLocation const &loc) |
---|
108 | : mapid(loc.mapid), x(loc.x), y(loc.y), z(loc.z), o(loc.o) {} |
---|
109 | }; |
---|
110 | |
---|
111 | class TRINITY_DLL_SPEC Object |
---|
112 | { |
---|
113 | public: |
---|
114 | virtual ~Object ( ); |
---|
115 | |
---|
116 | const bool& IsInWorld() const { return m_inWorld; } |
---|
117 | virtual void AddToWorld() |
---|
118 | { |
---|
119 | if(m_inWorld) |
---|
120 | return; |
---|
121 | |
---|
122 | m_inWorld = true; |
---|
123 | |
---|
124 | // synchronize values mirror with values array (changes will send in updatecreate opcode any way |
---|
125 | ClearUpdateMask(true); |
---|
126 | } |
---|
127 | virtual void RemoveFromWorld() |
---|
128 | { |
---|
129 | // if we remove from world then sending changes not required |
---|
130 | if(m_uint32Values) |
---|
131 | ClearUpdateMask(true); |
---|
132 | m_inWorld = false; |
---|
133 | } |
---|
134 | |
---|
135 | const uint64& GetGUID() const { return GetUInt64Value(0); } |
---|
136 | uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); } |
---|
137 | uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(0)); } |
---|
138 | uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(0)); } |
---|
139 | const ByteBuffer& GetPackGUID() const { return m_PackGUID; } |
---|
140 | uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } |
---|
141 | void SetEntry(uint32 entry) { SetUInt32Value(OBJECT_FIELD_ENTRY, entry); } |
---|
142 | |
---|
143 | uint8 GetTypeId() const { return m_objectTypeId; } |
---|
144 | bool isType(uint16 mask) const { return (mask & m_objectType); } |
---|
145 | |
---|
146 | virtual void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const; |
---|
147 | void SendUpdateToPlayer(Player* player); |
---|
148 | |
---|
149 | void BuildValuesUpdateBlockForPlayer( UpdateData *data, Player *target ) const; |
---|
150 | void BuildOutOfRangeUpdateBlock( UpdateData *data ) const; |
---|
151 | void BuildMovementUpdateBlock( UpdateData * data, uint32 flags = 0 ) const; |
---|
152 | void BuildUpdate(UpdateDataMapType &); |
---|
153 | |
---|
154 | virtual void DestroyForPlayer( Player *target ) const; |
---|
155 | |
---|
156 | const int32& GetInt32Value( uint16 index ) const |
---|
157 | { |
---|
158 | ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); |
---|
159 | return m_int32Values[ index ]; |
---|
160 | } |
---|
161 | |
---|
162 | const uint32& GetUInt32Value( uint16 index ) const |
---|
163 | { |
---|
164 | ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); |
---|
165 | return m_uint32Values[ index ]; |
---|
166 | } |
---|
167 | |
---|
168 | const uint64& GetUInt64Value( uint16 index ) const |
---|
169 | { |
---|
170 | ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , false) ); |
---|
171 | return *((uint64*)&(m_uint32Values[ index ])); |
---|
172 | } |
---|
173 | |
---|
174 | const float& GetFloatValue( uint16 index ) const |
---|
175 | { |
---|
176 | ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); |
---|
177 | return m_floatValues[ index ]; |
---|
178 | } |
---|
179 | |
---|
180 | uint8 GetByteValue( uint16 index, uint8 offset) const |
---|
181 | { |
---|
182 | ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); |
---|
183 | ASSERT( offset < 4 ); |
---|
184 | return *(((uint8*)&m_uint32Values[ index ])+offset); |
---|
185 | } |
---|
186 | |
---|
187 | uint8 GetUInt16Value( uint16 index, uint8 offset) const |
---|
188 | { |
---|
189 | ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); |
---|
190 | ASSERT( offset < 2 ); |
---|
191 | return *(((uint16*)&m_uint32Values[ index ])+offset); |
---|
192 | } |
---|
193 | |
---|
194 | void SetInt32Value( uint16 index, int32 value ); |
---|
195 | void SetUInt32Value( uint16 index, uint32 value ); |
---|
196 | void SetUInt64Value( uint16 index, const uint64 &value ); |
---|
197 | void SetFloatValue( uint16 index, float value ); |
---|
198 | void SetByteValue( uint16 index, uint8 offset, uint8 value ); |
---|
199 | void SetUInt16Value( uint16 index, uint8 offset, uint16 value ); |
---|
200 | void SetInt16Value( uint16 index, uint8 offset, int16 value ) { SetUInt16Value(index,offset,(uint16)value); } |
---|
201 | void SetStatFloatValue( uint16 index, float value); |
---|
202 | void SetStatInt32Value( uint16 index, int32 value); |
---|
203 | |
---|
204 | void ApplyModUInt32Value(uint16 index, int32 val, bool apply); |
---|
205 | void ApplyModInt32Value(uint16 index, int32 val, bool apply); |
---|
206 | void ApplyModUInt64Value(uint16 index, int32 val, bool apply); |
---|
207 | void ApplyModPositiveFloatValue( uint16 index, float val, bool apply); |
---|
208 | void ApplyModSignedFloatValue( uint16 index, float val, bool apply); |
---|
209 | |
---|
210 | void ApplyPercentModFloatValue(uint16 index, float val, bool apply) |
---|
211 | { |
---|
212 | val = val != -100.0f ? val : -99.9f ; |
---|
213 | SetFloatValue(index, GetFloatValue(index) * (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val)) ); |
---|
214 | } |
---|
215 | |
---|
216 | void SetFlag( uint16 index, uint32 newFlag ); |
---|
217 | void RemoveFlag( uint16 index, uint32 oldFlag ); |
---|
218 | |
---|
219 | void ToggleFlag( uint16 index, uint32 flag) |
---|
220 | { |
---|
221 | if(HasFlag(index, flag)) |
---|
222 | RemoveFlag(index, flag); |
---|
223 | else |
---|
224 | SetFlag(index, flag); |
---|
225 | } |
---|
226 | |
---|
227 | bool HasFlag( uint16 index, uint32 flag ) const |
---|
228 | { |
---|
229 | ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); |
---|
230 | return (m_uint32Values[ index ] & flag) != 0; |
---|
231 | } |
---|
232 | |
---|
233 | void ApplyModFlag( uint16 index, uint32 flag, bool apply) |
---|
234 | { |
---|
235 | if(apply) SetFlag(index,flag); else RemoveFlag(index,flag); |
---|
236 | } |
---|
237 | |
---|
238 | void SetFlag64( uint16 index, uint64 newFlag ) |
---|
239 | { |
---|
240 | uint64 oldval = GetUInt64Value(index); |
---|
241 | uint64 newval = oldval | newFlag; |
---|
242 | SetUInt64Value(index,newval); |
---|
243 | } |
---|
244 | |
---|
245 | void RemoveFlag64( uint16 index, uint64 oldFlag ) |
---|
246 | { |
---|
247 | uint64 oldval = GetUInt64Value(index); |
---|
248 | uint64 newval = oldval & ~oldFlag; |
---|
249 | SetUInt64Value(index,newval); |
---|
250 | } |
---|
251 | |
---|
252 | void ToggleFlag64( uint16 index, uint64 flag) |
---|
253 | { |
---|
254 | if(HasFlag64(index, flag)) |
---|
255 | RemoveFlag64(index, flag); |
---|
256 | else |
---|
257 | SetFlag64(index, flag); |
---|
258 | } |
---|
259 | |
---|
260 | bool HasFlag64( uint16 index, uint64 flag ) const |
---|
261 | { |
---|
262 | ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); |
---|
263 | return (GetUInt64Value( index ) & flag) != 0; |
---|
264 | } |
---|
265 | |
---|
266 | void ApplyModFlag64( uint16 index, uint64 flag, bool apply) |
---|
267 | { |
---|
268 | if(apply) SetFlag64(index,flag); else RemoveFlag64(index,flag); |
---|
269 | } |
---|
270 | |
---|
271 | void ClearUpdateMask(bool remove); |
---|
272 | void SendUpdateObjectToAllExcept(Player* exceptPlayer); |
---|
273 | |
---|
274 | bool LoadValues(const char* data); |
---|
275 | |
---|
276 | uint16 GetValuesCount() const { return m_valuesCount; } |
---|
277 | |
---|
278 | void InitValues() { _InitValues(); } |
---|
279 | |
---|
280 | virtual bool hasQuest(uint32 /* quest_id */) const { return false; } |
---|
281 | virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; } |
---|
282 | protected: |
---|
283 | |
---|
284 | Object ( ); |
---|
285 | |
---|
286 | void _InitValues(); |
---|
287 | void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh); |
---|
288 | |
---|
289 | virtual void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; |
---|
290 | |
---|
291 | virtual void _SetCreateBits(UpdateMask *updateMask, Player *target) const; |
---|
292 | void _BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2 ) const; |
---|
293 | void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target ) const; |
---|
294 | |
---|
295 | uint16 m_objectType; |
---|
296 | |
---|
297 | uint8 m_objectTypeId; |
---|
298 | uint8 m_updateFlag; |
---|
299 | |
---|
300 | union |
---|
301 | { |
---|
302 | int32 *m_int32Values; |
---|
303 | uint32 *m_uint32Values; |
---|
304 | float *m_floatValues; |
---|
305 | }; |
---|
306 | |
---|
307 | uint32 *m_uint32Values_mirror; |
---|
308 | |
---|
309 | uint16 m_valuesCount; |
---|
310 | |
---|
311 | bool m_objectUpdated; |
---|
312 | |
---|
313 | private: |
---|
314 | bool m_inWorld; |
---|
315 | |
---|
316 | ByteBuffer m_PackGUID; |
---|
317 | |
---|
318 | // for output helpfull error messages from asserts |
---|
319 | bool PrintIndexError(uint32 index, bool set) const; |
---|
320 | Object(const Object&); // prevent generation copy constructor |
---|
321 | Object& operator=(Object const&); // prevent generation assigment operator |
---|
322 | }; |
---|
323 | |
---|
324 | class TRINITY_DLL_SPEC WorldObject : public Object |
---|
325 | { |
---|
326 | public: |
---|
327 | virtual ~WorldObject ( ); |
---|
328 | |
---|
329 | virtual void AddToWorld(); |
---|
330 | |
---|
331 | virtual void RemoveFromWorld(); |
---|
332 | |
---|
333 | virtual void Update ( uint32 /*time_diff*/ ) { } |
---|
334 | |
---|
335 | void _Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid ); |
---|
336 | |
---|
337 | void Relocate(float x, float y, float z, float orientation) |
---|
338 | { |
---|
339 | m_positionX = x; |
---|
340 | m_positionY = y; |
---|
341 | m_positionZ = z; |
---|
342 | m_orientation = orientation; |
---|
343 | } |
---|
344 | |
---|
345 | void Relocate(float x, float y, float z) |
---|
346 | { |
---|
347 | m_positionX = x; |
---|
348 | m_positionY = y; |
---|
349 | m_positionZ = z; |
---|
350 | } |
---|
351 | |
---|
352 | void Relocate(WorldLocation const & loc) |
---|
353 | { |
---|
354 | SetMapId(loc.mapid); |
---|
355 | Relocate(loc.x, loc.y, loc.z, loc.o); |
---|
356 | } |
---|
357 | |
---|
358 | void SetOrientation(float orientation) { m_orientation = orientation; } |
---|
359 | |
---|
360 | float GetPositionX( ) const { return m_positionX; } |
---|
361 | float GetPositionY( ) const { return m_positionY; } |
---|
362 | float GetPositionZ( ) const { return m_positionZ; } |
---|
363 | void GetPosition( float &x, float &y, float &z ) const |
---|
364 | { x = m_positionX; y = m_positionY; z = m_positionZ; } |
---|
365 | void GetPosition( WorldLocation &loc ) const |
---|
366 | { loc.mapid = GetMapId(); GetPosition(loc.x, loc.y, loc.z); loc.o = GetOrientation(); } |
---|
367 | float GetOrientation( ) const { return m_orientation; } |
---|
368 | void GetNearPoint2D( float &x, float &y, float distance, float absAngle) const; |
---|
369 | void GetNearPoint( WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d,float absAngle) const; |
---|
370 | void GetClosePoint(float &x, float &y, float &z, float size, float distance2d = 0, float angle = 0) const |
---|
371 | { |
---|
372 | // angle calculated from current orientation |
---|
373 | GetNearPoint(NULL,x,y,z,size,distance2d,GetOrientation() + angle); |
---|
374 | } |
---|
375 | void GetContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const |
---|
376 | { |
---|
377 | // angle to face `obj` to `this` using distance includes size of `obj` |
---|
378 | GetNearPoint(obj,x,y,z,obj->GetObjectSize(),distance2d,GetAngle( obj )); |
---|
379 | } |
---|
380 | |
---|
381 | float GetObjectSize() const |
---|
382 | { |
---|
383 | return ( m_valuesCount > UNIT_FIELD_BOUNDINGRADIUS ) ? m_floatValues[UNIT_FIELD_BOUNDINGRADIUS] : DEFAULT_WORLD_OBJECT_SIZE; |
---|
384 | } |
---|
385 | bool IsPositionValid() const; |
---|
386 | void UpdateGroundPositionZ(float x, float y, float &z) const; |
---|
387 | |
---|
388 | void GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z ) const; |
---|
389 | |
---|
390 | void SetMapId(uint32 newMap) { m_mapId = newMap; } |
---|
391 | |
---|
392 | uint32 GetMapId() const { return m_mapId; } |
---|
393 | |
---|
394 | uint32 GetZoneId() const; |
---|
395 | uint32 GetAreaId() const; |
---|
396 | |
---|
397 | InstanceData* GetInstanceData(); |
---|
398 | |
---|
399 | const char* GetName() const { return m_name.c_str(); } |
---|
400 | void SetName(std::string newname) { m_name=newname; } |
---|
401 | |
---|
402 | float GetDistance( const WorldObject* obj ) const; |
---|
403 | float GetDistance(const float x, const float y, const float z) const; |
---|
404 | float GetDistance2d(const WorldObject* obj) const; |
---|
405 | float GetDistance2d(const float x, const float y) const; |
---|
406 | float GetDistanceZ(const WorldObject* obj) const; |
---|
407 | bool IsInMap(const WorldObject* obj) const { return GetMapId()==obj->GetMapId() && GetInstanceId()==obj->GetInstanceId(); } |
---|
408 | bool IsWithinDistInMap(const WorldObject* obj, const float dist2compare) const; |
---|
409 | bool IsWithinLOS(const float x, const float y, const float z ) const; |
---|
410 | bool IsWithinLOSInMap(const WorldObject* obj) const; |
---|
411 | |
---|
412 | float GetAngle( const WorldObject* obj ) const; |
---|
413 | float GetAngle( const float x, const float y ) const; |
---|
414 | bool HasInArc( const float arcangle, const WorldObject* obj ) const; |
---|
415 | |
---|
416 | virtual void SendMessageToSet(WorldPacket *data, bool self, bool to_possessor = true); |
---|
417 | virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self, bool to_possessor = true); |
---|
418 | void BuildHeartBeatMsg( WorldPacket *data ) const; |
---|
419 | void BuildTeleportAckMsg( WorldPacket *data, float x, float y, float z, float ang) const; |
---|
420 | bool IsBeingTeleported() { return mSemaphoreTeleport; } |
---|
421 | void SetSemaphoreTeleport(bool semphsetting) { mSemaphoreTeleport = semphsetting; } |
---|
422 | |
---|
423 | void MonsterSay(const char* text, uint32 language, uint64 TargetGuid); |
---|
424 | void MonsterYell(const char* text, uint32 language, uint64 TargetGuid); |
---|
425 | void MonsterTextEmote(const char* text, uint64 TargetGuid, bool IsBossEmote = false); |
---|
426 | void MonsterWhisper(const char* text, uint64 receiver, bool IsBossWhisper = false); |
---|
427 | void MonsterSay(int32 textId, uint32 language, uint64 TargetGuid); |
---|
428 | void MonsterYell(int32 textId, uint32 language, uint64 TargetGuid); |
---|
429 | void MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false); |
---|
430 | void MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper = false); |
---|
431 | void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 TargetGuid) const; |
---|
432 | |
---|
433 | void SendObjectDeSpawnAnim(uint64 guid); |
---|
434 | |
---|
435 | virtual void SaveRespawnTime() {} |
---|
436 | |
---|
437 | uint32 GetInstanceId() const { return m_InstanceId; } |
---|
438 | void SetInstanceId(uint32 val) { m_InstanceId = val; } |
---|
439 | |
---|
440 | void AddObjectToRemoveList(); |
---|
441 | |
---|
442 | // main visibility check function in normal case (ignore grey zone distance check) |
---|
443 | bool isVisibleFor(Player const* u) const { return isVisibleForInState(u,false); } |
---|
444 | |
---|
445 | // low level function for visibility change code, must be define in all main world object subclasses |
---|
446 | virtual bool isVisibleForInState(Player const* u, bool inVisibleList) const = 0; |
---|
447 | |
---|
448 | // Low Level Packets |
---|
449 | void SendPlaySound(uint32 Sound, bool OnlySelf); |
---|
450 | |
---|
451 | Map * GetMap() const; |
---|
452 | Map const* GetBaseMap() const; |
---|
453 | Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime); |
---|
454 | GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime); |
---|
455 | bool isActive() const { return m_isActive; } |
---|
456 | virtual void setActive(bool isActive); |
---|
457 | protected: |
---|
458 | explicit WorldObject(); |
---|
459 | std::string m_name; |
---|
460 | bool m_isActive; |
---|
461 | |
---|
462 | private: |
---|
463 | uint32 m_mapId; |
---|
464 | |
---|
465 | float m_positionX; |
---|
466 | float m_positionY; |
---|
467 | float m_positionZ; |
---|
468 | float m_orientation; |
---|
469 | |
---|
470 | bool mSemaphoreTeleport; |
---|
471 | |
---|
472 | uint32 m_InstanceId; |
---|
473 | }; |
---|
474 | #endif |
---|