TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Object Class Referenceabstract

#include <Object.h>

Public Member Functions

virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid constGetGUID () const
 
PackedGuid constGetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
virtual void DestroyForPlayer (Player *target) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid constGetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetGuidValue (uint16 index, ObjectGuid const &value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid const &value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid const &value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt16Value (uint16 index, uint8 offset, int16 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void ToggleByteFlag (uint16 index, uint8 offset, uint8 flag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
std::vector< uint32 > constGetDynamicValues (uint16 index) const
 
void AddDynamicValue (uint16 index, uint32 value)
 
void RemoveDynamicValue (uint16 index, uint32 value)
 
void ClearDynamicValue (uint16 index)
 
void SetDynamicValue (uint16 index, uint8 offset, uint32 value)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
virtual void BuildUpdate (UpdateDataMapType &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player constToPlayer () const
 
CreatureToCreature ()
 
Creature constToCreature () const
 
UnitToUnit ()
 
Unit constToUnit () const
 
GameObjectToGameObject ()
 
GameObject constToGameObject () const
 
CorpseToCorpse ()
 
Corpse constToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject constToDynObject () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger constToAreaTrigger () const
 

Protected Member Functions

 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid const &guid)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
void _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
uint32 GetDynamicUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint32 flags) const
 
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
virtual void BuildDynamicValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
virtual void AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 

Protected Attributes

uint16 m_objectType
 
TypeID m_objectTypeId
 
uint32 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
std::vector< uint32 > * _dynamicValues
 
UpdateMask _changesMask
 
UpdateMask _dynamicChangesMask
 
UpdateMask_dynamicChangesArrayMask
 
uint16 m_valuesCount
 
uint16 _dynamicValuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Private Member Functions

bool PrintIndexError (uint32 index, bool set) const
 
 Object (Object const &right)=delete
 
Objectoperator= (Object const &right)=delete
 

Private Attributes

bool m_inWorld
 
PackedGuid m_PackGUID
 

Constructor & Destructor Documentation

Object::~Object ( )
virtual
83 {
84  if (IsInWorld())
85  {
86  TC_LOG_FATAL("misc", "Object::~Object %s deleted but still in world!!", GetGUID().ToString().c_str());
87  if (isType(TYPEMASK_ITEM))
88  TC_LOG_FATAL("misc", "Item slot %u", ((Item*)this)->GetSlot());
89  ABORT();
90  }
91 
92  if (m_objectUpdated)
93  {
94  TC_LOG_FATAL("misc", "Object::~Object %s deleted but still in update list!!", GetGUID().ToString().c_str());
95  ABORT();
96  }
97 
98  delete[] m_uint32Values;
99  m_uint32Values = nullptr;
100 
101  delete[] _dynamicValues;
102  _dynamicValues = nullptr;
103 
104  delete[] _dynamicChangesArrayMask;
105  _dynamicChangesArrayMask = nullptr;
106 }
bool m_objectUpdated
Definition: Object.h:254
Definition: ObjectGuid.h:47
uint32 * m_uint32Values
Definition: Object.h:235
bool isType(uint16 mask) const
Definition: Object.h:114
string ToString(int i)
Definition: strutil.h:491
UpdateMask * _dynamicChangesArrayMask
Definition: Object.h:243
Definition: Item.h:259
ObjectGuid const & GetGUID() const
Definition: Object.h:105
std::vector< uint32 > * _dynamicValues
Definition: Object.h:239
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:210
#define ABORT
Definition: Errors.h:56
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

Object::Object ( )
protected
51 {
55 
56  m_uint32Values = nullptr;
57  _dynamicValues = nullptr;
58  _dynamicChangesArrayMask = nullptr;
59  m_valuesCount = 0;
62 
63  m_inWorld = false;
64  m_objectUpdated = false;
65 }
Definition: UpdateData.h:38
bool m_objectUpdated
Definition: Object.h:254
bool m_inWorld
Definition: Object.h:257
uint32 * m_uint32Values
Definition: Object.h:235
uint16 _dynamicValuesCount
Definition: Object.h:246
Definition: ObjectGuid.h:46
uint16 m_objectType
Definition: Object.h:227
TypeID m_objectTypeId
Definition: Object.h:229
UpdateMask * _dynamicChangesArrayMask
Definition: Object.h:243
Definition: UpdateFieldFlags.h:34
Definition: ObjectGuid.h:29
std::vector< uint32 > * _dynamicValues
Definition: Object.h:239
uint16 m_valuesCount
Definition: Object.h:245
uint32 m_updateFlag
Definition: Object.h:230
uint16 _fieldNotifyFlags
Definition: Object.h:248
Object::Object ( Object const right)
privatedelete

Member Function Documentation

std::string Object::_ConcatFields ( uint16  startIndex,
uint16  size 
) const
protected
135 {
136  std::ostringstream ss;
137  for (uint16 index = 0; index < size; ++index)
138  ss << GetUInt32Value(index + startIndex) << ' ';
139  return ss.str();
140 }
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
uint16_t uint16
Definition: Define.h:151

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::_Create ( ObjectGuid const guid)
protected
126 {
127  if (!m_uint32Values) _InitValues();
128 
131  m_PackGUID.Set(guid);
132 }
uint32 * m_uint32Values
Definition: Object.h:235
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
uint16 m_objectType
Definition: Object.h:227
Definition: UpdateFields.h:28
PackedGuid m_PackGUID
Definition: Object.h:259
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition: Object.cpp:1100
void Set(ObjectGuid const &guid)
Definition: ObjectGuid.cpp:140
Definition: UpdateFields.h:26
void _InitValues()
Definition: Object.cpp:108

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::_InitValues ( )
protected
109 {
111  memset(m_uint32Values, 0, m_valuesCount*sizeof(uint32));
112 
114 
117  {
118  _dynamicValues = new std::vector<uint32>[_dynamicValuesCount];
120  }
121 
122  m_objectUpdated = false;
123 }
bool m_objectUpdated
Definition: Object.h:254
Definition: UpdateMask.h:26
UpdateMask _changesMask
Definition: Object.h:241
uint32 * m_uint32Values
Definition: Object.h:235
uint16 _dynamicValuesCount
Definition: Object.h:246
UpdateMask _dynamicChangesMask
Definition: Object.h:242
UpdateMask * _dynamicChangesArrayMask
Definition: Object.h:243
uint32_t uint32
Definition: Define.h:150
std::vector< uint32 > * _dynamicValues
Definition: Object.h:239
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:67
uint16 m_valuesCount
Definition: Object.h:245

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::_LoadIntoDataField ( std::string const data,
uint32  startOffset,
uint32  count 
)
protected
967 {
968  if (data.empty())
969  return;
970 
971  Tokenizer tokens(data, ' ', count);
972 
973  if (tokens.size() != count)
974  return;
975 
976  for (uint32 index = 0; index < count; ++index)
977  {
978  m_uint32Values[startOffset + index] = atoul(tokens[index]);
979  _changesMask.SetBit(startOffset + index);
980  }
981 }
UpdateMask _changesMask
Definition: Object.h:241
uint32 * m_uint32Values
Definition: Object.h:235
Definition: Util.h:45
unsigned long atoul(char const *str)
Definition: Common.h:90
uint32_t uint32
Definition: Define.h:150
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::AddDynamicValue ( uint16  index,
uint32  value 
)
1345 {
1346  ASSERT(index < _dynamicValuesCount || PrintIndexError(index, false));
1347 
1348  std::vector<uint32>& values = _dynamicValues[index];
1349  UpdateMask& mask = _dynamicChangesArrayMask[index];
1350 
1351  _dynamicChangesMask.SetBit(index);
1352  if (values.size() >= values.capacity())
1353  values.reserve(values.capacity() + 32);
1354 
1355  values.push_back(value);
1356  if (mask.GetCount() < values.size())
1357  mask.AddBlock();
1358 
1359  mask.SetBit(values.size() - 1);
1360 
1362 }
Definition: UpdateMask.h:26
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint16 _dynamicValuesCount
Definition: Object.h:246
UpdateMask _dynamicChangesMask
Definition: Object.h:242
void AddBlock()
Definition: UpdateMask.h:84
UpdateMask * _dynamicChangesArrayMask
Definition: Object.h:243
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint32 GetCount() const
Definition: UpdateMask.h:65
std::vector< uint32 > * _dynamicValues
Definition: Object.h:239
#define ASSERT
Definition: Errors.h:55
const FieldDescriptor value
Definition: descriptor.h:1522
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Object::AddGuidValue ( uint16  index,
ObjectGuid const value 
)
1032 {
1033  ASSERT(index + 3 < m_valuesCount || PrintIndexError(index, true));
1034  if (!value.IsEmpty() && ((ObjectGuid*)&(m_uint32Values[index]))->IsEmpty())
1035  {
1036  *((ObjectGuid*)&(m_uint32Values[index])) = value;
1037  _changesMask.SetBit(index);
1038  _changesMask.SetBit(index + 1);
1039  _changesMask.SetBit(index + 2);
1040  _changesMask.SetBit(index + 3);
1041 
1043  return true;
1044  }
1045 
1046  return false;
1047 }
UpdateMask _changesMask
Definition: Object.h:241
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: ObjectGuid.h:189
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void Object::AddToObjectUpdate ( )
protectedpure virtual

Implemented in WorldObject, and Item.

+ Here is the caller graph for this function:

void Object::AddToObjectUpdateIfNeeded ( )
protected
821 {
822  if (m_inWorld && !m_objectUpdated)
823  {
825  m_objectUpdated = true;
826  }
827 }
bool m_objectUpdated
Definition: Object.h:254
bool m_inWorld
Definition: Object.h:257
virtual void AddToObjectUpdate()=0

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::AddToWorld ( )
virtual

Reimplemented in Unit, GameObject, Creature, Corpse, Pet, DynamicObject, Bag, and AreaTrigger.

143 {
144  if (m_inWorld)
145  return;
146 
148 
149  m_inWorld = true;
150 
151  // synchronize values mirror with values array (changes will send in updatecreate opcode any way
153  ClearUpdateMask(false);
154 }
bool m_objectUpdated
Definition: Object.h:254
void ClearUpdateMask(bool remove)
Definition: Object.cpp:829
bool m_inWorld
Definition: Object.h:257
uint32 * m_uint32Values
Definition: Object.h:235
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::ApplyModFlag ( uint16  index,
uint32  flag,
bool  apply 
)
1248 {
1249  if (apply) SetFlag(index, flag); else RemoveFlag(index, flag);
1250 }
void SetFlag(uint16 index, uint32 newFlag)
Definition: Object.cpp:1199
void apply(T *val)
Definition: ByteConverter.h:41
void RemoveFlag(uint16 index, uint32 oldFlag)
Definition: Object.cpp:1214

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::ApplyModFlag64 ( uint16  index,
uint64  flag,
bool  apply 
)
1334 {
1335  if (apply) SetFlag64(index, flag); else RemoveFlag64(index, flag);
1336 }
void apply(T *val)
Definition: ByteConverter.h:41
void SetFlag64(uint16 index, uint64 newFlag)
Definition: Object.cpp:1305
void RemoveFlag64(uint16 index, uint64 oldFlag)
Definition: Object.cpp:1312

+ Here is the call graph for this function:

void Object::ApplyModInt32Value ( uint16  index,
int32  val,
bool  apply 
)
1161 {
1162  int32 cur = GetInt32Value(index);
1163  cur += (apply ? val : -val);
1164  SetInt32Value(index, cur);
1165 }
void SetInt32Value(uint16 index, int32 value)
Definition: Object.cpp:983
void apply(T *val)
Definition: ByteConverter.h:41
int32 GetInt32Value(uint16 index) const
Definition: Object.cpp:294
int32_t int32
Definition: Define.h:146

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::ApplyModPositiveFloatValue ( uint16  index,
float  val,
bool  apply 
)
1191 {
1192  float cur = GetFloatValue(index);
1193  cur += (apply ? val : -val);
1194  if (cur < 0)
1195  cur = 0;
1196  SetFloatValue(index, cur);
1197 }
void apply(T *val)
Definition: ByteConverter.h:41
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067

+ Here is the call graph for this function:

void Object::ApplyModSignedFloatValue ( uint16  index,
float  val,
bool  apply 
)
1177 {
1178  float cur = GetFloatValue(index);
1179  cur += (apply ? val : -val);
1180  SetFloatValue(index, cur);
1181 }
void apply(T *val)
Definition: ByteConverter.h:41
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::ApplyModUInt16Value ( uint16  index,
uint8  offset,
int16  val,
bool  apply 
)
1168 {
1169  int16 cur = GetUInt16Value(index, offset);
1170  cur += (apply ? val : -val);
1171  if (cur < 0)
1172  cur = 0;
1173  SetUInt16Value(index, offset, cur);
1174 }
uint16 GetUInt16Value(uint16 index, uint8 offset) const
Definition: Object.cpp:325
void apply(T *val)
Definition: ByteConverter.h:41
void SetUInt16Value(uint16 index, uint8 offset, uint16 value)
Definition: Object.cpp:1100
int16_t int16
Definition: Define.h:147

+ Here is the call graph for this function:

void Object::ApplyModUInt32Value ( uint16  index,
int32  val,
bool  apply 
)
1152 {
1153  int32 cur = GetUInt32Value(index);
1154  cur += (apply ? val : -val);
1155  if (cur < 0)
1156  cur = 0;
1157  SetUInt32Value(index, cur);
1158 }
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
void apply(T *val)
Definition: ByteConverter.h:41
int32_t int32
Definition: Define.h:146

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::ApplyPercentModFloatValue ( uint16  index,
float  val,
bool  apply 
)
1184 {
1185  float value = GetFloatValue(index);
1186  ApplyPercentModFloatVar(value, val, apply);
1187  SetFloatValue(index, value);
1188 }
void apply(T *val)
Definition: ByteConverter.h:41
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312
void ApplyPercentModFloatVar(float &var, float val, bool apply)
Definition: Util.h:83
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067
const FieldDescriptor value
Definition: descriptor.h:1522

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::BuildCreateUpdateBlockForPlayer ( UpdateData data,
Player target 
) const
virtual

lower flag1

Reimplemented in Bag.

168 {
169  if (!target)
170  return;
171 
172  uint8 updateType = UPDATETYPE_CREATE_OBJECT;
174 
176  if (target == this) // building packet for yourself
177  flags |= UPDATEFLAG_SELF;
178 
179  switch (GetGUID().GetHigh())
180  {
181  case HighGuid::Player:
182  case HighGuid::Pet:
183  case HighGuid::Corpse:
186  updateType = UPDATETYPE_CREATE_OBJECT2;
187  break;
188  case HighGuid::Creature:
189  case HighGuid::Vehicle:
190  {
191  if (TempSummon const* summon = ToUnit()->ToTempSummon())
192  if (summon->GetSummonerGUID().IsPlayer())
193  updateType = UPDATETYPE_CREATE_OBJECT2;
194 
195  break;
196  }
198  {
200  updateType = UPDATETYPE_CREATE_OBJECT2;
201  break;
202  }
203  default:
204  break;
205  }
206 
207  if (WorldObject const* worldObject = dynamic_cast<WorldObject const*>(this))
208  {
209  if (!(flags & UPDATEFLAG_LIVING))
210  if (!worldObject->m_movementInfo.transport.guid.IsEmpty())
212 
213  if (worldObject->GetAIAnimKitId() || worldObject->GetMovementAnimKitId() || worldObject->GetMeleeAnimKitId())
214  flags |= UPDATEFLAG_ANIMKITS;
215  }
216 
217  if (flags & UPDATEFLAG_STATIONARY_POSITION)
218  {
219  // UPDATETYPE_CREATE_OBJECT2 for some gameobject types...
221  {
222  switch (ToGameObject()->GetGoType())
223  {
228  updateType = UPDATETYPE_CREATE_OBJECT2;
229  break;
230  default:
231  break;
232  }
233  }
234  }
235 
236  if (Unit const* unit = ToUnit())
237  if (unit->GetVictim())
238  flags |= UPDATEFLAG_HAS_TARGET;
239 
240  ByteBuffer buf(0x400);
241  buf << uint8(updateType);
242  buf << GetPackGUID();
243  buf << uint8(m_objectTypeId);
244 
245  BuildMovementUpdate(&buf, flags);
246  BuildValuesUpdate(updateType, &buf, target);
247  BuildDynamicValuesUpdate(updateType, &buf, target);
248  data->AddUpdateBlock(buf);
249 }
bool IsPlayer() const
Definition: ObjectGuid.h:249
Definition: UpdateData.h:39
Definition: UpdateData.h:32
Definition: ByteBuffer.h:70
Definition: TemporarySummon.h:40
void BuildMovementUpdate(ByteBuffer *data, uint32 flags) const
Definition: Object.cpp:338
bool isType(uint16 mask) const
Definition: Object.h:114
Definition: UpdateData.h:31
Definition: UpdateData.h:45
Definition: SharedDefines.h:2091
virtual void BuildDynamicValuesUpdate(uint8 updatetype, ByteBuffer *data, Player *target) const
Definition: Object.cpp:777
Definition: UpdateData.h:41
Definition: Object.h:423
Definition: UpdateData.h:47
GameObject * ToGameObject()
Definition: Object.h:200
Definition: SharedDefines.h:2081
Definition: ObjectGuid.h:51
TypeID m_objectTypeId
Definition: Object.h:229
Definition: SharedDefines.h:2089
uint32_t uint32
Definition: Define.h:150
PackedGuid const & GetPackGUID() const
Definition: Object.h:106
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:925
Definition: UpdateData.h:42
uint8_t uint8
Definition: g3dmath.h:164
ObjectGuid const & GetGUID() const
Definition: Object.h:105
void AddUpdateBlock(const ByteBuffer &block)
Definition: UpdateData.cpp:37
GameobjectTypes GetGoType() const
Definition: GameObject.h:964
virtual void BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, Player *target) const
Definition: Object.cpp:749
uint8_t uint8
Definition: Define.h:152
Definition: UpdateData.h:43
uint8 flags
Definition: DisableMgr.cpp:44
Definition: Unit.h:1305
Definition: SharedDefines.h:2071
Unit * ToUnit()
Definition: Object.h:197
uint32 m_updateFlag
Definition: Object.h:230

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::BuildDynamicValuesUpdate ( uint8  updatetype,
ByteBuffer data,
Player target 
) const
protectedvirtual

Reimplemented in Item.

778 {
779  if (!target)
780  return;
781 
782  ByteBuffer fieldBuffer;
783  UpdateMask updateMask;
784  updateMask.SetCount(_dynamicValuesCount);
785 
786  uint32* flags = nullptr;
787  uint32 visibleFlag = GetDynamicUpdateFieldData(target, flags);
788 
789  for (uint16 index = 0; index < _dynamicValuesCount; ++index)
790  {
791  ByteBuffer buffer;
792  std::vector<uint32> const& values = _dynamicValues[index];
793  if (_fieldNotifyFlags & flags[index] ||
794  ((updateType == UPDATETYPE_VALUES ? _dynamicChangesMask.GetBit(index) : !values.empty()) && (flags[index] & visibleFlag)))
795  {
796  updateMask.SetBit(index);
797 
798  UpdateMask arrayMask;
799  arrayMask.SetCount(values.size());
800  for (std::size_t v = 0; v < values.size(); ++v)
801  {
802  if (updateType != UPDATETYPE_VALUES || _dynamicChangesArrayMask[index].GetBit(v))
803  {
804  arrayMask.SetBit(v);
805  buffer << uint32(values[v]);
806  }
807  }
808 
809  fieldBuffer << uint8(arrayMask.GetBlockCount());
810  arrayMask.AppendToPacket(&fieldBuffer);
811  fieldBuffer.append(buffer);
812  }
813  }
814 
815  *data << uint8(updateMask.GetBlockCount());
816  updateMask.AppendToPacket(data);
817  data->append(fieldBuffer);
818 }
Definition: UpdateMask.h:26
Definition: ByteBuffer.h:70
uint16 _dynamicValuesCount
Definition: Object.h:246
uint32 GetBlockCount() const
Definition: UpdateMask.h:64
UpdateMask _dynamicChangesMask
Definition: Object.h:242
void AppendToPacket(ByteBuffer *data)
Definition: UpdateMask.h:51
uint32 GetDynamicUpdateFieldData(Player const *target, uint32 *&flags) const
Definition: Object.cpp:921
UpdateMask * _dynamicChangesArrayMask
Definition: Object.h:243
uint32_t uint32
Definition: Define.h:150
uint16_t uint16
Definition: Define.h:151
void append(T value)
Definition: ByteBuffer.h:143
uint8_t uint8
Definition: g3dmath.h:164
std::vector< uint32 > * _dynamicValues
Definition: Object.h:239
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:67
bool GetBit(uint32 index) const
Definition: UpdateMask.h:49
uint32_t uint32
Definition: g3dmath.h:168
uint8 flags
Definition: DisableMgr.cpp:44
void SetBit(uint32 index)
Definition: UpdateMask.h:47
Definition: UpdateData.h:30
uint16 _fieldNotifyFlags
Definition: Object.h:248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::BuildFieldsUpdate ( Player player,
UpdateDataMapType data_map 
) const
845 {
846  UpdateDataMapType::iterator iter = data_map.find(player);
847 
848  if (iter == data_map.end())
849  {
850  std::pair<UpdateDataMapType::iterator, bool> p = data_map.emplace(player, UpdateData(player->GetMapId()));
851  ASSERT(p.second);
852  iter = p.first;
853  }
854 
855  BuildValuesUpdateBlockForPlayer(&iter->second, iter->first);
856 }
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:265
Definition: UpdateData.h:59
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::BuildMovementUpdate ( ByteBuffer data,
uint32  flags 
) const
protected

Use IsTransport() to also handle type 11 (TRANSPORT) Currently grid objects are not updated if there are no nearby players, this causes clients to receive different PathProgress resulting in players seeing the object in a different position

339 {
340  bool NoBirthAnim = false;
341  bool EnablePortals = false;
342  bool PlayHoverAnim = false;
343  bool IsSuppressingGreetings = false;
344  bool HasMovementUpdate = (flags & UPDATEFLAG_LIVING) != 0;
345  bool HasMovementTransport = (flags & UPDATEFLAG_TRANSPORT_POSITION) != 0;
346  bool Stationary = (flags & UPDATEFLAG_STATIONARY_POSITION) != 0;
347  bool CombatVictim = (flags & UPDATEFLAG_HAS_TARGET) != 0;
348  bool ServerTime = (flags & UPDATEFLAG_TRANSPORT) != 0;
349  bool VehicleCreate = (flags & UPDATEFLAG_VEHICLE) != 0;
350  bool AnimKitCreate = (flags & UPDATEFLAG_ANIMKITS) != 0;
351  bool Rotation = (flags & UPDATEFLAG_ROTATION) != 0;
352  bool HasAreaTrigger = false;
353  bool HasGameObject = false;
354  bool ThisIsYou = (flags & UPDATEFLAG_SELF) != 0;
355  bool ReplaceActive = false;
356  bool SceneObjCreate = false;
357  bool ScenePendingInstances = false;
358  uint32 PauseTimesCount = 0;
359  if (GameObject const* go = ToGameObject())
360  if (go->GetGoType() == GAMEOBJECT_TYPE_TRANSPORT)
361  PauseTimesCount = go->GetGOValue()->Transport.StopFrames->size();
362 
363  data->WriteBit(NoBirthAnim);
364  data->WriteBit(EnablePortals);
365  data->WriteBit(PlayHoverAnim);
366  data->WriteBit(IsSuppressingGreetings);
367  data->WriteBit(HasMovementUpdate);
368  data->WriteBit(HasMovementTransport);
369  data->WriteBit(Stationary);
370  data->WriteBit(CombatVictim);
371  data->WriteBit(ServerTime);
372  data->WriteBit(VehicleCreate);
373  data->WriteBit(AnimKitCreate);
374  data->WriteBit(Rotation);
375  data->WriteBit(HasAreaTrigger);
376  data->WriteBit(HasGameObject);
377  data->WriteBit(ThisIsYou);
378  data->WriteBit(ReplaceActive);
379  data->WriteBit(SceneObjCreate);
380  data->WriteBit(ScenePendingInstances);
381  *data << uint32(PauseTimesCount);
382 
383  if (HasMovementUpdate)
384  {
385  Unit const* unit = ToUnit();
386  bool HasFallDirection = unit->HasUnitMovementFlag(MOVEMENTFLAG_FALLING);
387  bool HasFall = HasFallDirection || unit->m_movementInfo.jump.fallTime != 0;
388  bool HasSpline = unit->IsSplineEnabled();
389 
390  *data << GetPackGUID(); // MoverGUID
391 
392  *data << uint32(unit->m_movementInfo.time); // MoveIndex
393  *data << float(unit->GetPositionX());
394  *data << float(unit->GetPositionY());
395  *data << float(unit->GetPositionZ());
396  *data << float(unit->GetOrientation());
397 
398  *data << float(unit->m_movementInfo.pitch); // Pitch
399  *data << float(unit->m_movementInfo.splineElevation); // StepUpStartElevation
400 
401  uint32 removeMovementForcesCount = 0;
402  *data << uint32(removeMovementForcesCount); // Count of RemoveForcesIDs
403  *data << uint32(0); // Unknown
404 
405  //for (uint32 i = 0; i < removeMovementForcesCount; ++i)
406  // *data << ObjectGuid(RemoveForcesIDs);
407 
408  data->WriteBits(unit->GetUnitMovementFlags(), 30);
409  data->WriteBits(unit->GetExtraUnitMovementFlags(), 16);
410  data->WriteBit(!unit->m_movementInfo.transport.guid.IsEmpty()); // HasTransport
411  data->WriteBit(HasFall); // HasFall
412  data->WriteBit(HasSpline); // HasSpline - marks that the unit uses spline movement
413  data->WriteBit(0); // HeightChangeFailed
414  data->WriteBit(0); // RemoteTimeValid
415 
416  if (!unit->m_movementInfo.transport.guid.IsEmpty())
417  *data << unit->m_movementInfo.transport;
418 
419  if (HasFall)
420  {
421  *data << uint32(unit->m_movementInfo.jump.fallTime); // Time
422  *data << float(unit->m_movementInfo.jump.zspeed); // JumpVelocity
423 
424  if (data->WriteBit(HasFallDirection))
425  {
426  *data << float(unit->m_movementInfo.jump.sinAngle); // Direction
427  *data << float(unit->m_movementInfo.jump.cosAngle);
428  *data << float(unit->m_movementInfo.jump.xyspeed); // Speed
429  }
430  }
431 
432  *data << float(unit->GetSpeed(MOVE_WALK));
433  *data << float(unit->GetSpeed(MOVE_RUN));
434  *data << float(unit->GetSpeed(MOVE_RUN_BACK));
435  *data << float(unit->GetSpeed(MOVE_SWIM));
436  *data << float(unit->GetSpeed(MOVE_SWIM_BACK));
437  *data << float(unit->GetSpeed(MOVE_FLIGHT));
438  *data << float(unit->GetSpeed(MOVE_FLIGHT_BACK));
439  *data << float(unit->GetSpeed(MOVE_TURN_RATE));
440  *data << float(unit->GetSpeed(MOVE_PITCH_RATE));
441 
442  uint32 MovementForceCount = 0;
443  *data << uint32(MovementForceCount);
444 
445  //for (uint32 i = 0; i < MovementForceCount; ++i)
446  //{
447  // *data << ObjectGuid(ID);
448  // *data << Vector3(Direction);
449  // *data << Vector3(force.TransportPosition);
450  // *data << int32(TransportID);
451  // *data << float(Magnitude);
452  // *data << uint8(Type);
453  //}
454 
455  // HasMovementSpline - marks that spline data is present in packet
456  if (data->WriteBit(HasSpline))
458  }
459 
460  if (HasMovementTransport)
461  {
462  WorldObject const* self = static_cast<WorldObject const*>(this);
463  *data << self->m_movementInfo.transport;
464  }
465 
466  if (Stationary)
467  {
468  WorldObject const* self = static_cast<WorldObject const*>(this);
469  *data << float(self->GetStationaryX());
470  *data << float(self->GetStationaryY());
471  *data << float(self->GetStationaryZ());
472  *data << float(self->GetStationaryO());
473  }
474 
475  if (CombatVictim)
476  *data << ToUnit()->GetVictim()->GetGUID(); // CombatVictim
477 
478  if (ServerTime)
479  {
480  GameObject const* go = ToGameObject();
486  if (go && go->ToTransport()) // ServerTime
487  *data << uint32(go->GetGOValue()->Transport.PathProgress);
488  else
489  *data << uint32(getMSTime());
490  }
491 
492  if (VehicleCreate)
493  {
494  Unit const* unit = ToUnit();
495  *data << uint32(unit->GetVehicleKit()->GetVehicleInfo()->ID); // RecID
496  *data << float(unit->GetOrientation()); // InitialRawFacing
497  }
498 
499  if (AnimKitCreate)
500  {
501  WorldObject const* self = static_cast<WorldObject const*>(this);
502  *data << uint16(self->GetAIAnimKitId()); // AiID
503  *data << uint16(self->GetMovementAnimKitId()); // MovementID
504  *data << uint16(self->GetMeleeAnimKitId()); // MeleeID
505  }
506 
507  if (Rotation)
508  *data << uint64(ToGameObject()->GetRotation()); // Rotation
509 
510  //if (AreaTrigger)
511  //{
512  // packet.ReadInt32("ElapsedMs", index);
513 
514  // packet.ReadVector3("RollPitchYaw1", index);
515 
516  // packet.ResetBitReader();
517 
518  // var HasAbsoluteOrientation = packet.ReadBit("HasAbsoluteOrientation", index);
519  // var HasDynamicShape = packet.ReadBit("HasDynamicShape", index);
520  // var HasAttached = packet.ReadBit("HasAttached", index);
521  // var HasFaceMovementDir = packet.ReadBit("HasFaceMovementDir", index);
522  // var HasFollowsTerrain = packet.ReadBit("HasFollowsTerrain", index);
523  // var HasTargetRollPitchYaw = packet.ReadBit("HasTargetRollPitchYaw", index);
524  // var HasScaleCurveID = packet.ReadBit("HasScaleCurveID", index);
525  // var HasMorphCurveID = packet.ReadBit("HasMorphCurveID", index);
526  // var HasFacingCurveID = packet.ReadBit("HasFacingCurveID", index);
527  // var HasMoveCurveID = packet.ReadBit("HasMoveCurveID", index);
528  // var HasAreaTriggerSphere = packet.ReadBit("HasAreaTriggerSphere", index);
529  // var HasAreaTriggerBox = packet.ReadBit("HasAreaTriggerBox", index);
530  // var HasAreaTriggerPolygon = packet.ReadBit("HasAreaTriggerPolygon", index);
531  // var HasAreaTriggerCylinder = packet.ReadBit("HasAreaTriggerCylinder", index);
532  // var HasAreaTriggerSpline = packet.ReadBit("HasAreaTriggerSpline", index);
533 
534  // if (HasTargetRollPitchYaw)
535  // packet.ReadVector3("TargetRollPitchYaw", index);
536 
537  // if (HasScaleCurveID)
538  // packet.ReadInt32("ScaleCurveID, index");
539 
540  // if (HasMorphCurveID)
541  // packet.ReadInt32("MorphCurveID", index);
542 
543  // if (HasFacingCurveID)
544  // packet.ReadInt32("FacingCurveID", index);
545 
546  // if (HasMoveCurveID)
547  // packet.ReadInt32("MoveCurveID", index);
548 
549  // if (HasAreaTriggerSphere)
550  // {
551  // packet.ReadSingle("Radius", index);
552  // packet.ReadSingle("RadiusTarget", index);
553  // }
554 
555  // if (HasAreaTriggerBox)
556  // {
557  // packet.ReadVector3("Extents", index);
558  // packet.ReadVector3("ExtentsTarget", index);
559  // }
560 
561  // if (HasAreaTriggerPolygon)
562  // {
563  // var VerticesCount = packet.ReadInt32("VerticesCount", index);
564  // var VerticesTargetCount = packet.ReadInt32("VerticesTargetCount", index);
565  // packet.ReadSingle("Height", index);
566  // packet.ReadSingle("HeightTarget", index);
567 
568  // for (var i = 0; i < VerticesCount; ++i)
569  // packet.ReadVector2("Vertices", index, i);
570 
571  // for (var i = 0; i < VerticesTargetCount; ++i)
572  // packet.ReadVector2("VerticesTarget", index, i);
573  // }
574 
575  // if (HasAreaTriggerCylinder)
576  // {
577  // packet.ReadSingle("Radius", index);
578  // packet.ReadSingle("RadiusTarget", index);
579  // packet.ReadSingle("Height", index);
580  // packet.ReadSingle("HeightTarget", index);
581  // packet.ReadSingle("Float4", index);
582  // packet.ReadSingle("Float5", index);
583  // }
584 
585  // if (HasAreaTriggerSpline)
586  // {
587  // packet.ReadInt32("TimeToTarget", index);
588  // packet.ReadInt32("ElapsedTimeForMovement", index);
589  // var int8 = packet.ReadInt32("VerticesCount", index);
590 
591  // for (var i = 0; i < int8; ++i)
592  // packet.ReadVector3("Points", index, i);
593  // }
594  //}
595 
596  //if (GameObject)
597  //{
598  // packet.ReadInt32("WorldEffectID", index);
599 
600  // packet.ResetBitReader();
601 
602  // var bit8 = packet.ReadBit("bit8", index);
603  // if (bit8)
604  // packet.ReadInt32("Int1", index);
605  //}
606 
607  //if (SceneObjCreate)
608  //{
609  // packet.ResetBitReader();
610 
611  // var CliSceneLocalScriptData = packet.ReadBit("CliSceneLocalScriptData", index);
612  // var PetBattleFullUpdate = packet.ReadBit("PetBattleFullUpdate", index);
613 
614  // if (CliSceneLocalScriptData)
615  // {
616  // packet.ResetBitReader();
617  // var DataLength = packet.ReadBits(7);
618  // packet.ReadWoWString("Data", DataLength, index);
619  // }
620 
621  // if (PetBattleFullUpdate)
622  // {
623  // for (var i = 0; i < 2; ++i)
624  // {
625  // packet.ReadPackedGuid128("CharacterID", index, i);
626 
627  // packet.ReadInt32("TrapAbilityID", index, i);
628  // packet.ReadInt32("TrapStatus", index, i);
629 
630  // packet.ReadInt16("RoundTimeSecs", index, i);
631 
632  // packet.ReadByte("FrontPet", index, i);
633  // packet.ReadByte("InputFlags", index, i);
634 
635  // packet.ResetBitReader();
636 
637  // var PetBattlePetUpdateCount = packet.ReadBits("PetBattlePetUpdateCount", 2, index, i);
638 
639  // for (var j = 0; j < PetBattlePetUpdateCount; ++j)
640  // {
641  // packet.ReadPackedGuid128("BattlePetGUID", index, i, j);
642 
643  // packet.ReadInt32("SpeciesID", index, i, j);
644  // packet.ReadInt32("DisplayID", index, i, j);
645  // packet.ReadInt32("CollarID", index, i, j);
646 
647  // packet.ReadInt16("Level", index, i, j);
648  // packet.ReadInt16("Xp", index, i, j);
649 
650 
651  // packet.ReadInt32("CurHealth", index, i, j);
652  // packet.ReadInt32("MaxHealth", index, i, j);
653  // packet.ReadInt32("Power", index, i, j);
654  // packet.ReadInt32("Speed", index, i, j);
655  // packet.ReadInt32("NpcTeamMemberID", index, i, j);
656 
657  // packet.ReadInt16("BreedQuality", index, i, j);
658  // packet.ReadInt16("StatusFlags", index, i, j);
659 
660  // packet.ReadByte("Slot", index, i, j);
661 
662  // var PetBattleActiveAbility = packet.ReadInt32("PetBattleActiveAbility", index, i, j);
663  // var PetBattleActiveAura = packet.ReadInt32("PetBattleActiveAura", index, i, j);
664  // var PetBattleActiveState = packet.ReadInt32("PetBattleActiveState", index, i, j);
665 
666  // for (var k = 0; k < PetBattleActiveAbility; ++k)
667  // {
668  // packet.ReadInt32("AbilityID", index, i, j, k);
669  // packet.ReadInt16("CooldownRemaining", index, i, j, k);
670  // packet.ReadInt16("LockdownRemaining", index, i, j, k);
671  // packet.ReadByte("AbilityIndex", index, i, j, k);
672  // packet.ReadByte("Pboid", index, i, j, k);
673  // }
674 
675  // for (var k = 0; k < PetBattleActiveAura; ++k)
676  // {
677  // packet.ReadInt32("AbilityID", index, i, j, k);
678  // packet.ReadInt32("InstanceID", index, i, j, k);
679  // packet.ReadInt32("RoundsRemaining", index, i, j, k);
680  // packet.ReadInt32("CurrentRound", index, i, j, k);
681  // packet.ReadByte("CasterPBOID", index, i, j, k);
682  // }
683 
684  // for (var k = 0; k < PetBattleActiveState; ++k)
685  // {
686  // packet.ReadInt32("StateID", index, i, j, k);
687  // packet.ReadInt32("StateValue", index, i, j, k);
688  // }
689 
690  // packet.ResetBitReader();
691  // var bits57 = packet.ReadBits(7);
692  // packet.ReadWoWString("CustomName", bits57, index, i, j);
693  // }
694  // }
695 
696  // for (var i = 0; i < 3; ++i)
697  // {
698  // var PetBattleActiveAura = packet.ReadInt32("PetBattleActiveAura", index, i);
699  // var PetBattleActiveState = packet.ReadInt32("PetBattleActiveState", index, i);
700 
701  // for (var j = 0; j < PetBattleActiveAura; ++j)
702  // {
703  // packet.ReadInt32("AbilityID", index, i, j);
704  // packet.ReadInt32("InstanceID", index, i, j);
705  // packet.ReadInt32("RoundsRemaining", index, i, j);
706  // packet.ReadInt32("CurrentRound", index, i, j);
707  // packet.ReadByte("CasterPBOID", index, i, j);
708  // }
709 
710  // for (var j = 0; j < PetBattleActiveState; ++j)
711  // {
712  // packet.ReadInt32("StateID", index, i, j);
713  // packet.ReadInt32("StateValue", index, i, j);
714  // }
715  // }
716 
717  // packet.ReadInt16("WaitingForFrontPetsMaxSecs", index);
718  // packet.ReadInt16("PvpMaxRoundTime", index);
719 
720  // packet.ReadInt32("CurRound", index);
721  // packet.ReadInt32("NpcCreatureID", index);
722  // packet.ReadInt32("NpcDisplayID", index);
723 
724  // packet.ReadByte("CurPetBattleState");
725  // packet.ReadByte("ForfeitPenalty");
726 
727  // packet.ReadPackedGuid128("InitialWildPetGUID");
728 
729  // packet.ReadBit("IsPVP");
730  // packet.ReadBit("CanAwardXP");
731  // }
732  //}
733 
734  //if (ScenePendingInstances)
735  //{
736  // var SceneInstanceIDs = packet.ReadInt32("SceneInstanceIDsCount");
737 
738  // for (var i = 0; i < SceneInstanceIDs; ++i)
739  // packet.ReadInt32("SceneInstanceIDs", index, i);
740  //}
741 
742  if (GameObject const* go = ToGameObject())
743  for (uint32 i = 0; i < PauseTimesCount; ++i)
744  *data << uint32(go->GetGOValue()->Transport.StopFrames->at(i));
745 
746  data->FlushBits();
747 }
Definition: UpdateData.h:39
bool HasUnitMovementFlag(uint32 f) const
Definition: Unit.h:2109
Definition: Unit.h:605
VehicleEntry const * GetVehicleInfo() const
Definition: Vehicle.h:50
uint32 fallTime
Definition: Object.h:309
uint32 GetUnitMovementFlags() const
Definition: Unit.h:2110
float GetSpeed(UnitMoveType mtype) const
Definition: Unit.cpp:10526
MovementInfo m_movementInfo
Definition: Object.h:612
Definition: Unit.h:787
float cosAngle
Definition: Object.h:311
Movement::MoveSpline * movespline
Definition: Unit.h:2213
Definition: UpdateData.h:46
uint32 getMSTime()
Definition: Timer.h:24
struct MovementInfo::JumpInfo jump
Definition: UpdateData.h:45
struct GameObjectValue::@273 Transport
void FlushBits()
Definition: ByteBuffer.h:150
Definition: Unit.h:599
uint64_t uint64
Definition: g3dmath.h:170
Definition: UpdateData.h:41
Definition: Object.h:423
Definition: UpdateData.h:47
Definition: Unit.h:601
uint16_t uint16
Definition: g3dmath.h:166
bool WriteBit(uint32 bit)
Definition: ByteBuffer.h:170
GameObject * ToGameObject()
Definition: Object.h:200
struct MovementInfo::TransportInfo transport
uint32 time
Definition: Object.h:274
static void WriteCreateObjectSplineDataBlock(::Movement::MoveSpline const &moveSpline, ByteBuffer &data)
Definition: MovementPackets.cpp:271
Definition: Unit.h:602
float zspeed
Definition: Object.h:311
uint32 ID
Definition: DBCStructure.h:1273
float GetOrientation() const
Definition: Position.h:107
Unit * GetVictim() const
Definition: Unit.h:1379
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
uint32_t uint32
Definition: Define.h:150
float pitch
Definition: Object.h:298
Transport * ToTransport()
Definition: GameObject.h:1073
PackedGuid const & GetPackGUID() const
Definition: Object.h:106
Definition: Unit.h:607
Definition: GameObject.h:880
Definition: UpdateData.h:44
std::vector< uint32 > * StopFrames
Definition: GameObject.h:782
Definition: UpdateData.h:40
float splineElevation
Definition: Object.h:316
float sinAngle
Definition: Object.h:311
Definition: UpdateData.h:42
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: Unit.h:600
bool IsSplineEnabled() const
Definition: Unit.cpp:16132
Definition: Unit.h:604
Definition: UpdateData.h:43
Definition: Unit.h:606
uint32 PathProgress
Definition: GameObject.h:779
ObjectGuid guid
Definition: Object.h:289
Definition: Unit.h:603
GameObjectValue const * GetGOValue() const
Definition: GameObject.h:896
uint32_t uint32
Definition: g3dmath.h:168
uint8 flags
Definition: DisableMgr.cpp:44
#define const
Definition: zconf.h:217
float GetPositionX() const
Definition: Position.h:104
Definition: Unit.h:1305
Definition: SharedDefines.h:2076
Unit * ToUnit()
Definition: Object.h:197
bool IsEmpty() const
Definition: ObjectGuid.h:242
uint16 GetExtraUnitMovementFlags() const
Definition: Unit.h:2116
float xyspeed
Definition: Object.h:311
void WriteBits(T value, int32 bits)
Definition: ByteBuffer.h:198
Vehicle * GetVehicleKit() const
Definition: Unit.h:2165

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::BuildOutOfRangeUpdateBlock ( UpdateData data) const
279 {
280  data->AddOutOfRangeGUID(GetGUID());
281 }
ObjectGuid const & GetGUID() const
Definition: Object.h:105
void AddOutOfRangeGUID(GuidSet &guids)
Definition: UpdateData.cpp:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void Object::BuildUpdate ( UpdateDataMapType )
inlinevirtual

Reimplemented in WorldObject, Item, and Transport.

182 { }

+ Here is the caller graph for this function:

void Object::BuildValuesUpdate ( uint8  updatetype,
ByteBuffer data,
Player target 
) const
protectedvirtual

Reimplemented in Unit, and GameObject.

750 {
751  if (!target)
752  return;
753 
754  ByteBuffer fieldBuffer;
755  UpdateMask updateMask;
756  updateMask.SetCount(m_valuesCount);
757 
758  uint32* flags = NULL;
759  uint32 visibleFlag = GetUpdateFieldData(target, flags);
760  ASSERT(flags);
761 
762  for (uint16 index = 0; index < m_valuesCount; ++index)
763  {
764  if (_fieldNotifyFlags & flags[index] ||
765  ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)))
766  {
767  updateMask.SetBit(index);
768  fieldBuffer << m_uint32Values[index];
769  }
770  }
771 
772  *data << uint8(updateMask.GetBlockCount());
773  updateMask.AppendToPacket(data);
774  data->append(fieldBuffer);
775 }
Definition: UpdateMask.h:26
Definition: ByteBuffer.h:70
UpdateMask _changesMask
Definition: Object.h:241
uint32 * m_uint32Values
Definition: Object.h:235
uint32 GetBlockCount() const
Definition: UpdateMask.h:64
arena_t NULL
Definition: jemalloc_internal.h:624
void AppendToPacket(ByteBuffer *data)
Definition: UpdateMask.h:51
uint32_t uint32
Definition: Define.h:150
uint16_t uint16
Definition: Define.h:151
uint32 GetUpdateFieldData(Player const *target, uint32 *&flags) const
Definition: Object.cpp:858
void append(T value)
Definition: ByteBuffer.h:143
uint8_t uint8
Definition: g3dmath.h:164
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:67
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
bool GetBit(uint32 index) const
Definition: UpdateMask.h:49
uint8 flags
Definition: DisableMgr.cpp:44
void SetBit(uint32 index)
Definition: UpdateMask.h:47
Definition: UpdateData.h:30
uint16 _fieldNotifyFlags
Definition: Object.h:248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::BuildValuesUpdateBlockForPlayer ( UpdateData data,
Player target 
) const
266 {
267  ByteBuffer buf(500);
268 
269  buf << uint8(UPDATETYPE_VALUES);
270  buf << GetPackGUID();
271 
272  BuildValuesUpdate(UPDATETYPE_VALUES, &buf, target);
274 
275  data->AddUpdateBlock(buf);
276 }
Definition: ByteBuffer.h:70
virtual void BuildDynamicValuesUpdate(uint8 updatetype, ByteBuffer *data, Player *target) const
Definition: Object.cpp:777
PackedGuid const & GetPackGUID() const
Definition: Object.h:106
uint8_t uint8
Definition: g3dmath.h:164
void AddUpdateBlock(const ByteBuffer &block)
Definition: UpdateData.cpp:37
virtual void BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, Player *target) const
Definition: Object.cpp:749
Definition: UpdateData.h:30

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::ClearDynamicValue ( uint16  index)
1371 {
1372  ASSERT(index < _dynamicValuesCount || PrintIndexError(index, false));
1373 
1374  if (!_dynamicValues[index].empty())
1375  {
1376  _dynamicValues[index].clear();
1377  _dynamicChangesMask.SetBit(index);
1379 
1381  }
1382 }
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint16 _dynamicValuesCount
Definition: Object.h:246
UpdateMask _dynamicChangesMask
Definition: Object.h:242
UpdateMask * _dynamicChangesArrayMask
Definition: Object.h:243
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
std::vector< uint32 > * _dynamicValues
Definition: Object.h:239
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:67
#define ASSERT
Definition: Errors.h:55
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::ClearUpdateMask ( bool  remove)
830 {
833  for (uint32 i = 0; i < _dynamicValuesCount; ++i)
834  _dynamicChangesArrayMask[i].Clear();
835 
836  if (m_objectUpdated)
837  {
838  if (remove)
840  m_objectUpdated = false;
841  }
842 }
bool m_objectUpdated
Definition: Object.h:254
void Clear()
Definition: UpdateMask.h:99
UpdateMask _changesMask
Definition: Object.h:241
uint16 _dynamicValuesCount
Definition: Object.h:246
UpdateMask _dynamicChangesMask
Definition: Object.h:242
virtual void RemoveFromObjectUpdate()=0
UpdateMask * _dynamicChangesArrayMask
Definition: Object.h:243
uint32_t uint32
Definition: Define.h:150

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::DestroyForPlayer ( Player target) const
virtual

Reimplemented in Unit.

284 {
285  ASSERT(target);
286 
287  UpdateData updateData(target->GetMapId());
288  BuildOutOfRangeUpdateBlock(&updateData);
289  WorldPacket packet;
290  updateData.BuildPacket(&packet);
291  target->SendDirectMessage(&packet);
292 }
Definition: UpdateData.h:59
#define ASSERT
Definition: Errors.h:55
void BuildOutOfRangeUpdateBlock(UpdateData *data) const
Definition: Object.cpp:278
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::ForceValuesUpdateAtIndex ( uint32  i)
2139 {
2140  _changesMask.SetBit(i);
2142 }
UpdateMask _changesMask
Definition: Object.h:241
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint8 Object::GetByteValue ( uint16  index,
uint8  offset 
) const
319 {
320  ASSERT(index < m_valuesCount || PrintIndexError(index, false));
321  ASSERT(offset < 4);
322  return *(((uint8*)&m_uint32Values[index])+offset);
323 }
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
uint8_t uint8
Definition: Define.h:152
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Object::GetDynamicUpdateFieldData ( Player const target,
uint32 *&  flags 
) const
protected
922 {
923  uint32 visibleFlag = UF_FLAG_PUBLIC;
924 
925  if (target == this)
926  visibleFlag |= UF_FLAG_PRIVATE;
927 
928  switch (GetTypeId())
929  {
930  case TYPEID_ITEM:
931  case TYPEID_CONTAINER:
933  if (((Item const*)this)->GetOwnerGUID() == target->GetGUID())
934  visibleFlag |= UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER;
935  break;
936  case TYPEID_UNIT:
937  case TYPEID_PLAYER:
938  {
941  if (ToUnit()->GetOwnerGUID() == target->GetGUID())
942  visibleFlag |= UF_FLAG_OWNER;
943 
945  if (ToUnit()->HasAuraTypeWithCaster(SPELL_AURA_EMPATHY, target->GetGUID()))
946  visibleFlag |= UF_FLAG_SPECIAL_INFO;
947 
948  if (plr && plr->IsInSameRaidWith(target))
949  visibleFlag |= UF_FLAG_PARTY_MEMBER;
950  break;
951  }
952  case TYPEID_GAMEOBJECT:
954  break;
955  case TYPEID_CONVERSATION:
957  break;
958  default:
959  flags = nullptr;
960  break;
961  }
962 
963  return visibleFlag;
964 }
Definition: UpdateFieldFlags.h:32
Definition: ObjectGuid.h:31
bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
Definition: Unit.cpp:4252
Definition: UpdateFieldFlags.h:28
uint32 GameObjectDynamicUpdateFieldFlags[GAMEOBJECT_DYNAMIC_END]
Definition: UpdateFieldFlags.cpp:3912
Definition: UpdateFieldFlags.h:27
Definition: ObjectGuid.h:32
Definition: UpdateFieldFlags.h:31
uint32 ConversationDynamicUpdateFieldFlags[CONVERSATION_DYNAMIC_END]
Definition: UpdateFieldFlags.cpp:4063
TypeID GetTypeId() const
Definition: Object.h:113
Definition: ObjectGuid.h:39
Definition: Item.h:259
Definition: ObjectGuid.h:34
uint32_t uint32
Definition: Define.h:150
Definition: UpdateFieldFlags.h:30
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: SharedDefines.h:4205
uint32 UnitDynamicUpdateFieldFlags[PLAYER_DYNAMIC_END]
Definition: UpdateFieldFlags.cpp:3862
Definition: ObjectGuid.h:33
Definition: UpdateFieldFlags.h:29
Definition: UpdateFields.h:30
uint8 flags
Definition: DisableMgr.cpp:44
Definition: SpellAuraDefines.h:181
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
uint32 ItemDynamicUpdateFieldFlags[CONTAINER_DYNAMIC_END]
Definition: UpdateFieldFlags.cpp:251
Unit * ToUnit()
Definition: Object.h:197
Definition: ObjectGuid.h:30
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:7560

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::vector< uint32 > const & Object::GetDynamicValues ( uint16  index) const
1339 {
1340  ASSERT(index < _dynamicValuesCount || PrintIndexError(index, false));
1341  return _dynamicValues[index];
1342 }
uint16 _dynamicValuesCount
Definition: Object.h:246
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
std::vector< uint32 > * _dynamicValues
Definition: Object.h:239
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Object::GetEntry ( ) const
inline
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Definition: UpdateFields.h:29
float Object::GetFloatValue ( uint16  index) const
313 {
314  ASSERT(index < m_valuesCount || PrintIndexError(index, false));
315  return m_floatValues[index];
316 }
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
float * m_floatValues
Definition: Object.h:236
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ObjectGuid const& Object::GetGUID ( ) const
inline
105 { return GetGuidValue(OBJECT_FIELD_GUID); }
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332
Definition: UpdateFields.h:26
ObjectGuid const & Object::GetGuidValue ( uint16  index) const
333 {
334  ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, false));
335  return *((ObjectGuid*)&(m_uint32Values[index]));
336 }
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
Definition: ObjectGuid.h:189

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 Object::GetInt32Value ( uint16  index) const
295 {
296  ASSERT(index < m_valuesCount || PrintIndexError(index, false));
297  return m_int32Values[index];
298 }
int32 * m_int32Values
Definition: Object.h:234
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float Object::GetObjectScale ( ) const
inline
Definition: UpdateFields.h:31
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312

