Core: Crash fix (TemporarySummon), remove some warnings and some other minor changes
- "const uint64" and "uint64 const" --> uint64 - Add some info in LFGDungeonEntry - Move some definitions from ".h" files and move to ".cpp"
This commit is contained in:
@@ -740,10 +740,10 @@ class Creature : public Unit, public GridObject<Creature>
|
||||
class AssistDelayEvent : public BasicEvent
|
||||
{
|
||||
public:
|
||||
AssistDelayEvent(const uint64 victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
|
||||
AssistDelayEvent(uint64 victim, Unit& owner) : BasicEvent(), m_victim(victim), m_owner(owner) { }
|
||||
|
||||
bool Execute(uint64 e_time, uint32 p_time);
|
||||
void AddAssistant(const uint64 guid) { m_assistants.push_back(guid); }
|
||||
void AddAssistant(uint64 guid) { m_assistants.push_back(guid); }
|
||||
private:
|
||||
AssistDelayEvent();
|
||||
|
||||
|
||||
@@ -203,7 +203,7 @@ void TempSummon::InitStats(uint32 duration)
|
||||
|
||||
if (m_Properties->Faction)
|
||||
setFaction(m_Properties->Faction);
|
||||
else if (IsVehicle()) // properties should be vehicle
|
||||
else if (IsVehicle() && owner) // properties should be vehicle
|
||||
setFaction(owner->getFaction());
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +159,30 @@ std::string Object::_ConcatFields(uint16 startIndex, uint16 size) const
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
void Object::AddToWorld()
|
||||
{
|
||||
if (m_inWorld)
|
||||
return;
|
||||
|
||||
ASSERT(m_uint32Values);
|
||||
|
||||
m_inWorld = true;
|
||||
|
||||
// synchronize values mirror with values array (changes will send in updatecreate opcode any way
|
||||
ClearUpdateMask(true);
|
||||
}
|
||||
|
||||
void Object::RemoveFromWorld()
|
||||
{
|
||||
if (!m_inWorld)
|
||||
return;
|
||||
|
||||
m_inWorld = false;
|
||||
|
||||
// if we remove from world then sending changes not required
|
||||
ClearUpdateMask(true);
|
||||
}
|
||||
|
||||
void Object::BuildMovementUpdateBlock(UpdateData * data, uint32 flags) const
|
||||
{
|
||||
ByteBuffer buf(500);
|
||||
@@ -296,17 +320,11 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
|
||||
*data << ((Unit*)this)->GetSpeed(MOVE_TURN_RATE);
|
||||
*data << ((Unit*)this)->GetSpeed(MOVE_PITCH_RATE);
|
||||
|
||||
const Player* player = ToPlayer();
|
||||
|
||||
// 0x08000000
|
||||
if (GetTypeId() == TYPEID_PLAYER && this->ToPlayer()->isInFlight())
|
||||
if (player && player->isInFlight())
|
||||
{
|
||||
//WPAssert(this->ToPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE);
|
||||
|
||||
Player* player = const_cast<Object*>(this)->ToPlayer();
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
FlightPathMovementGenerator *fmg = (FlightPathMovementGenerator*)(player->GetMotionMaster()->top());
|
||||
|
||||
uint32 flags3 = SPLINEFLAG_GLIDE;
|
||||
|
||||
*data << uint32(flags3); // splines flag?
|
||||
@@ -330,7 +348,9 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint16 flags) const
|
||||
}
|
||||
}
|
||||
|
||||
TaxiPathNodeList& path = const_cast<TaxiPathNodeList&>(fmg->GetPath());
|
||||
FlightPathMovementGenerator *fmg =
|
||||
(FlightPathMovementGenerator*)(player->GetMotionMaster()->top());
|
||||
TaxiPathNodeList const& path = fmg->GetPath();
|
||||
|
||||
float x, y, z;
|
||||
player->GetPosition(x, y, z);
|
||||
@@ -822,13 +842,10 @@ void Object::SetInt32Value(uint16 index, int32 value)
|
||||
m_int32Values[index] = value;
|
||||
_changedFields[index] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -842,13 +859,10 @@ void Object::SetUInt32Value(uint16 index, uint32 value)
|
||||
m_uint32Values[index] = value;
|
||||
_changedFields[index] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -861,51 +875,47 @@ void Object::UpdateUInt32Value(uint16 index, uint32 value)
|
||||
_changedFields[index] = true;
|
||||
}
|
||||
|
||||
void Object::SetUInt64Value(uint16 index, uint64 const value)
|
||||
void Object::SetUInt64Value(uint16 index, uint64 value)
|
||||
{
|
||||
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index, true));
|
||||
if (*((uint64*)&(m_uint32Values[index])) != value)
|
||||
{
|
||||
m_uint32Values[index] = *((uint32*)&value);
|
||||
m_uint32Values[index + 1] = *(((uint32*)&value) + 1);
|
||||
m_uint32Values[index] = PAIR64_LOPART(value);
|
||||
m_uint32Values[index + 1] = PAIR64_HIPART(value);
|
||||
_changedFields[index] = true;
|
||||
_changedFields[index + 1] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool Object::AddUInt64Value(uint16 index, uint64 const value)
|
||||
bool Object::AddUInt64Value(uint16 index, uint64 value)
|
||||
{
|
||||
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , true));
|
||||
if (value && !*((uint64*)&(m_uint32Values[index])))
|
||||
{
|
||||
m_uint32Values[index] = *((uint32*)&value);
|
||||
m_uint32Values[index + 1] = *(((uint32*)&value) + 1);
|
||||
m_uint32Values[index] = PAIR64_LOPART(value);
|
||||
m_uint32Values[index + 1] = PAIR64_HIPART(value);
|
||||
_changedFields[index] = true;
|
||||
_changedFields[index + 1] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Object::RemoveUInt64Value(uint16 index, const uint64 value)
|
||||
bool Object::RemoveUInt64Value(uint16 index, uint64 value)
|
||||
{
|
||||
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , true));
|
||||
if (value && *((uint64*)&(m_uint32Values[index])) == value)
|
||||
@@ -915,13 +925,10 @@ bool Object::RemoveUInt64Value(uint16 index, const uint64 value)
|
||||
_changedFields[index] = true;
|
||||
_changedFields[index + 1] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -939,13 +946,10 @@ void Object::SetFloatValue(uint16 index, float value)
|
||||
m_floatValues[index] = value;
|
||||
_changedFields[index] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -966,13 +970,10 @@ void Object::SetByteValue(uint16 index, uint8 offset, uint8 value)
|
||||
m_uint32Values[index] |= uint32(uint32(value) << (offset * 8));
|
||||
_changedFields[index] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -993,13 +994,10 @@ void Object::SetUInt16Value(uint16 index, uint8 offset, uint16 value)
|
||||
m_uint32Values[index] |= uint32(uint32(value) << (offset * 16));
|
||||
_changedFields[index] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1063,13 +1061,10 @@ void Object::SetFlag(uint16 index, uint32 newFlag)
|
||||
m_uint32Values[index] = newval;
|
||||
_changedFields[index] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1087,13 +1082,10 @@ void Object::RemoveFlag(uint16 index, uint32 oldFlag)
|
||||
m_uint32Values[index] = newval;
|
||||
_changedFields[index] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1113,13 +1105,10 @@ void Object::SetByteFlag(uint16 index, uint8 offset, uint8 newFlag)
|
||||
m_uint32Values[index] |= uint32(uint32(newFlag) << (offset * 8));
|
||||
_changedFields[index] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1139,13 +1128,10 @@ void Object::RemoveByteFlag(uint16 index, uint8 offset, uint8 oldFlag)
|
||||
m_uint32Values[index] &= ~uint32(uint32(oldFlag) << (offset * 8));
|
||||
_changedFields[index] = true;
|
||||
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1356,7 +1342,9 @@ bool WorldObject::_IsWithinDist(WorldObject const* obj, float dist2compare, bool
|
||||
|
||||
bool WorldObject::IsWithinLOSInMap(const WorldObject* obj) const
|
||||
{
|
||||
if (!IsInMap(obj)) return false;
|
||||
if (!IsInMap(obj))
|
||||
return false;
|
||||
|
||||
float ox, oy, oz;
|
||||
obj->GetPosition(ox, oy, oz);
|
||||
return(IsWithinLOS(ox, oy, oz));
|
||||
@@ -1840,13 +1828,10 @@ void WorldObject::SendPlaySound(uint32 Sound, bool OnlySelf)
|
||||
void Object::ForceValuesUpdateAtIndex(uint32 i)
|
||||
{
|
||||
_changedFields[i] = true;
|
||||
if (m_inWorld)
|
||||
if (m_inWorld && !m_objectUpdated)
|
||||
{
|
||||
if (!m_objectUpdated)
|
||||
{
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
sObjectAccessor->AddUpdateObject(this);
|
||||
m_objectUpdated = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2043,6 +2028,12 @@ void Unit::BuildHeartBeatMsg(WorldPacket *data) const
|
||||
BuildMovementPacket(data);
|
||||
}
|
||||
|
||||
void WorldObject::SendMessageToSet(WorldPacket *data, bool self)
|
||||
{
|
||||
SendMessageToSetInRange(data, GetVisibilityRange(), self);
|
||||
}
|
||||
|
||||
|
||||
void WorldObject::SendMessageToSetInRange(WorldPacket *data, float dist, bool /*self*/)
|
||||
{
|
||||
Trinity::MessageDistDeliverer notifier(this, data, dist);
|
||||
@@ -2396,7 +2387,7 @@ Creature* WorldObject::SummonTrigger(float x, float y, float z, float ang, uint3
|
||||
return summon;
|
||||
}
|
||||
|
||||
Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive)
|
||||
Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive) const
|
||||
{
|
||||
Creature *creature = NULL;
|
||||
Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range);
|
||||
@@ -2405,7 +2396,7 @@ Creature* WorldObject::FindNearestCreature(uint32 entry, float range, bool alive
|
||||
return creature;
|
||||
}
|
||||
|
||||
GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range)
|
||||
GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range) const
|
||||
{
|
||||
GameObject *go = NULL;
|
||||
Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range);
|
||||
@@ -2414,7 +2405,7 @@ GameObject* WorldObject::FindNearestGameObject(uint32 entry, float range)
|
||||
return go;
|
||||
}
|
||||
|
||||
void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange)
|
||||
void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const
|
||||
{
|
||||
CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
@@ -2428,7 +2419,7 @@ void WorldObject::GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList
|
||||
cell.Visit(pair, visitor, *(this->GetMap()));
|
||||
}
|
||||
|
||||
void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange)
|
||||
void WorldObject::GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const
|
||||
{
|
||||
CellPair pair(Trinity::ComputeCellPair(this->GetPositionX(), this->GetPositionY()));
|
||||
Cell cell(pair);
|
||||
@@ -2777,19 +2768,23 @@ void WorldObject::UpdateObjectVisibility(bool /*forced*/)
|
||||
|
||||
struct WorldObjectChangeAccumulator
|
||||
{
|
||||
UpdateDataMapType &i_updateDatas;
|
||||
WorldObject &i_object;
|
||||
UpdateDataMapType& i_updateDatas;
|
||||
WorldObject& i_object;
|
||||
std::set<uint64> plr_list;
|
||||
WorldObjectChangeAccumulator(WorldObject &obj, UpdateDataMapType &d) : i_updateDatas(d), i_object(obj) {}
|
||||
void Visit(PlayerMapType &m)
|
||||
{
|
||||
Player* source = NULL;
|
||||
for (PlayerMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
BuildPacket(iter->getSource());
|
||||
if (!iter->getSource()->GetSharedVisionList().empty())
|
||||
source = iter->getSource();
|
||||
|
||||
BuildPacket(source);
|
||||
|
||||
if (!source->GetSharedVisionList().empty())
|
||||
{
|
||||
SharedVisionList::const_iterator it = iter->getSource()->GetSharedVisionList().begin();
|
||||
for (; it != iter->getSource()->GetSharedVisionList().end(); ++it)
|
||||
SharedVisionList::const_iterator it = source->GetSharedVisionList().begin();
|
||||
for (; it != source->GetSharedVisionList().end(); ++it)
|
||||
BuildPacket(*it);
|
||||
}
|
||||
}
|
||||
@@ -2797,30 +2792,37 @@ struct WorldObjectChangeAccumulator
|
||||
|
||||
void Visit(CreatureMapType &m)
|
||||
{
|
||||
Creature* source = NULL;
|
||||
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
if (!iter->getSource()->GetSharedVisionList().empty())
|
||||
source = iter->getSource();
|
||||
if (!source->GetSharedVisionList().empty())
|
||||
{
|
||||
SharedVisionList::const_iterator it = iter->getSource()->GetSharedVisionList().begin();
|
||||
for (; it != iter->getSource()->GetSharedVisionList().end(); ++it)
|
||||
SharedVisionList::const_iterator it = source->GetSharedVisionList().begin();
|
||||
for (; it != source->GetSharedVisionList().end(); ++it)
|
||||
BuildPacket(*it);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Visit(DynamicObjectMapType &m)
|
||||
{
|
||||
DynamicObject* source = NULL;
|
||||
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
|
||||
{
|
||||
uint64 guid = iter->getSource()->GetCasterGUID();
|
||||
source = iter->getSource();
|
||||
uint64 guid = source->GetCasterGUID();
|
||||
|
||||
if (IS_PLAYER_GUID(guid))
|
||||
{
|
||||
//Caster may be NULL if DynObj is in removelist
|
||||
if (Player *caster = ObjectAccessor::FindPlayer(guid))
|
||||
if (caster->GetUInt64Value(PLAYER_FARSIGHT) == iter->getSource()->GetGUID())
|
||||
if (caster->GetUInt64Value(PLAYER_FARSIGHT) == source->GetGUID())
|
||||
BuildPacket(caster);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void BuildPacket(Player* plr)
|
||||
{
|
||||
// Only send update once to a player
|
||||
|
||||
@@ -125,29 +125,9 @@ class Object
|
||||
virtual ~Object ();
|
||||
|
||||
bool IsInWorld() const { return m_inWorld; }
|
||||
virtual void AddToWorld()
|
||||
{
|
||||
if (m_inWorld)
|
||||
return;
|
||||
|
||||
ASSERT(m_uint32Values);
|
||||
|
||||
m_inWorld = true;
|
||||
|
||||
// synchronize values mirror with values array (changes will send in updatecreate opcode any way
|
||||
ClearUpdateMask(true);
|
||||
}
|
||||
|
||||
virtual void RemoveFromWorld()
|
||||
{
|
||||
if (!m_inWorld)
|
||||
return;
|
||||
|
||||
m_inWorld = false;
|
||||
|
||||
// if we remove from world then sending changes not required
|
||||
ClearUpdateMask(true);
|
||||
}
|
||||
virtual void AddToWorld();
|
||||
virtual void RemoveFromWorld();
|
||||
|
||||
uint64 GetGUID() const { return GetUInt64Value(0); }
|
||||
uint32 GetGUIDLow() const { return GUID_LOPART(GetUInt64Value(0)); }
|
||||
@@ -210,7 +190,7 @@ class Object
|
||||
void SetInt32Value(uint16 index, int32 value);
|
||||
void SetUInt32Value(uint16 index, uint32 value);
|
||||
void UpdateUInt32Value(uint16 index, uint32 value);
|
||||
void SetUInt64Value(uint16 index, uint64 const 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);
|
||||
@@ -218,8 +198,8 @@ class Object
|
||||
void SetStatFloatValue(uint16 index, float value);
|
||||
void SetStatInt32Value(uint16 index, int32 value);
|
||||
|
||||
bool AddUInt64Value(uint16 index, uint64 const value);
|
||||
bool RemoveUInt64Value(uint16 index, uint64 const value);
|
||||
bool AddUInt64Value(uint16 index, uint64 value);
|
||||
bool RemoveUInt64Value(uint16 index, uint64 value);
|
||||
|
||||
void ApplyModUInt32Value(uint16 index, int32 val, bool apply);
|
||||
void ApplyModInt32Value(uint16 index, int32 val, bool apply);
|
||||
@@ -725,7 +705,7 @@ class WorldObject : public Object, public WorldLocation
|
||||
|
||||
virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units
|
||||
|
||||
virtual void SendMessageToSet(WorldPacket *data, bool self) { SendMessageToSetInRange(data, GetVisibilityRange(), self); }
|
||||
virtual void SendMessageToSet(WorldPacket *data, bool self);
|
||||
virtual void SendMessageToSetInRange(WorldPacket *data, float dist, bool self);
|
||||
virtual void SendMessageToSet(WorldPacket *data, Player const* skipped_rcvr);
|
||||
|
||||
@@ -806,11 +786,11 @@ class WorldObject : public Object, public WorldLocation
|
||||
GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime);
|
||||
Creature* SummonTrigger(float x, float y, float z, float ang, uint32 dur, CreatureAI* (*GetAI)(Creature*) = NULL);
|
||||
|
||||
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true);
|
||||
GameObject* FindNearestGameObject(uint32 entry, float range);
|
||||
Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
|
||||
GameObject* FindNearestGameObject(uint32 entry, float range) const;
|
||||
|
||||
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange);
|
||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange);
|
||||
void GetGameObjectListWithEntryInGrid(std::list<GameObject*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
|
||||
void GetCreatureListWithEntryInGrid(std::list<Creature*>& lList, uint32 uiEntry, float fMaxSearchRange) const;
|
||||
|
||||
void DestroyForNearbyPlayers();
|
||||
virtual void UpdateObjectVisibility(bool forced = true);
|
||||
@@ -884,11 +864,14 @@ namespace Trinity
|
||||
template<class T>
|
||||
void RandomResizeList(std::list<T> &_list, uint32 _size)
|
||||
{
|
||||
while (_list.size() > _size)
|
||||
size_t list_size = _list.size();
|
||||
|
||||
while (list_size > _size)
|
||||
{
|
||||
typename std::list<T>::iterator itr = _list.begin();
|
||||
advance(itr, urand(0, _list.size() - 1));
|
||||
std::advance(itr, urand(0, list_size - 1));
|
||||
_list.erase(itr);
|
||||
--list_size;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ enum HighGuid
|
||||
#define _GUID_LOPART_2(x) (uint32)(uint64(x) & UI64LIT(0x00000000FFFFFFFF))
|
||||
#define _GUID_LOPART_3(x) (uint32)(uint64(x) & UI64LIT(0x0000000000FFFFFF))
|
||||
|
||||
inline bool IsGuidHaveEnPart(uint64 const guid)
|
||||
inline bool IsGuidHaveEnPart(uint64 guid)
|
||||
{
|
||||
switch(GUID_HIPART(guid))
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ void UpdateData::AddOutOfRangeGUID(std::set<uint64>& guids)
|
||||
m_outOfRangeGUIDs.insert(guids.begin(), guids.end());
|
||||
}
|
||||
|
||||
void UpdateData::AddOutOfRangeGUID(const uint64 guid)
|
||||
void UpdateData::AddOutOfRangeGUID(uint64 guid)
|
||||
{
|
||||
m_outOfRangeGUIDs.insert(guid);
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ class UpdateData
|
||||
UpdateData();
|
||||
|
||||
void AddOutOfRangeGUID(std::set<uint64>& guids);
|
||||
void AddOutOfRangeGUID(const uint64 guid);
|
||||
void AddOutOfRangeGUID(uint64 guid);
|
||||
void AddUpdateBlock(const ByteBuffer &block);
|
||||
bool BuildPacket(WorldPacket* packet);
|
||||
bool HasData() { return m_blockCount > 0 || !m_outOfRangeGUIDs.empty(); }
|
||||
|
||||
@@ -19610,8 +19610,8 @@ void Player::SendRemoveControlBar()
|
||||
|
||||
bool Player::IsAffectedBySpellmod(SpellInfo const *spellInfo, SpellModifier *mod, Spell* spell)
|
||||
{
|
||||
if (!mod || !spellInfo)
|
||||
return false;
|
||||
if (!mod || !spellInfo)
|
||||
return false;
|
||||
|
||||
// Mod out of charges
|
||||
if (spell && mod->charges == -1 && spell->m_appliedMods.find(mod->ownerAura) == spell->m_appliedMods.end())
|
||||
|
||||
@@ -1567,7 +1567,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
uint64 GetSelection() const { return m_curSelection; }
|
||||
Unit *GetSelectedUnit() const;
|
||||
Player *GetSelectedPlayer() const;
|
||||
void SetSelection(const uint64 guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); }
|
||||
void SetSelection(uint64 guid) { m_curSelection = guid; SetUInt64Value(UNIT_FIELD_TARGET, guid); }
|
||||
|
||||
uint8 GetComboPoints() { return m_comboPoints; }
|
||||
uint64 GetComboTarget() const { return m_comboTarget; }
|
||||
@@ -1902,7 +1902,7 @@ class Player : public Unit, public GridObject<Player>
|
||||
void UpdateRuneRegen(RuneType rune);
|
||||
|
||||
uint64 GetLootGUID() const { return m_lootGuid; }
|
||||
void SetLootGUID(const uint64 guid) { m_lootGuid = guid; }
|
||||
void SetLootGUID(uint64 guid) { m_lootGuid = guid; }
|
||||
|
||||
void RemovedInsignia(Player* looterPlr);
|
||||
|
||||
|
||||
@@ -6457,16 +6457,14 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
}
|
||||
case SPELLFAMILY_ROGUE:
|
||||
{
|
||||
switch(dummySpell->Id)
|
||||
switch (dummySpell->Id)
|
||||
{
|
||||
// Glyph of Backstab
|
||||
case 56800:
|
||||
case 56800: // Glyph of Backstab
|
||||
{
|
||||
triggered_spell_id = 63975;
|
||||
break;
|
||||
}
|
||||
// Deadly Throw Interrupt
|
||||
case 32748:
|
||||
case 32748: // Deadly Throw Interrupt
|
||||
{
|
||||
// Prevent cast Deadly Throw Interrupt on self from last effect (apply dummy) of Deadly Throw
|
||||
if (this == victim)
|
||||
@@ -6476,124 +6474,126 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Cut to the Chase
|
||||
if (dummySpell->SpellIconID == 2909)
|
||||
|
||||
switch (dummySpell->SpellIconID)
|
||||
{
|
||||
// "refresh your Slice and Dice duration to its 5 combo point maximum"
|
||||
// lookup Slice and Dice
|
||||
if (AuraEffect const* aur = GetAuraEffect(SPELL_AURA_MOD_MELEE_HASTE, SPELLFAMILY_ROGUE, 0x40000, 0, 0))
|
||||
case 2116: // Quick Recovery
|
||||
{
|
||||
aur->GetBase()->SetDuration(aur->GetSpellInfo()->GetMaxDuration(), true);
|
||||
return true;
|
||||
if (!procSpell)
|
||||
return false;
|
||||
|
||||
// energy cost save
|
||||
basepoints0 = CalculatePctN(int32(procSpell->ManaCost), triggerAmount);
|
||||
if (basepoints0 <= 0)
|
||||
return false;
|
||||
|
||||
target = this;
|
||||
triggered_spell_id = 31663;
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// Deadly Brew
|
||||
else if (dummySpell->SpellIconID == 2963)
|
||||
{
|
||||
triggered_spell_id = 3409;
|
||||
break;
|
||||
}
|
||||
// Quick Recovery
|
||||
else if (dummySpell->SpellIconID == 2116)
|
||||
{
|
||||
if (!procSpell)
|
||||
case 2909: // Cut to the Chase
|
||||
{
|
||||
// "refresh your Slice and Dice duration to its 5 combo point maximum"
|
||||
// lookup Slice and Dice
|
||||
if (AuraEffect const* aur = GetAuraEffect(SPELL_AURA_MOD_MELEE_HASTE, SPELLFAMILY_ROGUE, 0x40000, 0, 0))
|
||||
{
|
||||
aur->GetBase()->SetDuration(aur->GetSpellInfo()->GetMaxDuration(), true);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
// energy cost save
|
||||
basepoints0 = CalculatePctN(int32(procSpell->ManaCost), triggerAmount);
|
||||
if (basepoints0 <= 0)
|
||||
return false;
|
||||
|
||||
target = this;
|
||||
triggered_spell_id = 31663;
|
||||
break;
|
||||
}
|
||||
case 2963: // Deadly Brew
|
||||
{
|
||||
triggered_spell_id = 3409;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
case SPELLFAMILY_HUNTER:
|
||||
{
|
||||
// Thrill of the Hunt
|
||||
if (dummySpell->SpellIconID == 2236)
|
||||
switch (dummySpell->SpellIconID)
|
||||
{
|
||||
if (!procSpell)
|
||||
return false;
|
||||
|
||||
Spell* spell = ToPlayer()->m_spellModTakingSpell;
|
||||
|
||||
// Disable charge drop because of Lock and Load
|
||||
ToPlayer()->SetSpellModTakingSpell(spell, false);
|
||||
|
||||
// Explosive Shot
|
||||
if (procSpell->SpellFamilyFlags[2] & 0x200)
|
||||
case 267: // Improved Mend Pet
|
||||
{
|
||||
if (AuraEffect const* pEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x0, 0x80000000, 0x0, GetGUID()))
|
||||
basepoints0 = pEff->GetSpellInfo()->CalcPowerCost(this, SpellSchoolMask(pEff->GetSpellInfo()->SchoolMask)) * 4/10/3;
|
||||
int32 chance = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
|
||||
if (!roll_chance_i(chance))
|
||||
return false;
|
||||
|
||||
triggered_spell_id = 24406;
|
||||
break;
|
||||
}
|
||||
else
|
||||
basepoints0 = procSpell->CalcPowerCost(this, SpellSchoolMask(procSpell->SchoolMask)) * 4/10;
|
||||
|
||||
ToPlayer()->SetSpellModTakingSpell(spell, true);
|
||||
|
||||
if (basepoints0 <= 0)
|
||||
return false;
|
||||
|
||||
target = this;
|
||||
triggered_spell_id = 34720;
|
||||
break;
|
||||
}
|
||||
// Hunting Party
|
||||
if (dummySpell->SpellIconID == 3406)
|
||||
{
|
||||
triggered_spell_id = 57669;
|
||||
target = this;
|
||||
break;
|
||||
}
|
||||
// Improved Mend Pet
|
||||
if (dummySpell->SpellIconID == 267)
|
||||
{
|
||||
int32 chance = triggeredByAura->GetSpellInfo()->Effects[triggeredByAura->GetEffIndex()].CalcValue();
|
||||
if (!roll_chance_i(chance))
|
||||
return false;
|
||||
|
||||
triggered_spell_id = 24406;
|
||||
break;
|
||||
}
|
||||
// Lock and Load
|
||||
if (dummySpell->SpellIconID == 3579)
|
||||
{
|
||||
// Proc only from periodic (from trap activation proc another aura of this spell)
|
||||
if (!(procFlag & PROC_FLAG_DONE_PERIODIC) || !roll_chance_i(triggerAmount))
|
||||
return false;
|
||||
triggered_spell_id = 56453;
|
||||
target = this;
|
||||
break;
|
||||
}
|
||||
// Rapid Recuperation
|
||||
if (dummySpell->SpellIconID == 3560)
|
||||
{
|
||||
// This effect only from Rapid Killing (mana regen)
|
||||
if (!(procSpell->SpellFamilyFlags[1] & 0x01000000))
|
||||
return false;
|
||||
|
||||
target = this;
|
||||
|
||||
switch(dummySpell->Id)
|
||||
case 2236: // Thrill of the Hunt
|
||||
{
|
||||
case 53228: // Rank 1
|
||||
triggered_spell_id = 56654;
|
||||
break;
|
||||
case 53232: // Rank 2
|
||||
triggered_spell_id = 58882;
|
||||
break;
|
||||
if (!procSpell)
|
||||
return false;
|
||||
|
||||
Spell* spell = ToPlayer()->m_spellModTakingSpell;
|
||||
|
||||
// Disable charge drop because of Lock and Load
|
||||
ToPlayer()->SetSpellModTakingSpell(spell, false);
|
||||
|
||||
// Explosive Shot
|
||||
if (procSpell->SpellFamilyFlags[2] & 0x200)
|
||||
{
|
||||
if (AuraEffect const* pEff = victim->GetAuraEffect(SPELL_AURA_PERIODIC_DUMMY, SPELLFAMILY_HUNTER, 0x0, 0x80000000, 0x0, GetGUID()))
|
||||
basepoints0 = pEff->GetSpellInfo()->CalcPowerCost(this, SpellSchoolMask(pEff->GetSpellInfo()->SchoolMask)) * 4/10/3;
|
||||
}
|
||||
else
|
||||
basepoints0 = procSpell->CalcPowerCost(this, SpellSchoolMask(procSpell->SchoolMask)) * 4/10;
|
||||
|
||||
ToPlayer()->SetSpellModTakingSpell(spell, true);
|
||||
|
||||
if (basepoints0 <= 0)
|
||||
return false;
|
||||
|
||||
target = this;
|
||||
triggered_spell_id = 34720;
|
||||
break;
|
||||
}
|
||||
case 3406: // Hunting Party
|
||||
{
|
||||
triggered_spell_id = 57669;
|
||||
target = this;
|
||||
break;
|
||||
}
|
||||
case 3560: // Rapid Recuperation
|
||||
{
|
||||
// This effect only from Rapid Killing (mana regen)
|
||||
if (!(procSpell->SpellFamilyFlags[1] & 0x01000000))
|
||||
return false;
|
||||
|
||||
target = this;
|
||||
|
||||
switch (dummySpell->Id)
|
||||
{
|
||||
case 53228: // Rank 1
|
||||
triggered_spell_id = 56654;
|
||||
break;
|
||||
case 53232: // Rank 2
|
||||
triggered_spell_id = 58882;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3579: // Lock and Load
|
||||
{
|
||||
// Proc only from periodic (from trap activation proc another aura of this spell)
|
||||
if (!(procFlag & PROC_FLAG_DONE_PERIODIC) || !roll_chance_i(triggerAmount))
|
||||
return false;
|
||||
triggered_spell_id = 56453;
|
||||
target = this;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
// Glyph of Mend Pet
|
||||
if (dummySpell->Id == 57870)
|
||||
|
||||
switch (dummySpell->Id)
|
||||
{
|
||||
victim->CastSpell(victim, 57894, true, NULL, NULL, GetGUID());
|
||||
return true;
|
||||
case 57870: // Glyph of Mend Pet
|
||||
{
|
||||
victim->CastSpell(victim, 57894, true, NULL, NULL, GetGUID());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -8411,76 +8411,42 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
target = this;
|
||||
break;
|
||||
}
|
||||
// Lightning Capacitor
|
||||
case 37657:
|
||||
case 37657: // Lightning Capacitor
|
||||
case 54841: // Thunder Capacitor
|
||||
case 67712: // Item - Coliseum 25 Normal Caster Trinket
|
||||
case 67758: // Item - Coliseum 25 Heroic Caster Trinket
|
||||
{
|
||||
if (!victim || !victim->isAlive())
|
||||
if (!victim || !victim->isAlive() || GetTypeId() != TYPEID_PLAYER)
|
||||
return false;
|
||||
// stacking
|
||||
CastSpell(this, 37658, true, NULL, triggeredByAura);
|
||||
|
||||
Aura* dummy = GetAura(37658);
|
||||
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
|
||||
uint32 stack_spell_id = 0;
|
||||
switch (auraSpellInfo->Id)
|
||||
{
|
||||
case 37657:
|
||||
stack_spell_id = 37658;
|
||||
trigger_spell_id = 37661;
|
||||
break;
|
||||
case 54841:
|
||||
stack_spell_id = 54842;
|
||||
trigger_spell_id = 54843;
|
||||
break;
|
||||
case 67712:
|
||||
stack_spell_id = 67713;
|
||||
trigger_spell_id = 67714;
|
||||
break;
|
||||
case 67758:
|
||||
stack_spell_id = 67759;
|
||||
trigger_spell_id = 67760;
|
||||
break;
|
||||
}
|
||||
|
||||
CastSpell(this, stack_spell_id, true, NULL, triggeredByAura);
|
||||
|
||||
Aura* dummy = GetAura(stack_spell_id);
|
||||
if (!dummy || dummy->GetStackAmount() < triggerAmount)
|
||||
return false;
|
||||
|
||||
RemoveAurasDueToSpell(37658);
|
||||
trigger_spell_id = 37661;
|
||||
target = victim;
|
||||
break;
|
||||
}
|
||||
// Thunder Capacitor
|
||||
case 54841:
|
||||
{
|
||||
if (!victim || !victim->isAlive())
|
||||
return false;
|
||||
// stacking
|
||||
CastSpell(this, 54842, true, NULL, triggeredByAura);
|
||||
|
||||
// counting
|
||||
Aura* dummy = GetAura(54842);
|
||||
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
|
||||
if (!dummy || dummy->GetStackAmount() < triggerAmount)
|
||||
return false;
|
||||
|
||||
RemoveAurasDueToSpell(54842);
|
||||
trigger_spell_id = 54843;
|
||||
target = victim;
|
||||
break;
|
||||
}
|
||||
//Item - Coliseum 25 Normal Caster Trinket
|
||||
case 67712:
|
||||
{
|
||||
if (!victim || !victim->isAlive())
|
||||
return false;
|
||||
// stacking
|
||||
CastSpell(this, 67713, true, NULL, triggeredByAura);
|
||||
|
||||
Aura* dummy = GetAura(67713);
|
||||
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
|
||||
if (!dummy || dummy->GetStackAmount() < triggerAmount)
|
||||
return false;
|
||||
|
||||
RemoveAurasDueToSpell(67713);
|
||||
trigger_spell_id = 67714;
|
||||
target = victim;
|
||||
break;
|
||||
}
|
||||
//Item - Coliseum 25 Heroic Caster Trinket
|
||||
case 67758:
|
||||
{
|
||||
if (!victim || !victim->isAlive())
|
||||
return false;
|
||||
// stacking
|
||||
CastSpell(this, 67759, true, NULL, triggeredByAura);
|
||||
|
||||
Aura* dummy = GetAura(67759);
|
||||
// release at 3 aura in stack (cont contain in basepoint of trigger aura)
|
||||
if (!dummy || dummy->GetStackAmount() < triggerAmount)
|
||||
return false;
|
||||
|
||||
RemoveAurasDueToSpell(67759);
|
||||
trigger_spell_id = 67760;
|
||||
RemoveAurasDueToSpell(stack_spell_id);
|
||||
target = victim;
|
||||
break;
|
||||
}
|
||||
@@ -11743,8 +11709,6 @@ void Unit::MeleeDamageBonus(Unit* victim, uint32 *pdamage, WeaponAttackType attT
|
||||
else
|
||||
TakenFlatBenefit += victim->GetTotalAuraModifier(SPELL_AURA_MOD_RANGED_DAMAGE_TAKEN);
|
||||
|
||||
Player* player = ToPlayer();
|
||||
|
||||
// Done/Taken total percent damage auras
|
||||
float DoneTotalMod = 1.0f;
|
||||
float TakenTotalMod = 1.0f;
|
||||
|
||||
@@ -2050,7 +2050,8 @@ class Unit : public WorldObject
|
||||
static Player* GetPlayer(WorldObject& object, uint64 guid);
|
||||
static Creature* GetCreature(WorldObject& object, uint64 guid);
|
||||
|
||||
MotionMaster* GetMotionMaster(){ return &i_motionMaster; }
|
||||
MotionMaster* GetMotionMaster() { return &i_motionMaster; }
|
||||
const MotionMaster* GetMotionMaster() const { return &i_motionMaster; }
|
||||
|
||||
bool IsStopped() const { return !(HasUnitState(UNIT_STAT_MOVING)); }
|
||||
void StopMoving();
|
||||
|
||||
Reference in New Issue
Block a user