Fix corrupt item cache crashes, bot whispers, trade crashes

This commit is contained in:
郑佩茹
2022-03-22 10:51:50 -06:00
parent ff0e5d5e3b
commit db71f4739c
25 changed files with 299 additions and 88 deletions

View File

@@ -12005,11 +12005,21 @@ bool Player::GetBGAccessByLevel(BattlegroundTypeId bgTypeId) const
float Player::GetReputationPriceDiscount(Creature const* creature) const
{
FactionTemplateEntry const* vendor_faction = creature->GetFactionTemplateEntry();
if (!vendor_faction || !vendor_faction->faction)
FactionTemplateEntry const* vendorFaction = creature->GetFactionTemplateEntry();
if (!vendorFaction)
{
return 1.0f;
}
return GetReputationPriceDiscount(vendorFaction);
}
float Player::GetReputationPriceDiscount(FactionTemplateEntry const* vendorFaction) const
{
if (!vendorFaction->faction)
return 1.0f;
ReputationRank rank = GetReputationRank(vendor_faction->faction);
ReputationRank rank = GetReputationRank(vendorFaction->faction);
if (rank <= REP_NEUTRAL)
return 1.0f;
@@ -15935,3 +15945,9 @@ uint32 Player::GetSpellCooldownDelay(uint32 spell_id) const
SpellCooldowns::const_iterator itr = m_spellCooldowns.find(spell_id);
return uint32(itr != m_spellCooldowns.end() && itr->second.end > getMSTime() ? itr->second.end - getMSTime() : 0);
}
void Player::ResetSpeakTimers()
{
m_speakTime = 0;
m_speakCount = 0;
}