+ Here is the caller graph for this function:

PackedGuid const& Object::GetPackGUID ( ) const
inline
106 { return m_PackGUID; }
PackedGuid m_PackGUID
Definition: Object.h:259

+ Here is the caller graph for this function:

TypeID Object::GetTypeId ( ) const
inline
113 { return m_objectTypeId; }
TypeID m_objectTypeId
Definition: Object.h:229
uint16 Object::GetUInt16Value ( uint16  index,
uint8  offset 
) const
326 {
327  ASSERT(index < m_valuesCount || PrintIndexError(index, false));
328  ASSERT(offset < 2);
329  return *(((uint16*)&m_uint32Values[index])+offset);
330 }
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16_t uint16
Definition: Define.h:151
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Object::GetUInt32Value ( uint16  index) const
301 {
302  ASSERT(index < m_valuesCount || PrintIndexError(index, false));
303  return m_uint32Values[index];
304 }
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

uint64 Object::GetUInt64Value ( uint16  index) const
307 {
308  ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, false));
309  return *((uint64*)&(m_uint32Values[index]));
310 }
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint64_t uint64
Definition: Define.h:149
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 Object::GetUpdateFieldData ( Player const target,
uint32 *&  flags 
) const
protected
859 {
860  uint32 visibleFlag = UF_FLAG_PUBLIC;
861 
862  if (target == this)
863  visibleFlag |= UF_FLAG_PRIVATE;
864 
865  switch (GetTypeId())
866  {
867  case TYPEID_ITEM:
868  case TYPEID_CONTAINER:
870  if (((Item const*)this)->GetOwnerGUID() == target->GetGUID())
871  visibleFlag |= UF_FLAG_OWNER | UF_FLAG_ITEM_OWNER;
872  break;
873  case TYPEID_UNIT:
874  case TYPEID_PLAYER:
875  {
878  if (ToUnit()->GetOwnerGUID() == target->GetGUID())
879  visibleFlag |= UF_FLAG_OWNER;
880 
882  if (ToUnit()->HasAuraTypeWithCaster(SPELL_AURA_EMPATHY, target->GetGUID()))
883  visibleFlag |= UF_FLAG_SPECIAL_INFO;
884 
885  if (plr && plr->IsInSameRaidWith(target))
886  visibleFlag |= UF_FLAG_PARTY_MEMBER;
887  break;
888  }
889  case TYPEID_GAMEOBJECT:
891  if (ToGameObject()->GetOwnerGUID() == target->GetGUID())
892  visibleFlag |= UF_FLAG_OWNER;
893  break;
896  if (ToDynObject()->GetCasterGUID() == target->GetGUID())
897  visibleFlag |= UF_FLAG_OWNER;
898  break;
899  case TYPEID_CORPSE:
901  if (ToCorpse()->GetOwnerGUID() == target->GetGUID())
902  visibleFlag |= UF_FLAG_OWNER;
903  break;
904  case TYPEID_AREATRIGGER:
906  break;
907  case TYPEID_SCENEOBJECT:
909  break;
910  case TYPEID_CONVERSATION:
912  break;
913  case TYPEID_OBJECT:
914  ABORT();
915  break;
916  }
917 
918  return visibleFlag;
919 }
uint32 ItemUpdateFieldFlags[CONTAINER_END]
Definition: UpdateFieldFlags.cpp:20
uint32 SceneObjectUpdateFieldFlags[SCENEOBJECT_END]
Definition: UpdateFieldFlags.cpp:4023
Definition: UpdateFieldFlags.h:32
ObjectGuid GetOwnerGUID() const
Definition: Corpse.h:67
Definition: ObjectGuid.h:31
bool HasAuraTypeWithCaster(AuraType auratype, ObjectGuid caster) const
Definition: Unit.cpp:4252
Definition: UpdateFieldFlags.h:28
Definition: ObjectGuid.h:36
uint32 GameObjectUpdateFieldFlags[GAMEOBJECT_END]
Definition: UpdateFieldFlags.cpp:3875
Definition: UpdateFieldFlags.h:27
Definition: ObjectGuid.h:32
Definition: UpdateFieldFlags.h:31
DynamicObject * ToDynObject()
Definition: Object.h:206
uint32 DynamicObjectUpdateFieldFlags[DYNAMICOBJECT_END]
Definition: UpdateFieldFlags.cpp:3917
GameObject * ToGameObject()
Definition: Object.h:200
TypeID GetTypeId() const
Definition: Object.h:113
Definition: ObjectGuid.h:37
Definition: ObjectGuid.h:39
Corpse * ToCorpse()
Definition: Object.h:203
Definition: Item.h:259
uint32 ConversationUpdateFieldFlags[CONVERSATION_END]
Definition: UpdateFieldFlags.cpp:4046
Definition: ObjectGuid.h:34
uint32_t uint32
Definition: Define.h:150
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:58
ObjectGuid GetOwnerGUID() const
Definition: GameObject.h:925
Definition: ObjectGuid.h:29
Definition: UpdateFieldFlags.h:30
Definition: ObjectGuid.h:38
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Definition: SharedDefines.h:4205
Definition: ObjectGuid.h:33
Definition: UpdateFieldFlags.h:29
uint32 AreaTriggerUpdateFieldFlags[AREATRIGGER_END]
Definition: UpdateFieldFlags.cpp:3990
#define ABORT
Definition: Errors.h:56
Definition: UpdateFields.h:30
uint8 flags
Definition: DisableMgr.cpp:44
Definition: SpellAuraDefines.h:181
Definition: ObjectGuid.h:35
bool HasFlag(uint16 index, uint32 flag) const
Definition: Object.cpp:1239
uint32 UnitUpdateFieldFlags[PLAYER_END]
Definition: UpdateFieldFlags.cpp:257
Unit * ToUnit()
Definition: Object.h:197
uint32 CorpseUpdateFieldFlags[CORPSE_END]
Definition: UpdateFieldFlags.cpp:3941
Definition: ObjectGuid.h:30
Player * GetCharmerOrOwnerPlayerOrPlayerItself() const
Definition: Unit.cpp:7560

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16 Object::GetValuesCount ( ) const
inline
178 { return m_valuesCount; }
uint16 m_valuesCount
Definition: Object.h:245

