Merge branch 'master' into Playerbot

# Conflicts:
#	src/server/game/Entities/Player/Player.h
This commit is contained in:
郑佩茹
2023-03-16 10:00:13 -06:00
325 changed files with 12322 additions and 7378 deletions

View File

@@ -9185,32 +9185,47 @@ Pet* Player::CreatePet(uint32 creatureEntry, uint32 spellID /*= 0*/)
return pet;
}
void Player::StopCastingCharm()
void Player::StopCastingCharm(Aura* except /*= nullptr*/)
{
Unit* charm = GetCharm();
if (!charm)
{
return;
}
if (charm->GetTypeId() == TYPEID_UNIT)
{
if (charm->ToCreature()->HasUnitTypeMask(UNIT_MASK_PUPPET))
{
((Puppet*)charm)->UnSummon();
}
else if (charm->IsVehicle())
{
ExitVehicle();
}
}
if (GetCharmGUID())
charm->RemoveCharmAuras();
{
charm->RemoveAurasByType(SPELL_AURA_MOD_CHARM, ObjectGuid::Empty, except);
charm->RemoveAurasByType(SPELL_AURA_MOD_POSSESS_PET, ObjectGuid::Empty, except);
charm->RemoveAurasByType(SPELL_AURA_MOD_POSSESS, ObjectGuid::Empty, except);
charm->RemoveAurasByType(SPELL_AURA_AOE_CHARM, ObjectGuid::Empty, except);
}
if (GetCharmGUID())
{
LOG_FATAL("entities.player", "Player {} ({} is not able to uncharm unit ({})", GetName(), GetGUID().ToString(), GetCharmGUID().ToString());
if (charm->GetCharmerGUID())
{
LOG_FATAL("entities.player", "Charmed unit has charmer {}", charm->GetCharmerGUID().ToString());
ABORT();
}
else
{
SetCharm(charm, false);
}
}
}
@@ -10800,7 +10815,6 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
// cooldown information stored in item prototype
// This used in same way in WorldSession::HandleItemQuerySingleOpcode data sending to client.
bool useSpellCooldown = spellInfo->HasAttribute(SPELL_ATTR7_CAN_BE_MULTI_CAST);
if (itemId)
{
if (ItemTemplate const* proto = sObjectMgr->GetItemTemplate(itemId))
@@ -10812,12 +10826,6 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
cat = proto->Spells[idx].SpellCategory;
rec = proto->Spells[idx].SpellCooldown;
catrec = proto->Spells[idx].SpellCategoryCooldown;
if (static_cast<int32>(cat) != catrec)
{
useSpellCooldown = true;
}
break;
}
}
@@ -10854,14 +10862,7 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
// Now we have cooldown data (if found any), time to apply mods
if (rec > 0)
{
int32 oldRec = rec;
ApplySpellMod(spellInfo->Id, SPELLMOD_COOLDOWN, rec, spell);
if (oldRec != rec)
{
useSpellCooldown = true;
}
}
if (catrec > 0 && !spellInfo->HasAttribute(SPELL_ATTR6_NO_CATEGORY_COOLDOWN_MODS))
{
@@ -10874,7 +10875,6 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
if (HasSpell(spellInfo->Id))
{
needsCooldownPacket = true;
useSpellCooldown = true;
rec += cooldownMod * IN_MILLISECONDS; // SPELL_AURA_MOD_COOLDOWN does not affect category cooldows, verified with shaman shocks
}
}
@@ -10894,11 +10894,11 @@ void Player::AddSpellAndCategoryCooldowns(SpellInfo const* spellInfo, uint32 ite
// category spells
if (cat && catrec > 0)
{
_AddSpellCooldown(spellInfo->Id, cat, itemId, useSpellCooldown ? recTime : catrecTime, true, true);
_AddSpellCooldown(spellInfo->Id, 0, itemId, recTime, true, true);
if (needsCooldownPacket)
{
WorldPacket data;
BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, useSpellCooldown ? recTime : catrecTime);
BuildCooldownPacket(data, SPELL_COOLDOWN_FLAG_NONE, spellInfo->Id, recTime);
SendDirectMessage(&data);
}
@@ -13048,15 +13048,15 @@ bool ItemPosCount::isContainedIn(ItemPosCountVec const& vec) const
return false;
}
void Player::StopCastingBindSight()
void Player::StopCastingBindSight(Aura* except /*= nullptr*/)
{
if (WorldObject* target = GetViewpoint())
{
if (target->isType(TYPEMASK_UNIT))
{
((Unit*)target)->RemoveAurasByType(SPELL_AURA_BIND_SIGHT, GetGUID());
((Unit*)target)->RemoveAurasByType(SPELL_AURA_MOD_POSSESS, GetGUID());
((Unit*)target)->RemoveAurasByType(SPELL_AURA_MOD_POSSESS_PET, GetGUID());
((Unit*)target)->RemoveAurasByType(SPELL_AURA_BIND_SIGHT, GetGUID(), except);
((Unit*)target)->RemoveAurasByType(SPELL_AURA_MOD_POSSESS, GetGUID(), except);
((Unit*)target)->RemoveAurasByType(SPELL_AURA_MOD_POSSESS_PET, GetGUID(), except);
}
}
}
@@ -16237,3 +16237,8 @@ std::string Player::GetDebugInfo() const
sstr << Unit::GetDebugInfo();
return sstr.str();
}
void Player::SendSystemMessage(std::string_view msg, bool escapeCharacters)
{
ChatHandler(GetSession()).SendSysMessage(msg, escapeCharacters);
}