Merge branch 'master' into Playerbot

This commit is contained in:
Yunfan Li
2023-07-18 17:59:18 +08:00
23 changed files with 759 additions and 666 deletions
+5 -18
View File
@@ -7226,6 +7226,9 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
continue;
}
if (entry && (entry->attributeMask & ENCHANT_PROC_ATTR_WHITE_HIT) && (procVictim & SPELL_PROC_FLAG_MASK))
continue;
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(pEnchant->spellid[s]);
if (!spellInfo)
{
@@ -7274,10 +7277,8 @@ void Player::CastItemCombatSpell(Unit* target, WeaponAttackType attType, uint32
item->SetEnchantmentCharges(EnchantmentSlot(e_slot), charges);
}
if (spellInfo->IsPositive())
CastSpell(this, spellInfo, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD), item);
else
CastSpell(target, spellInfo, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD), item);
Unit* unitTarget = spellInfo->IsPositive() ? this : target;
CastSpell(unitTarget, spellInfo, TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD), item);
}
}
}
@@ -9023,20 +9024,6 @@ void Player::RemovePet(Pet* pet, PetSaveMode mode, bool returnreagent)
{
pet->CombatStop();
if (returnreagent)
{
switch (pet->GetEntry())
{
//warlock pets except imp are removed(?) when logging out
case 1860:
case 1863:
case 417:
case 17252:
mode = PET_SAVE_NOT_IN_SLOT;
break;
}
}
// only if current pet in slot
pet->SavePetToDB(mode);
+24 -46
View File
@@ -4933,20 +4933,18 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
if (!unitTarget)
return;
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetSkipOnePacketForASH(m_caster->ToPlayer(), true);
}
// charge changes fall time
if( m_caster->GetTypeId() == TYPEID_PLAYER )
m_caster->ToPlayer()->SetFallInformation(GameTime::GetGameTime().count(), m_caster->GetPositionZ());
ObjectGuid targetGUID = ObjectGuid::Empty;
if (!m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) && !m_spellInfo->IsPositive() && m_caster->GetTypeId() == TYPEID_PLAYER &&
m_caster->GetTarget() == unitTarget->GetGUID())
Player* player = m_caster->ToPlayer();
if (player)
{
targetGUID = unitTarget->GetGUID();
sScriptMgr->AnticheatSetSkipOnePacketForASH(player, true);
// charge changes fall time
player->SetFallInformation(GameTime::GetGameTime().count(), m_caster->GetPositionZ());
if (!m_spellInfo->HasAttribute(SPELL_ATTR0_CANCELS_AUTO_ATTACK_COMBAT) && !m_spellInfo->IsPositive() && m_caster->GetTarget() == unitTarget->GetGUID())
{
targetGUID = unitTarget->GetGUID();
}
}
float speed = G3D::fuzzyGt(m_spellInfo->Speed, 0.0f) ? m_spellInfo->Speed : SPEED_CHARGE;
@@ -4955,20 +4953,15 @@ void Spell::EffectCharge(SpellEffIndex /*effIndex*/)
{
Position pos = unitTarget->GetFirstCollisionPosition(unitTarget->GetCombatReach(), unitTarget->GetRelativeAngle(m_caster));
m_caster->GetMotionMaster()->MoveCharge(pos.m_positionX, pos.m_positionY, pos.m_positionZ, speed, EVENT_CHARGE, nullptr, false, 0.0f, targetGUID);
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
}
}
else
{
m_caster->GetMotionMaster()->MoveCharge(*m_preGeneratedPath, speed, targetGUID);
}
if (m_caster->GetTypeId() == TYPEID_PLAYER)
{
sScriptMgr->AnticheatSetUnderACKmount(m_caster->ToPlayer());
}
if (player)
{
sScriptMgr->AnticheatSetUnderACKmount(player);
}
}
@@ -5144,13 +5137,10 @@ void Spell::EffectSendTaxi(SpellEffIndex effIndex)
if (!unitTarget)
return;
Player* player = unitTarget->ToPlayer();
if (!player)
if (Player* player = unitTarget->ToPlayer())
{
return;
player->ActivateTaxiPathTo(m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id);
}
player->ActivateTaxiPathTo(m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id);
}
void Spell::EffectPullTowards(SpellEffIndex effIndex)
@@ -5732,13 +5722,10 @@ void Spell::EffectKillCreditPersonal(SpellEffIndex effIndex)
if (!unitTarget)
return;
Player* player = unitTarget->GetCharmerOrOwnerPlayerOrPlayerItself();
if (!player)
if (Player* player = unitTarget->GetCharmerOrOwnerPlayerOrPlayerItself())
{
return;
player->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue);
}
player->KilledMonsterCredit(m_spellInfo->Effects[effIndex].MiscValue);
}
void Spell::EffectKillCredit(SpellEffIndex effIndex)
@@ -5774,13 +5761,10 @@ void Spell::EffectQuestFail(SpellEffIndex effIndex)
if (!unitTarget)
return;
Player* player = unitTarget->ToPlayer();
if (!player)
if (Player* player = unitTarget->ToPlayer())
{
return;
player->FailQuest(m_spellInfo->Effects[effIndex].MiscValue);
}
player->FailQuest(m_spellInfo->Effects[effIndex].MiscValue);
}
void Spell::EffectQuestStart(SpellEffIndex effIndex)
@@ -6190,13 +6174,10 @@ void Spell::EffectSpecCount(SpellEffIndex /*effIndex*/)
if (!unitTarget)
return;
Player* player = unitTarget->ToPlayer();
if (!player)
if (Player* player = unitTarget->ToPlayer())
{
return;
player->UpdateSpecCount(damage);
}
player->UpdateSpecCount(damage);
}
void Spell::EffectActivateSpec(SpellEffIndex /*effIndex*/)
@@ -6207,13 +6188,10 @@ void Spell::EffectActivateSpec(SpellEffIndex /*effIndex*/)
if (!unitTarget)
return;
Player* player = unitTarget->ToPlayer();
if (!player)
if (Player* player = unitTarget->ToPlayer())
{
return;
player->ActivateSpec(damage - 1); // damage is 1 or 2, spec is 0 or 1
}
player->ActivateSpec(damage - 1); // damage is 1 or 2, spec is 0 or 1
}
void Spell::EffectPlaySound(SpellEffIndex effIndex)
+2 -1
View File
@@ -306,7 +306,8 @@ typedef std::unordered_map<uint32, SpellProcEntry> SpellProcMap;
enum EnchantProcAttributes
{
ENCHANT_PROC_ATTR_EXCLUSIVE = 0x1 // Only one instance of that effect can be active
ENCHANT_PROC_ATTR_EXCLUSIVE = 0x1, // Only one instance of that effect can be active
ENCHANT_PROC_ATTR_WHITE_HIT = 0x2 // Enchant shall only proc off white hits (not abilities)
};
struct SpellEnchantProcEntry