+ Here is the caller graph for this function:

bool Object::HasByteFlag ( uint16  index,
uint8  offset,
uint8  flag 
) const
1299 {
1300  ASSERT(index < m_valuesCount || PrintIndexError(index, false));
1301  ASSERT(offset < 4);
1302  return (((uint8*)&m_uint32Values[index])[offset] & flag) != 0;
1303 }
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
uint8_t uint8
Definition: Define.h:152
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Object::HasFlag ( uint16  index,
uint32  flag 
) const
1240 {
1241  if (index >= m_valuesCount && !PrintIndexError(index, false))
1242  return false;
1243 
1244  return (m_uint32Values[index] & flag) != 0;
1245 }
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245

+ Here is the call graph for this function:

bool Object::HasFlag64 ( uint16  index,
uint64  flag 
) const
1328 {
1329  ASSERT(index < m_valuesCount || PrintIndexError(index, false));
1330  return (GetUInt64Value(index) & flag) != 0;
1331 }
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
uint64 GetUInt64Value(uint16 index) const
Definition: Object.cpp:306

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual bool Object::hasInvolvedQuest ( uint32  ) const
inlinevirtual

Reimplemented in GameObject, Creature, and Item.

181 { return false; }

+ Here is the caller graph for this function:

virtual bool Object::hasQuest ( uint32  ) const
inlinevirtual

