diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/game/DBCStructure.h | 8 | ||||
-rw-r--r-- | src/game/Player.cpp | 3 | ||||
-rw-r--r-- | src/game/Unit.cpp | 16 |
3 files changed, 18 insertions, 9 deletions
diff --git a/src/game/DBCStructure.h b/src/game/DBCStructure.h index eaca4737cc3..09cd8daa8ec 100644 --- a/src/game/DBCStructure.h +++ b/src/game/DBCStructure.h @@ -507,6 +507,14 @@ struct AreaTableEntry char* area_name[16]; // 11-26 // 27, string flags, unused uint32 team; // 28 + + // helpers + bool IsSanctuary() const + { + if (mapid == 609) + return true; + return (flags & AREA_FLAG_SANCTUARY); + } }; struct AreaGroupEntry diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 0c3438ae509..62f712aabf1 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -6343,10 +6343,11 @@ void Player::UpdateZone(uint32 newZone, uint32 newArea) } 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); pvpInfo.inNoPvPArea = true; + CombatStopWithPets(); } else { diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp index 73d726d300a..4694dd08bf0 100644 --- a/src/game/Unit.cpp +++ b/src/game/Unit.cpp @@ -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 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()); - if(area && area->flags & AREA_FLAG_SANCTUARY) //sanctuary + if(area && area->IsSanctuary()) //sanctuary { if(absorb) absorb += damage; @@ -1380,7 +1380,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss) Unit *pVictim = damageInfo->target; - if(!this || !pVictim) + if(!pVictim) return; 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 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()); - if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary + if(area && area->IsSanctuary()) // sanctuary return; } @@ -1623,7 +1623,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss) if (damageInfo==0) return; Unit *pVictim = damageInfo->target; - if(!this || !pVictim) + if(!pVictim) return; 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 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()); - if(area && area->flags & AREA_FLAG_SANCTUARY) // sanctuary + if(area && area->IsSanctuary()) // sanctuary return; } |