Merge branch 'azerothcore:master' into Playerbot

This commit is contained in:
ZhengPeiRu21
2022-09-26 10:01:10 -06:00
committed by GitHub
82 changed files with 1459 additions and 245 deletions

View File

@@ -207,8 +207,8 @@ bool TemporaryThreatModifierEvent::Execute(uint64 /*e_time*/, uint32 /*p_time*/)
{
if (m_owner.IsInCombatWith(victim))
{
m_owner.GetThreatMgr().modifyThreatPercent(victim, -100); // Reset threat to zero.
m_owner.GetThreatMgr().addThreat(victim, m_threatValue); // Set to the previous value it had, first before modification.
m_owner.GetThreatMgr().ModifyThreatByPercent(victim, -100); // Reset threat to zero.
m_owner.GetThreatMgr().AddThreat(victim, m_threatValue); // Set to the previous value it had, first before modification.
}
}
@@ -839,13 +839,13 @@ void Creature::Update(uint32 diff)
}
};
if (GetThreatMgr().getThreatList().size() <= 1)
if (GetThreatMgr().GetThreatListSize() <= 1)
{
EnterEvade();
}
else
{
if (HostileReference* ref = GetThreatMgr().getOnlineContainer().getReferenceByTarget(m_cannotReachTarget))
if (HostileReference* ref = GetThreatMgr().GetOnlineContainer().getReferenceByTarget(m_cannotReachTarget))
{
ref->removeReference();
SetCannotReachTarget();
@@ -3627,11 +3627,11 @@ void Creature::ModifyThreatPercentTemp(Unit* victim, int32 percent, Milliseconds
{
if (victim)
{
float currentThreat = GetThreatMgr().getThreat(victim);
float currentThreat = GetThreatMgr().GetThreat(victim);
if (percent != 0.0f)
{
GetThreatMgr().modifyThreatPercent(victim, percent);
GetThreatMgr().ModifyThreatByPercent(victim, percent);
}
TemporaryThreatModifierEvent* pEvent = new TemporaryThreatModifierEvent(*this, victim->GetGUID(), currentThreat);

View File

@@ -2090,7 +2090,7 @@ void GameObject::CastSpell(Unit* target, uint32 spellId)
trigger->SetUnitFlag(UNIT_FLAG_PLAYER_CONTROLLED);
if (owner->IsFFAPvP())
{
if (!HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
if (!trigger->HasByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP))
{
sScriptMgr->OnFfaPvpStateUpdate(trigger, true);
trigger->SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP);

View File

@@ -659,12 +659,12 @@ struct ItemTemplate
uint32 ScalingStatValue; // mask for selecting column in ScalingStatValues.dbc
_Damage Damage[MAX_ITEM_PROTO_DAMAGES];
uint32 Armor;
uint32 HolyRes;
uint32 FireRes;
uint32 NatureRes;
uint32 FrostRes;
uint32 ShadowRes;
uint32 ArcaneRes;
int32 HolyRes;
int32 FireRes;
int32 NatureRes;
int32 FrostRes;
int32 ShadowRes;
int32 ArcaneRes;
uint32 Delay;
uint32 AmmoType;
float RangedModRange;

View File

@@ -8977,7 +8977,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
return false;
if (victim && victim->IsAlive())
victim->GetThreatMgr().modifyThreatPercent(this, -10);
victim->GetThreatMgr().ModifyThreatByPercent(this, -10);
basepoints0 = int32(CountPctFromMaxHealth(triggerAmount));
trigger_spell_id = 31616;
@@ -14121,7 +14121,7 @@ void Unit::AddThreat(Unit* victim, float fThreat, SpellSchoolMask schoolMask, Sp
// Only mobs can manage threat lists
if (CanHaveThreatList() && !HasUnitState(UNIT_STATE_EVADE))
{
m_ThreatMgr.addThreat(victim, fThreat, schoolMask, threatSpell);
m_ThreatMgr.AddThreat(victim, fThreat, schoolMask, threatSpell);
}
}
@@ -18710,8 +18710,8 @@ void Unit::SetPhaseMask(uint32 newPhaseMask, bool update)
// modify threat lists for new phasemask
if (GetTypeId() != TYPEID_PLAYER)
{
ThreatContainer::StorageType threatList = GetThreatMgr().getThreatList();
ThreatContainer::StorageType offlineThreatList = GetThreatMgr().getOfflineThreatList();
ThreatContainer::StorageType threatList = GetThreatMgr().GetThreatList();
ThreatContainer::StorageType offlineThreatList = GetThreatMgr().GetOfflineThreatList();
// merge expects sorted lists
threatList.sort();
@@ -19685,17 +19685,17 @@ void Unit::SendThreatListUpdate()
{
if (!GetThreatMgr().isThreatListEmpty())
{
uint32 count = GetThreatMgr().getThreatList().size();
uint32 count = GetThreatMgr().GetThreatList().size();
//LOG_DEBUG("entities.unit", "WORLD: Send SMSG_THREAT_UPDATE Message");
WorldPacket data(SMSG_THREAT_UPDATE, 8 + count * 8);
data << GetPackGUID();
data << uint32(count);
ThreatContainer::StorageType const& tlist = GetThreatMgr().getThreatList();
ThreatContainer::StorageType const& tlist = GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data << (*itr)->getUnitGuid().WriteAsPacked();
data << uint32((*itr)->getThreat() * 100);
data << uint32((*itr)->GetThreat() * 100);
}
SendMessageToSet(&data, false);
}
@@ -19705,18 +19705,18 @@ void Unit::SendChangeCurrentVictimOpcode(HostileReference* pHostileReference)
{
if (!GetThreatMgr().isThreatListEmpty())
{
uint32 count = GetThreatMgr().getThreatList().size();
uint32 count = GetThreatMgr().GetThreatList().size();
LOG_DEBUG("entities.unit", "WORLD: Send SMSG_HIGHEST_THREAT_UPDATE Message");
WorldPacket data(SMSG_HIGHEST_THREAT_UPDATE, 8 + 8 + count * 8);
data << GetPackGUID();
data << pHostileReference->getUnitGuid().WriteAsPacked();
data << uint32(count);
ThreatContainer::StorageType const& tlist = GetThreatMgr().getThreatList();
ThreatContainer::StorageType const& tlist = GetThreatMgr().GetThreatList();
for (ThreatContainer::StorageType::const_iterator itr = tlist.begin(); itr != tlist.end(); ++itr)
{
data << (*itr)->getUnitGuid().WriteAsPacked();
data << uint32((*itr)->getThreat() * 100);
data << uint32((*itr)->GetThreat() * 100);
}
SendMessageToSet(&data, false);
}
@@ -20646,7 +20646,7 @@ bool Unit::IsInCombatWith(Unit const* who) const
return false;
// Search in threat list
ObjectGuid guid = who->GetGUID();
for (ThreatContainer::StorageType::const_iterator i = m_ThreatMgr.getThreatList().begin(); i != m_ThreatMgr.getThreatList().end(); ++i)
for (ThreatContainer::StorageType::const_iterator i = m_ThreatMgr.GetThreatList().begin(); i != m_ThreatMgr.GetThreatList().end(); ++i)
{
HostileReference* ref = (*i);
// Return true if the unit matches