Reimplemented in GameObject, Creature, and Item.

180 { return false; }
bool Object::IsInWorld ( ) const
inline
100 { return m_inWorld; }
bool m_inWorld
Definition: Object.h:257
bool Object::isType ( uint16  mask) const
inline
114 { return (mask & m_objectType) != 0; }
uint16 m_objectType
Definition: Object.h:227

+ Here is the caller graph for this function:

Object& Object::operator= ( Object const right)
privatedelete
bool Object::PrintIndexError ( uint32  index,
bool  set 
) const
private
1403 {
1404  TC_LOG_ERROR("misc", "Attempt %s non-existed value field: %u (count: %u) for object typeid: %u type mask: %u", (set ? "set value to" : "get value from"), index, m_valuesCount, GetTypeId(), m_objectType);
1405 
1406  // ASSERT must fail after function call
1407  return false;
1408 }
uint16 m_objectType
Definition: Object.h:227
TypeID GetTypeId() const
Definition: Object.h:113
uint16 m_valuesCount
Definition: Object.h:245
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::RemoveByteFlag ( uint16  index,
uint8  offset,
uint8  newFlag 
)
1272 {
1273  ASSERT(index < m_valuesCount || PrintIndexError(index, true));
1274 
1275  if (offset > 3)
1276  {
1277  TC_LOG_ERROR("misc", "Object::RemoveByteFlag: wrong offset %u", offset);
1278  return;
1279  }
1280 
1281  if (uint8(m_uint32Values[index] >> (offset * 8)) & oldFlag)
1282  {
1283  m_uint32Values[index] &= ~uint32(uint32(oldFlag) << (offset * 8));
1284  _changesMask.SetBit(index);
1285 
1287  }
1288 }
UpdateMask _changesMask
Definition: Object.h:241
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint32 * m_uint32Values
Definition: Object.h:235
uint32_t uint32
Definition: Define.h:150
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint8_t uint8
Definition: g3dmath.h:164
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::RemoveDynamicValue ( uint16  index,
uint32  value 
)

TODO: Research if this is actually needed

1365 {
1366  ASSERT(index < _dynamicValuesCount || PrintIndexError(index, false));
1368 }
uint16 _dynamicValuesCount
Definition: Object.h:246
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

void Object::RemoveFieldNotifyFlag ( uint16  flag)
inline
186 { _fieldNotifyFlags &= uint16(~flag); }
uint16_t uint16
Definition: g3dmath.h:166
uint16 _fieldNotifyFlags
Definition: Object.h:248

+ Here is the caller graph for this function:

void Object::RemoveFlag ( uint16  index,
uint32  oldFlag 
)
1215 {
1216  ASSERT(index < m_valuesCount || PrintIndexError(index, true));
1218 
1219  uint32 oldval = m_uint32Values[index];
1220  uint32 newval = oldval & ~oldFlag;
1221 
1222  if (oldval != newval)
1223  {
1224  m_uint32Values[index] = newval;
1225  _changesMask.SetBit(index);
1226 
1228  }
1229 }
UpdateMask _changesMask
Definition: Object.h:241
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint32 * m_uint32Values
Definition: Object.h:235
uint32_t uint32
Definition: Define.h:150
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

void Object::RemoveFlag64 ( uint16  index,
uint64  oldFlag 
)
1313 {
1314  uint64 oldval = GetUInt64Value(index);
1315  uint64 newval = oldval & ~oldFlag;
1316  SetUInt64Value(index, newval);
1317 }
uint64_t uint64
Definition: Define.h:149
void SetUInt64Value(uint16 index, uint64 value)
Definition: Object.cpp:1017
uint64 GetUInt64Value(uint16 index) const
Definition: Object.cpp:306

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void Object::RemoveFromObjectUpdate ( )
protectedpure virtual

