mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-01 10:03:47 +00:00
Fix corrupt item cache crashes, bot whispers, trade crashes
This commit is contained in:
@@ -212,6 +212,7 @@ Unit::Unit(bool isWorldObject) : WorldObject(isWorldObject),
|
||||
m_vehicleKit(nullptr),
|
||||
m_unitTypeMask(UNIT_MASK_NONE),
|
||||
m_HostileRefMgr(this),
|
||||
m_cannotReachTarget(false),
|
||||
m_comboTarget(nullptr),
|
||||
m_comboPoints(0)
|
||||
{
|
||||
@@ -9704,15 +9705,32 @@ ReputationRank Unit::GetFactionReactionTo(FactionTemplateEntry const* factionTem
|
||||
}
|
||||
}
|
||||
|
||||
return GetFactionReactionTo(factionTemplateEntry, targetFactionTemplateEntry);
|
||||
}
|
||||
|
||||
ReputationRank Unit::GetFactionReactionTo(FactionTemplateEntry const* factionTemplateEntry, FactionTemplateEntry const* targetFactionTemplateEntry)
|
||||
{
|
||||
// common faction based check
|
||||
if (factionTemplateEntry->IsHostileTo(*targetFactionTemplateEntry))
|
||||
{
|
||||
return REP_HOSTILE;
|
||||
}
|
||||
|
||||
if (factionTemplateEntry->IsFriendlyTo(*targetFactionTemplateEntry))
|
||||
{
|
||||
return REP_FRIENDLY;
|
||||
}
|
||||
|
||||
if (targetFactionTemplateEntry->IsFriendlyTo(*factionTemplateEntry))
|
||||
{
|
||||
return REP_FRIENDLY;
|
||||
}
|
||||
|
||||
if (factionTemplateEntry->factionFlags & FACTION_TEMPLATE_FLAG_HATES_ALL_EXCEPT_FRIENDS)
|
||||
{
|
||||
return REP_HOSTILE;
|
||||
}
|
||||
|
||||
// neutral by default
|
||||
return REP_NEUTRAL;
|
||||
}
|
||||
@@ -18304,11 +18322,23 @@ void Unit::SendPlaySpellVisual(uint32 id)
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void Unit::SendPlaySpellVisual(ObjectGuid guid, uint32 id)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SPELL_VISUAL, 8 + 4);
|
||||
data << guid;
|
||||
data << uint32(id); // SpellVisualKit.dbc index
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void Unit::SendPlaySpellImpact(ObjectGuid guid, uint32 id)
|
||||
{
|
||||
WorldPacket data(SMSG_PLAY_SPELL_IMPACT, 8 + 4);
|
||||
data << guid; // target
|
||||
data << uint32(id); // SpellVisualKit.dbc index
|
||||
|
||||
if (IsPlayer())
|
||||
ToPlayer()->SendDirectMessage(&data);
|
||||
else
|
||||
SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
@@ -20529,3 +20559,15 @@ bool Unit::CanRestoreMana(SpellInfo const* spellInfo) const
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
bool Unit::SetCannotReachTarget(bool cannotReach, bool /*isChase = true*/)
|
||||
{
|
||||
if (cannotReach == m_cannotReachTarget)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
m_cannotReachTarget = cannotReach;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user