[7195] Implement SPELL_AURA_PHASE (261) and basics of phases system work (for player/creatures/pets only)

This commit is contained in:
VladimirMangos 2009-01-27 17:00:16 +03:00
parent 700fb25407
commit 430c634fd3
7 changed files with 75 additions and 18 deletions

View file

@ -18880,20 +18880,24 @@ void Player::UpdateZoneDependentAuras( uint32 newZone )
} }
// Some spells applied at enter into zone (with subzones) // Some spells applied at enter into zone (with subzones)
// Human Illusion switch(newZone)
// NOTE: these are removed by RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP);
if ( newZone == 2367 ) // Old Hillsbrad Foothills
{ {
uint32 spellid = 0; case 2367: // Old Hillsbrad Foothills
// all horde races {
if( GetTeam() == HORDE ) // Human Illusion
spellid = getGender() == GENDER_FEMALE ? 35481 : 35480; // NOTE: these are removed by RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_CHANGE_MAP);
// and some alliance races uint32 spellid = 0;
else if( getRace() == RACE_NIGHTELF || getRace() == RACE_DRAENEI ) // all horde races
spellid = getGender() == GENDER_FEMALE ? 35483 : 35482; if( GetTeam() == HORDE )
spellid = getGender() == GENDER_FEMALE ? 35481 : 35480;
// and some alliance races
else if( getRace() == RACE_NIGHTELF || getRace() == RACE_DRAENEI )
spellid = getGender() == GENDER_FEMALE ? 35483 : 35482;
if(spellid && !HasAura(spellid,0) ) if(spellid && !HasAura(spellid,0) )
CastSpell(this,spellid,true); CastSpell(this,spellid,true);
break;
}
} }
} }

View file

@ -303,7 +303,7 @@ enum AuraType
SPELL_AURA_258 = 258, SPELL_AURA_258 = 258,
SPELL_AURA_259 = 259, SPELL_AURA_259 = 259,
SPELL_AURA_SCREEN_EFFECT = 260, SPELL_AURA_SCREEN_EFFECT = 260,
SPELL_AURA_261 = 261, SPELL_AURA_PHASE = 261,
SPELL_AURA_262 = 262, SPELL_AURA_262 = 262,
SPELL_AURA_ALLOW_ONLY_ABILITY = 263, SPELL_AURA_ALLOW_ONLY_ABILITY = 263,
SPELL_AURA_264 = 264, SPELL_AURA_264 = 264,

View file

@ -311,9 +311,9 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNULL, //258 SPELL_AURA_MOD_SPELL_VISUAL &Aura::HandleNULL, //258 SPELL_AURA_MOD_SPELL_VISUAL
&Aura::HandleNULL, //259 corrupt healing over time spell &Aura::HandleNULL, //259 corrupt healing over time spell
&Aura::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code &Aura::HandleNoImmediateEffect, //260 SPELL_AURA_SCREEN_EFFECT (miscvalue = id in ScreenEffect.dbc) not required any code
&Aura::HandleNULL, //261 out of phase? &Aura::HandlePhase, //261 SPELL_AURA_PHASE undetactable invisibility? implemented in Unit::isVisibleForOrDetect
&Aura::HandleNULL, //262 &Aura::HandleNULL, //262
&Aura::HandleNULL, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilites set in SpellClassMask &Aura::HandleNULL, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
&Aura::HandleNULL, //264 unused &Aura::HandleNULL, //264 unused
&Aura::HandleNULL, //265 unused &Aura::HandleNULL, //265 unused
&Aura::HandleNULL, //266 unused &Aura::HandleNULL, //266 unused
@ -6568,3 +6568,25 @@ void Aura::HandleAuraConvertRune(bool apply, bool Real)
} }
} }
} }
void Aura::HandlePhase(bool apply, bool Real)
{
// no-phase is also phase state so same code for apply and remove
// phase auras normaly not expected at BG but anyway better check
if(Real && m_target->GetTypeId()==TYPEID_PLAYER)
{
// drop flag at invisible in bg
if(((Player*)m_target)->InBattleGround())
if(BattleGround *bg = ((Player*)m_target)->GetBattleGround())
bg->EventPlayerDroppedFlag((Player*)m_target);
}
// apply/remove only if not in GM invisibility
if(m_target->GetVisibility()!=VISIBILITY_OFF)
{
// just need triggering visibility update base at aura presence
m_target->SetVisibility(m_target->GetVisibility());
}
}

View file

@ -208,6 +208,7 @@ class MANGOS_DLL_SPEC Aura
void HandleAuraConvertRune(bool apply, bool Real); void HandleAuraConvertRune(bool apply, bool Real);
void HandleAuraIncreaseBaseHealthPercent(bool Apply, bool Real); void HandleAuraIncreaseBaseHealthPercent(bool Apply, bool Real);
void HandleNoReagentUseAura(bool Apply, bool Real); void HandleNoReagentUseAura(bool Apply, bool Real);
void HandlePhase(bool Apply, bool Real);
virtual ~Aura(); virtual ~Aura();

View file

@ -2383,6 +2383,10 @@ uint8 GetSpellAllowedInLocationError(SpellEntry const *spellInfo,uint32 map_id,u
case 51721: // Dominion Over Acherus case 51721: // Dominion Over Acherus
case 54055: // Dominion Over Acherus case 54055: // Dominion Over Acherus
return area_id == 4281 || area_id == 4342 ? 0 : SPELL_FAILED_INCORRECT_AREA; return area_id == 4281 || area_id == 4342 ? 0 : SPELL_FAILED_INCORRECT_AREA;
case 51852: // The Eye of Acherus
{
return map_id == 609 ? 0 : SPELL_FAILED_REQUIRES_AREA;
}
case 54119: // Mist of the Kvaldir case 54119: // Mist of the Kvaldir
return area_id == 4028 || area_id == 4029 || area_id == 4106 || area_id == 4031 ? 0 : SPELL_FAILED_INCORRECT_AREA; return area_id == 4028 || area_id == 4029 || area_id == 4106 || area_id == 4031 ? 0 : SPELL_FAILED_INCORRECT_AREA;
} }

View file

@ -9001,8 +9001,11 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList,
return false; return false;
} }
// Visible units, always are visible for all units, except for units under invisibility AuraList const& thisPhaseList = GetAurasByType (SPELL_AURA_PHASE);
if (m_Visibility == VISIBILITY_ON && u->m_invisibilityMask==0) AuraList const& uPhaseList = u->GetAurasByType (SPELL_AURA_PHASE);
// Visible units, always are visible for all units, except for units under invisibility and phases
if (m_Visibility == VISIBILITY_ON && u->m_invisibilityMask==0 && thisPhaseList.empty() && uPhaseList.empty())
return true; return true;
// GMs see any players, not higher GMs and all units // GMs see any players, not higher GMs and all units
@ -9018,6 +9021,29 @@ bool Unit::isVisibleForOrDetect(Unit const* u, bool detect, bool inVisibleList,
if (m_Visibility == VISIBILITY_OFF) if (m_Visibility == VISIBILITY_OFF)
return false; return false;
// phased visibility (both must phased or not phased)
if(thisPhaseList.empty() != uPhaseList.empty())
return false;
// phased visibility (in phased state work normal rules but both must have same phase)
if(!thisPhaseList.empty())
{
bool samePhase = false;
for(AuraList::const_iterator thisItr = thisPhaseList.begin(); thisItr != thisPhaseList.end(); ++thisItr)
{
uint32 thisPhase = (*thisItr)->GetMiscValue();
for(AuraList::const_iterator uItr = uPhaseList.begin(); uItr != uPhaseList.end(); ++uItr)
{
if((*uItr)->GetMiscValue()==thisPhase)
{
samePhase = true;
break;
}
}
}
if(!samePhase)
return false;
}
// raw invisibility // raw invisibility
bool invisible = (m_invisibilityMask != 0 || u->m_invisibilityMask !=0); bool invisible = (m_invisibilityMask != 0 || u->m_invisibilityMask !=0);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7194" #define REVISION_NR "7195"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__