Implemented in WorldObject, and Item.

+ Here is the caller graph for this function:

void Object::RemoveFromWorld ( )
virtual

Reimplemented in Unit, GameObject, Creature, WorldObject, Puppet, Minion, Corpse, Pet, TempSummon, DynamicObject, Bag, and AreaTrigger.

157 {
158  if (!m_inWorld)
159  return;
160 
161  m_inWorld = false;
162 
163  // if we remove from world then sending changes not required
164  ClearUpdateMask(true);
165 }
void ClearUpdateMask(bool remove)
Definition: Object.cpp:829
bool m_inWorld
Definition: Object.h:257

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Object::RemoveGuidValue ( uint16  index,
ObjectGuid const value 
)
1050 {
1051  ASSERT(index + 3 < m_valuesCount || PrintIndexError(index, true));
1052  if (!value.IsEmpty() && *((ObjectGuid*)&(m_uint32Values[index])) == value)
1053  {
1054  ((ObjectGuid*)&(m_uint32Values[index]))->Clear();
1055  _changesMask.SetBit(index);
1056  _changesMask.SetBit(index + 1);
1057  _changesMask.SetBit(index + 2);
1058  _changesMask.SetBit(index + 3);
1059 
1061  return true;
1062  }
1063 
1064  return false;
1065 }
UpdateMask _changesMask
Definition: Object.h:241
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
const FieldDescriptor value
Definition: descriptor.h:1522
Definition: ObjectGuid.h:189
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::SendUpdateToPlayer ( Player player)
252 {
253  // send create update to player
254  UpdateData upd(player->GetMapId());
255  WorldPacket packet;
256 
257  if (player->HaveAtClient(this))
258  BuildValuesUpdateBlockForPlayer(&upd, player);
259  else
260  BuildCreateUpdateBlockForPlayer(&upd, player);
261  upd.BuildPacket(&packet);
262  player->GetSession()->SendPacket(&packet);
263 }
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:265
Definition: UpdateData.h:59
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const
Definition: Object.cpp:167
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::SetByteFlag ( uint16  index,
uint8  offset,
uint8  newFlag 
)
1253 {
1254  ASSERT(index < m_valuesCount || PrintIndexError(index, true));
1255 
1256  if (offset > 3)
1257  {
1258  TC_LOG_ERROR("misc", "Object::SetByteFlag: wrong offset %u", offset);
1259  return;
1260  }
1261 
1262  if (!(uint8(m_uint32Values[index] >> (offset * 8)) & newFlag))
1263  {
1264  m_uint32Values[index] |= uint32(uint32(newFlag) << (offset * 8));
1265  _changesMask.SetBit(index);
1266 
1268  }
1269 }
UpdateMask _changesMask
Definition: Object.h:241
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint32 * m_uint32Values
Definition: Object.h:235
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint8_t uint8
Definition: g3dmath.h:164
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::SetByteValue ( uint16  index,
uint8  offset,
uint8  value 
)
1081 {
1082  ASSERT(index < m_valuesCount || PrintIndexError(index, true));
1083 
1084  if (offset > 3)
1085  {
1086  TC_LOG_ERROR("misc", "Object::SetByteValue: wrong offset %u", offset);
1087  return;
1088  }
1089 
1090  if (uint8(m_uint32Values[index] >> (offset * 8)) != value)
1091  {
1092  m_uint32Values[index] &= ~uint32(uint32(0xFF) << (offset * 8));
1093  m_uint32Values[index] |= uint32(uint32(value) << (offset * 8));
1094  _changesMask.SetBit(index);
1095 
1097  }
1098 }
UpdateMask _changesMask
Definition: Object.h:241
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint32 * m_uint32Values
Definition: Object.h:235
uint32_t uint32
Definition: Define.h:150
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint8_t uint8
Definition: g3dmath.h:164
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
const FieldDescriptor value
Definition: descriptor.h:1522
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
uint32_t uint32
Definition: g3dmath.h:168
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Object::SetDynamicValue ( uint16  index,
uint8  offset,
uint32  value 
)
1385 {
1386  ASSERT(index < _dynamicValuesCount || PrintIndexError(index, false));
1387 
1388  std::vector<uint32>& values = _dynamicValues[index];
1389 
1390  ASSERT(offset < values.size());
1391 
1392  if (values[offset] != value)
1393  {
1394  values[offset] = value;
1395  _dynamicChangesMask.SetBit(index);
1396  _dynamicChangesArrayMask[index].SetBit(offset);
1397 
1399  }
1400 }
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint16 _dynamicValuesCount
Definition: Object.h:246
UpdateMask _dynamicChangesMask
Definition: Object.h:242
UpdateMask * _dynamicChangesArrayMask
Definition: Object.h:243
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
std::vector< uint32 > * _dynamicValues
Definition: Object.h:239
#define ASSERT
Definition: Errors.h:55
const FieldDescriptor value
Definition: descriptor.h:1522
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function:

