*Fix the bug that pet is still attacking his enemy even if enemy has just entered sanctuary.
--HG-- branch : trunk
This commit is contained in:
@@ -507,6 +507,14 @@ struct AreaTableEntry
|
|||||||
char* area_name[16]; // 11-26
|
char* area_name[16]; // 11-26
|
||||||
// 27, string flags, unused
|
// 27, string flags, unused
|
||||||
uint32 team; // 28
|
uint32 team; // 28
|
||||||
|
|
||||||
|
// helpers
|
||||||
|
bool IsSanctuary() const
|
||||||
|
{
|
||||||
|
if (mapid == 609)
|
||||||
|
return true;
|
||||||
|
return (flags & AREA_FLAG_SANCTUARY);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AreaGroupEntry
|
struct AreaGroupEntry
|
||||||
|
|||||||
+2
-1
@@ -6343,10 +6343,11 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea)
|
|||||||
}
|
}
|
||||||
|
|
||||||
pvpInfo.inNoPvPArea = false;
|
pvpInfo.inNoPvPArea = false;
|
||||||
if((zone->flags & AREA_FLAG_SANCTUARY) || zone->mapid == 609) // in sanctuary
|
if(zone->IsSanctuary()) // in sanctuary
|
||||||
{
|
{
|
||||||
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
|
SetByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_SANCTUARY);
|
||||||
pvpInfo.inNoPvPArea = true;
|
pvpInfo.inNoPvPArea = true;
|
||||||
|
CombatStopWithPets();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
+8
-8
@@ -605,10 +605,10 @@ void Unit::DealDamageMods(Unit *pVictim, uint32 &damage, uint32* absorb)
|
|||||||
|
|
||||||
//You don't lose health from damage taken from another player while in a sanctuary
|
//You don't lose health from damage taken from another player while in a sanctuary
|
||||||
//You still see it in the combat log though
|
//You still see it in the combat log though
|
||||||
if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
|
if(pVictim != this && IsControlledByPlayer() && pVictim->IsControlledByPlayer())
|
||||||
{
|
{
|
||||||
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
|
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
|
||||||
if(area && area->flags & AREA_FLAG_SANCTUARY) //sanctuary
|
if(area && area->IsSanctuary()) //sanctuary
|
||||||
{
|
{
|
||||||
if(absorb)
|
if(absorb)
|
||||||
absorb += damage;
|
absorb += damage;
|
||||||
@@ -1380,7 +1380,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
|
|||||||
|
|
||||||
Unit *pVictim = damageInfo->target;
|
Unit *pVictim = damageInfo->target;
|
||||||
|
|
||||||
if(!this || !pVictim)
|
if(!pVictim)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||||
@@ -1395,10 +1395,10 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
|
|||||||
|
|
||||||
//You don't lose health from damage taken from another player while in a sanctuary
|
//You don't lose health from damage taken from another player while in a sanctuary
|
||||||
//You still see it in the combat log though
|
//You still see it in the combat log though
|
||||||
if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
|
if(pVictim != this && IsControlledByPlayer() && pVictim->IsControlledByPlayer())
|
||||||
{
|
{
|
||||||
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
|
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
|
||||||
if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary
|
if(area && area->IsSanctuary()) // sanctuary
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1623,7 +1623,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||||||
if (damageInfo==0) return;
|
if (damageInfo==0) return;
|
||||||
Unit *pVictim = damageInfo->target;
|
Unit *pVictim = damageInfo->target;
|
||||||
|
|
||||||
if(!this || !pVictim)
|
if(!pVictim)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||||
@@ -1631,10 +1631,10 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||||||
|
|
||||||
//You don't lose health from damage taken from another player while in a sanctuary
|
//You don't lose health from damage taken from another player while in a sanctuary
|
||||||
//You still see it in the combat log though
|
//You still see it in the combat log though
|
||||||
if(pVictim != this && GetTypeId() == TYPEID_PLAYER && pVictim->GetTypeId() == TYPEID_PLAYER)
|
if(pVictim != this && IsControlledByPlayer() && pVictim->IsControlledByPlayer())
|
||||||
{
|
{
|
||||||
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
|
const AreaTableEntry *area = GetAreaEntryByAreaID(pVictim->GetAreaId());
|
||||||
if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary
|
if(area && area->IsSanctuary()) // sanctuary
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user