[2] | 1 | /* |
---|
[44] | 2 | * Copyright (C) 2008 Trinity <http://www.trinitycore.org/> |
---|
[2] | 3 | * |
---|
[44] | 4 | * Thanks to the original authors: MaNGOS <http://www.mangosproject.org/> |
---|
| 5 | * |
---|
[2] | 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 |
---|
[44] | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
[2] | 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 |
---|
[44] | 18 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
---|
[2] | 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 | |
---|
| 31 | #include <set> |
---|
| 32 | #include <string> |
---|
| 33 | |
---|
| 34 | #define CONTACT_DISTANCE 0.5f |
---|
| 35 | #define INTERACTION_DISTANCE 5 |
---|
| 36 | #define ATTACK_DISTANCE 5 |
---|
| 37 | #define DETECT_DISTANCE 20 // max distance to successful detect stealthed unit |
---|
| 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 | |
---|
| 95 | typedef HM_NAMESPACE::hash_map<Player*, UpdateData> UpdateDataMapType; |
---|
| 96 | |
---|
| 97 | struct WorldLocation |
---|
| 98 | { |
---|
| 99 | uint32 mapid; |
---|
| 100 | float x; |
---|
| 101 | float y; |
---|
| 102 | float z; |
---|
| 103 | float o; |
---|
| 104 | explicit WorldLocation(uint32 mapid = 0, float x = 0, float y = 0, float z = 0, float o = 0) |
---|
| 105 | : mapid(mapid), x(x), y(y), z(z), o(o) {} |
---|
| 106 | WorldLocation(WorldLocation const &loc) |
---|
| 107 | : mapid(loc.mapid), x(loc.x), y(loc.y), z(loc.z), o(loc.o) {} |
---|
| 108 | }; |
---|
| 109 | |
---|
[44] | 110 | class TRINITY_DLL_SPEC Object |
---|
[2] | 111 | { |
---|
| 112 | public: |
---|
| 113 | virtual ~Object ( ); |
---|
| 114 | |
---|
| 115 | const bool& IsInWorld() const { return m_inWorld; } |
---|
| 116 | virtual void AddToWorld() |
---|
| 117 | { |
---|
| 118 | if(m_inWorld) |
---|
| 119 | return; |
---|
| 120 | |
---|
| 121 | m_inWorld = true; |
---|
| 122 | |
---|
| 123 | // synchronize values mirror with values array (changes will send in updatecreate opcode any way |
---|
| 124 | ClearUpdateMask(true); |
---|
| 125 | } |
---|
| 126 | virtual void RemoveFromWorld() |
---|
| 127 | { |
---|
| 128 | // if we remove from world then sending changes not required |
---|
| 129 | if(m_uint32Values) |
---|
| 130 | ClearUpdateMask(true); |
---|
| 131 | m_inWorld = false; |
---|
| 132 | } |
---|
| 133 | |
---|
| 134 | const uint64& GetGUID() const { return GetUInt64Value(0); } |
---|
| 135 | uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); } |
---|
| 136 | uint32 GetGUIDMid() const { return GUID_ENPART(GetUInt64Value(0)); } |
---|
| 137 | uint32 GetGUIDHigh() const { return GUID_HIPART(GetUInt64Value(0)); } |
---|
| 138 | const ByteBuffer& GetPackGUID() const { return m_PackGUID; } |
---|
| 139 | uint32 GetEntry() const { return GetUInt32Value(OBJECT_FIELD_ENTRY); } |
---|
| 140 | |
---|
| 141 | uint8 GetTypeId() const { return m_objectTypeId; } |
---|
| 142 | bool isType(uint16 mask) const { return (mask & m_objectType); } |
---|
| 143 | |
---|
| 144 | virtual void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const; |
---|
| 145 | void SendUpdateToPlayer(Player* player); |
---|
| 146 | |
---|
| 147 | void BuildValuesUpdateBlockForPlayer( UpdateData *data, Player *target ) const; |
---|
| 148 | void BuildOutOfRangeUpdateBlock( UpdateData *data ) const; |
---|
| 149 | void BuildMovementUpdateBlock( UpdateData * data, uint32 flags = 0 ) const; |
---|
| 150 | void BuildUpdate(UpdateDataMapType &); |
---|
| 151 | |
---|
| 152 | virtual void DestroyForPlayer( Player *target ) const; |
---|
| 153 | |
---|
| 154 | const int32& GetInt32Value( uint16 index ) const |
---|
| 155 | { |
---|
| 156 | ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); |
---|
| 157 | return m_int32Values[ index ]; |
---|
| 158 | } |
---|
| 159 | |
---|
| 160 | const uint32& GetUInt32Value( uint16 index ) const |
---|
| 161 | { |
---|
| 162 | ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); |
---|
| 163 | return m_uint32Values[ index ]; |
---|
| 164 | } |
---|
| 165 | |
---|
| 166 | const uint64& GetUInt64Value( uint16 index ) const |
---|
| 167 | { |
---|
| 168 | ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , false) ); |
---|
| 169 | return *((uint64*)&(m_uint32Values[ index ])); |
---|
| 170 | } |
---|
| 171 | |
---|
| 172 | const float& GetFloatValue( uint16 index ) const |
---|
| 173 | { |
---|
| 174 | ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); |
---|
| 175 | return m_floatValues[ index ]; |
---|
| 176 | } |
---|
| 177 | |
---|
| 178 | uint8 GetByteValue( uint16 index, uint8 offset) const |
---|
| 179 | { |
---|
| 180 | ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); |
---|
| 181 | ASSERT( offset < 4 ); |
---|
| 182 | return *(((uint8*)&m_uint32Values[ index ])+offset); |
---|
| 183 | } |
---|
| 184 | |
---|
| 185 | uint8 GetUInt16Value( uint16 index, uint8 offset) const |
---|
| 186 | { |
---|
| 187 | ASSERT( index < m_valuesCount || PrintIndexError( index , false) ); |
---|
| 188 | ASSERT( offset < 2 ); |
---|
| 189 | return *(((uint16*)&m_uint32Values[ index ])+offset); |
---|
| 190 | } |
---|
| 191 | |
---|
| 192 | void SetInt32Value( uint16 index, int32 value ); |
---|
| 193 | void SetUInt32Value( uint16 index, uint32 value ); |
---|
| 194 | void SetUInt64Value( uint16 index, const uint64 &value ); |
---|
| 195 | void SetFloatValue( uint16 index, float value ); |
---|
| 196 | void SetByteValue( uint16 index, uint8 offset, uint8 value ); |
---|
| 197 | void SetUInt16Value( uint16 index, uint8 offset, uint16 value ); |
---|
| 198 | void SetInt16Value( uint16 index, uint8 offset, int16 value ) { SetUInt16Value(index,offset,(uint16)value); } |
---|
| 199 | void SetStatFloatValue( uint16 index, float value); |
---|
| 200 | void SetStatInt32Value( uint16 index, int32 value); |
---|
| 201 | |
---|
| 202 | void ApplyModUInt32Value(uint16 index, int32 val, bool apply); |
---|
| 203 | void ApplyModInt32Value(uint16 index, int32 val, bool apply); |
---|
| 204 | void ApplyModUInt64Value(uint16 index, int32 val, bool apply); |
---|
| 205 | void ApplyModPositiveFloatValue( uint16 index, float val, bool apply); |
---|
| 206 | void ApplyModSignedFloatValue( uint16 index, float val, bool apply); |
---|
| 207 | |
---|
| 208 | void ApplyPercentModFloatValue(uint16 index, float val, bool apply) |
---|
| 209 | { |
---|
| 210 | val = val != -100.0f ? val : -99.9f ; |
---|
| 211 | SetFloatValue(index, GetFloatValue(index) * (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val)) ); |
---|
| 212 | } |
---|
| 213 | |
---|
| 214 | void SetFlag( uint16 index, uint32 newFlag ); |
---|
| 215 | void RemoveFlag( uint16 index, uint32 oldFlag ); |
---|
| 216 | |
---|
| 217 | void ToggleFlag( uint16 index, uint32 flag) |
---|
| 218 | { |
---|
| 219 | if(HasFlag(index, flag)) |
---|
| 220 | RemoveFlag(index, flag); |
---|
| 221 | else |
---|
| 222 | SetFlag(index, flag); |
---|
| 223 | } |
---|
| 224 | |
---|
| 225 | bool HasFlag( uint16 index, uint32 flag ) const |
---|
| 226 | { |
---|
| 227 | ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); |
---|
| 228 | return (m_uint32Values[ index ] & flag) != 0; |
---|
| 229 | } |
---|
| 230 | |
---|
| 231 | void ApplyModFlag( uint16 index, uint32 flag, bool apply) |
---|
| 232 | { |
---|
| 233 | if(apply) SetFlag(index,flag); else RemoveFlag(index,flag); |
---|
| 234 | } |
---|
| 235 | |
---|
| 236 | void SetFlag64( uint16 index, uint64 newFlag ) |
---|
| 237 | { |
---|
| 238 | uint64 oldval = GetUInt64Value(index); |
---|
| 239 | uint64 newval = oldval | newFlag; |
---|
| 240 | SetUInt64Value(index,newval); |
---|
| 241 | } |
---|
| 242 | |
---|
| 243 | void RemoveFlag64( uint16 index, uint64 oldFlag ) |
---|
| 244 | { |
---|
| 245 | uint64 oldval = GetUInt64Value(index); |
---|
| 246 | uint64 newval = oldval & ~oldFlag; |
---|
| 247 | SetUInt64Value(index,newval); |
---|
| 248 | } |
---|
| 249 | |
---|
| 250 | void ToggleFlag64( uint16 index, uint64 flag) |
---|
| 251 | { |
---|
| 252 | if(HasFlag64(index, flag)) |
---|
| 253 | RemoveFlag64(index, flag); |
---|
| 254 | else |
---|
| 255 | SetFlag64(index, flag); |
---|
| 256 | } |
---|
| 257 | |
---|
| 258 | bool HasFlag64( uint16 index, uint64 flag ) const |
---|
| 259 | { |
---|
| 260 | ASSERT( index < m_valuesCount || PrintIndexError( index , false ) ); |
---|
| 261 | return (GetUInt64Value( index ) & flag) != 0; |
---|
| 262 | } |
---|
| 263 | |
---|
| 264 | void ApplyModFlag64( uint16 index, uint64 flag, bool apply) |
---|
| 265 | { |
---|
| 266 | if(apply) SetFlag64(index,flag); else RemoveFlag64(index,flag); |
---|
| 267 | } |
---|
| 268 | |
---|
| 269 | void ClearUpdateMask(bool remove); |
---|
| 270 | void SendUpdateObjectToAllExcept(Player* exceptPlayer); |
---|
| 271 | |
---|
| 272 | bool LoadValues(const char* data); |
---|
| 273 | |
---|
| 274 | uint16 GetValuesCount() const { return m_valuesCount; } |
---|
| 275 | |
---|
| 276 | void InitValues() { _InitValues(); } |
---|
| 277 | |
---|
| 278 | virtual bool hasQuest(uint32 /* quest_id */) const { return false; } |
---|
| 279 | virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; } |
---|
| 280 | protected: |
---|
| 281 | |
---|
| 282 | Object ( ); |
---|
| 283 | |
---|
| 284 | void _InitValues(); |
---|
| 285 | void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh); |
---|
| 286 | |
---|
| 287 | virtual void _SetUpdateBits(UpdateMask *updateMask, Player *target) const; |
---|
| 288 | |
---|
| 289 | virtual void _SetCreateBits(UpdateMask *updateMask, Player *target) const; |
---|
| 290 | void _BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2 ) const; |
---|
| 291 | void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target ) const; |
---|
| 292 | |
---|
| 293 | uint16 m_objectType; |
---|
| 294 | |
---|
| 295 | uint8 m_objectTypeId; |
---|
| 296 | uint8 m_updateFlag; |
---|
| 297 | |
---|
| 298 | union |
---|
| 299 | { |
---|
| 300 | int32 *m_int32Values; |
---|
| 301 | uint32 *m_uint32Values; |
---|
| 302 | float *m_floatValues; |
---|
| 303 | }; |
---|
| 304 | |
---|
| 305 | uint32 *m_uint32Values_mirror; |
---|
| 306 | |
---|
| 307 | uint16 m_valuesCount; |
---|
| 308 | |
---|
| 309 | bool m_objectUpdated; |
---|
| 310 | |
---|
| 311 | private: |
---|
| 312 | bool m_inWorld; |
---|
| 313 | |
---|
| 314 | ByteBuffer m_PackGUID; |
---|
| 315 | |
---|
| 316 | // for output helpfull error messages from asserts |
---|
| 317 | bool PrintIndexError(uint32 index, bool set) const; |
---|
| 318 | Object(const Object&); // prevent generation copy constructor |
---|
| 319 | Object& operator=(Object const&); // prevent generation assigment operator |
---|
| 320 | }; |
---|
| 321 | |
---|
[44] | 322 | class TRINITY_DLL_SPEC WorldObject : public Object |
---|
[2] | 323 | { |
---|
| 324 | public: |
---|
| 325 | virtual ~WorldObject ( ) {} |
---|
| 326 | |
---|
| 327 | virtual void Update ( uint32 /*time_diff*/ ) { } |
---|
| 328 | |
---|
| 329 | void _Create( uint32 guidlow, HighGuid guidhigh, uint32 mapid ); |
---|
| 330 | |
---|
| 331 | void Relocate(float x, float y, float z, float orientation) |
---|
| 332 | { |
---|
| 333 | m_positionX = x; |
---|
| 334 | m_positionY = y; |
---|
| 335 | m_positionZ = z; |
---|
| 336 | m_orientation = orientation; |
---|
| 337 | } |
---|
| 338 | |
---|
| 339 | void Relocate(float x, float y, float z) |
---|
| 340 | { |
---|
| 341 | m_positionX = x; |
---|
| 342 | m_positionY = y; |
---|
| 343 | m_positionZ = z; |
---|
| 344 | } |
---|
| 345 | |
---|
| 346 | void Relocate(WorldLocation const & loc) |
---|
| 347 | { |
---|
| 348 | SetMapId(loc.mapid); |
---|
| 349 | Relocate(loc.x, loc.y, loc.z, loc.o); |
---|
| 350 | } |
---|
| 351 | |
---|
| 352 | void SetOrientation(float orientation) { m_orientation = orientation; } |
---|
| 353 | |
---|
| 354 | float GetPositionX( ) const { return m_positionX; } |
---|
| 355 | float GetPositionY( ) const { return m_positionY; } |
---|
| 356 | float GetPositionZ( ) const { return m_positionZ; } |
---|
| 357 | void GetPosition( float &x, float &y, float &z ) const |
---|
| 358 | { x = m_positionX; y = m_positionY; z = m_positionZ; } |
---|
| 359 | void GetPosition( WorldLocation &loc ) const |
---|
| 360 | { loc.mapid = GetMapId(); GetPosition(loc.x, loc.y, loc.z); loc.o = GetOrientation(); } |
---|
| 361 | float GetOrientation( ) const { return m_orientation; } |
---|
| 362 | void GetNearPoint2D( float &x, float &y, float distance, float absAngle) const; |
---|
| 363 | void GetNearPoint( WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d,float absAngle) const; |
---|
| 364 | void GetClosePoint(float &x, float &y, float &z, float size, float distance2d = 0, float angle = 0) const |
---|
| 365 | { |
---|
| 366 | // angle calculated from current orientation |
---|
| 367 | GetNearPoint(NULL,x,y,z,size,distance2d,GetOrientation() + angle); |
---|
| 368 | } |
---|
| 369 | void GetContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const |
---|
| 370 | { |
---|
| 371 | // angle to face `obj` to `this` using distance includes size of `obj` |
---|
| 372 | GetNearPoint(obj,x,y,z,obj->GetObjectSize(),distance2d,GetAngle( obj )); |
---|
| 373 | } |
---|
| 374 | |
---|
| 375 | float GetObjectSize() const |
---|
| 376 | { |
---|
| 377 | return ( m_valuesCount > UNIT_FIELD_BOUNDINGRADIUS ) ? m_floatValues[UNIT_FIELD_BOUNDINGRADIUS] : DEFAULT_WORLD_OBJECT_SIZE; |
---|
| 378 | } |
---|
| 379 | bool IsPositionValid() const; |
---|
| 380 | void UpdateGroundPositionZ(float x, float y, float &z) const; |
---|
| 381 | |
---|
| 382 | void GetRandomPoint( float x, float y, float z, float distance, float &rand_x, float &rand_y, float &rand_z ) const; |
---|
| 383 | |
---|
| 384 | void SetMapId(uint32 newMap) { m_mapId = newMap; } |
---|
| 385 | |
---|
| 386 | uint32 GetMapId() const { return m_mapId; } |
---|
| 387 | |
---|
| 388 | uint32 GetZoneId() const; |
---|
| 389 | uint32 GetAreaId() const; |
---|
| 390 | |
---|
| 391 | InstanceData* GetInstanceData(); |
---|
| 392 | |
---|
| 393 | const char* GetName() const { return m_name.c_str(); } |
---|
| 394 | void SetName(std::string newname) { m_name=newname; } |
---|
| 395 | |
---|
| 396 | float GetDistance( const WorldObject* obj ) const; |
---|
| 397 | float GetDistance(const float x, const float y, const float z) const; |
---|
| 398 | float GetDistance2d(const WorldObject* obj) const; |
---|
| 399 | float GetDistance2d(const float x, const float y) const; |
---|
| 400 | float GetDistanceZ(const WorldObject* obj) const; |
---|
| 401 | bool IsInMap(const WorldObject* obj) const { return GetMapId()==obj->GetMapId() && GetInstanceId()==obj->GetInstanceId(); } |
---|
| 402 | bool IsWithinDistInMap(const WorldObject* obj, const float dist2compare) const; |
---|
| 403 | bool IsWithinLOS(const float x, const float y, const float z ) const; |
---|
| 404 | bool IsWithinLOSInMap(const WorldObject* obj) const; |
---|
| 405 | |
---|
| 406 | float GetAngle( const WorldObject* obj ) const; |
---|
| 407 | float GetAngle( const float x, const float y ) const; |
---|
| 408 | bool HasInArc( const float arcangle, const WorldObject* obj ) const; |
---|
| 409 | |
---|
| 410 | virtual void SendMessageToSet(WorldPacket *data, bool self); |
---|
| 411 | virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self); |
---|
| 412 | void BuildHeartBeatMsg( WorldPacket *data ) const; |
---|
| 413 | void BuildTeleportAckMsg( WorldPacket *data, float x, float y, float z, float ang) const; |
---|
| 414 | bool IsBeingTeleported() { return mSemaphoreTeleport; } |
---|
| 415 | void SetSemaphoreTeleport(bool semphsetting) { mSemaphoreTeleport = semphsetting; } |
---|
| 416 | |
---|
| 417 | void MonsterSay(const char* text, uint32 language, uint64 TargetGuid); |
---|
| 418 | void MonsterYell(const char* text, uint32 language, uint64 TargetGuid); |
---|
| 419 | void MonsterTextEmote(const char* text, uint64 TargetGuid, bool IsBossEmote = false); |
---|
| 420 | void MonsterWhisper(const char* text, uint64 receiver, bool IsBossWhisper = false); |
---|
| 421 | void MonsterSay(int32 textId, uint32 language, uint64 TargetGuid); |
---|
| 422 | void MonsterYell(int32 textId, uint32 language, uint64 TargetGuid); |
---|
| 423 | void MonsterTextEmote(int32 textId, uint64 TargetGuid, bool IsBossEmote = false); |
---|
| 424 | void MonsterWhisper(int32 textId, uint64 receiver, bool IsBossWhisper = false); |
---|
| 425 | void BuildMonsterChat(WorldPacket *data, uint8 msgtype, char const* text, uint32 language, char const* name, uint64 TargetGuid) const; |
---|
| 426 | |
---|
| 427 | void SendObjectDeSpawnAnim(uint64 guid); |
---|
| 428 | |
---|
| 429 | virtual void SaveRespawnTime() {} |
---|
| 430 | |
---|
| 431 | uint32 GetInstanceId() const { return m_InstanceId; } |
---|
| 432 | void SetInstanceId(uint32 val) { m_InstanceId = val; } |
---|
| 433 | |
---|
| 434 | void AddObjectToRemoveList(); |
---|
| 435 | |
---|
| 436 | // main visibility check function in normal case (ignore grey zone distance check) |
---|
| 437 | bool isVisibleFor(Player const* u) const { return isVisibleForInState(u,false); } |
---|
| 438 | |
---|
| 439 | // low level function for visibility change code, must be define in all main world object subclasses |
---|
| 440 | virtual bool isVisibleForInState(Player const* u, bool inVisibleList) const = 0; |
---|
| 441 | |
---|
[12] | 442 | // Low Level Packets |
---|
| 443 | void SendPlaySound(uint32 Sound, bool OnlySelf); |
---|
| 444 | |
---|
[2] | 445 | Map * GetMap() const; |
---|
| 446 | Map const* GetBaseMap() const; |
---|
| 447 | Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime); |
---|
| 448 | |
---|
| 449 | protected: |
---|
| 450 | explicit WorldObject(); |
---|
| 451 | std::string m_name; |
---|
| 452 | |
---|
| 453 | private: |
---|
| 454 | uint32 m_mapId; |
---|
| 455 | |
---|
| 456 | float m_positionX; |
---|
| 457 | float m_positionY; |
---|
| 458 | float m_positionZ; |
---|
| 459 | float m_orientation; |
---|
| 460 | |
---|
| 461 | bool mSemaphoreTeleport; |
---|
| 462 | |
---|
| 463 | uint32 m_InstanceId; |
---|
| 464 | }; |
---|
| 465 | #endif |
---|