void Object::SetEntry ( uint32  entry)
inline
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: UpdateFields.h:29

+ Here is the caller graph for this function:

void Object::SetFieldNotifyFlag ( uint16  flag)
inline
185 { _fieldNotifyFlags |= flag; }
uint16 _fieldNotifyFlags
Definition: Object.h:248

+ Here is the caller graph for this function:

void Object::SetFlag ( uint16  index,
uint32  newFlag 
)
1200 {
1201  ASSERT(index < m_valuesCount || PrintIndexError(index, true));
1202  uint32 oldval = m_uint32Values[index];
1203  uint32 newval = oldval | newFlag;
1204 
1205  if (oldval != newval)
1206  {
1207  m_uint32Values[index] = newval;
1208  _changesMask.SetBit(index);
1209 
1211  }
1212 }
UpdateMask _changesMask
Definition: Object.h:241
void AddToObjectUpdateIfNeeded()
Definition: Object.cpp:820
uint32 * m_uint32Values
Definition: Object.h:235
uint32_t uint32
Definition: Define.h:150
bool PrintIndexError(uint32 index, bool set) const
Definition: Object.cpp:1402
uint16 m_valuesCount
Definition: Object.h:245
#define ASSERT
Definition: Errors.h:55
void SetBit(uint32 index)
Definition: UpdateMask.h:47

+ Here is the call graph for this function: