mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[10336] Server side checks for casting non-combat spells in combat.
Interrupt casting non combat spell spell at neter to combat and prevent it casting in combat (last checked by client but better recheck at server for prevent cheating).
This commit is contained in:
parent
7e251dd408
commit
085811fc06
3 changed files with 15 additions and 6 deletions
|
|
@ -4207,15 +4207,18 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
}
|
||||
|
||||
// only allow triggered spells if at an ended battleground
|
||||
if( !m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if (!m_IsTriggeredSpell && m_caster->GetTypeId() == TYPEID_PLAYER)
|
||||
if(BattleGround * bg = ((Player*)m_caster)->GetBattleGround())
|
||||
if(bg->GetStatus() == STATUS_WAIT_LEAVE)
|
||||
return SPELL_FAILED_DONT_REPORT;
|
||||
|
||||
if(m_caster->GetTypeId() == TYPEID_PLAYER && !((Player*)m_caster)->isGameMaster() &&
|
||||
VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled())
|
||||
if (m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
|
||||
return m_triggeredByAuraSpell ? SPELL_FAILED_DONT_REPORT : SPELL_FAILED_AFFECTING_COMBAT;
|
||||
|
||||
if (m_caster->GetTypeId() == TYPEID_PLAYER && !((Player*)m_caster)->isGameMaster() &&
|
||||
VMAP::VMapFactory::createOrGetVMapManager()->isLineOfSightCalcEnabled())
|
||||
{
|
||||
if(m_spellInfo->Attributes & SPELL_ATTR_OUTDOORS_ONLY &&
|
||||
if (m_spellInfo->Attributes & SPELL_ATTR_OUTDOORS_ONLY &&
|
||||
!m_caster->GetMap()->IsOutdoors(m_caster->GetPositionX(), m_caster->GetPositionY(), m_caster->GetPositionZ()))
|
||||
return SPELL_FAILED_ONLY_OUTDOORS;
|
||||
|
||||
|
|
@ -4902,7 +4905,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||
if(!pet->GetCurrentFoodBenefitLevel(foodItem->GetProto()->ItemLevel))
|
||||
return SPELL_FAILED_FOOD_LOWLEVEL;
|
||||
|
||||
if(m_caster->isInCombat() || pet->isInCombat())
|
||||
if(pet->isInCombat())
|
||||
return SPELL_FAILED_AFFECTING_COMBAT;
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -7457,6 +7457,12 @@ void Unit::SetInCombatState(bool PvP, Unit* enemy)
|
|||
if (isCharmed() || (GetTypeId()!=TYPEID_PLAYER && ((Creature*)this)->isPet()))
|
||||
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PET_IN_COMBAT);
|
||||
|
||||
// interrupt all delayed non-combat casts
|
||||
for (uint32 i = CURRENT_FIRST_NON_MELEE_SPELL; i < CURRENT_MAX_SPELL; ++i)
|
||||
if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i)))
|
||||
if (IsNonCombatSpell(spell->m_spellInfo))
|
||||
InterruptSpell(CurrentSpellTypes(i),false);
|
||||
|
||||
if (creatureNotInCombat)
|
||||
{
|
||||
// should probably be removed for the attacked (+ it's party/group) only, not global
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "10335"
|
||||
#define REVISION_NR "10336"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue