*Handle SPELL_AURA_ABILITY_IGNORE_AURASTATE and SPELL_AURA_ALLOW_ONLY_ABILITY.

*Fix build on Windows.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-02-05 13:38:48 +01:00
parent 261425b0cc
commit 066b83b523
9 changed files with 78 additions and 27 deletions
@@ -1970,7 +1970,10 @@
</File>
</Filter>
<Filter
Name="Borean Tundra">
Name="Borean Tundra">
<File
RelativePath="..\scripts\zone\borean_tundra\borean_tundra.cpp"
>
</Filter>
<Filter
Name="Howling Fjord">
@@ -1080,6 +1080,9 @@
</Filter>
<Filter
Name="Borean Tundra">
<File
RelativePath="..\scripts\zone\borean_tundra\borean_tundra.cpp"
>
</Filter>
<Filter
Name="Howling Fjord">
@@ -750,6 +750,10 @@
<Filter
Name="Borean Tundra"
>
<File
RelativePath="..\scripts\zone\borean_tundra\borean_tundra.cpp"
>
</File>
</Filter>
<Filter
Name="Howling Fjord"
+1 -1
View File
@@ -2491,7 +2491,7 @@ void Player::InitStatsForLevel(bool reapplyMods)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE ); // must be set
// cleanup player flags (will be re-applied if need at aura load), to avoid have ghost flag without ghost aura, for example.
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK | PLAYER_FLAGS_DND | PLAYER_FLAGS_GM | PLAYER_FLAGS_GHOST);
RemoveFlag(PLAYER_FLAGS, PLAYER_FLAGS_AFK | PLAYER_FLAGS_DND | PLAYER_FLAGS_GM | PLAYER_FLAGS_GHOST | PLAYER_ALLOW_ONLY_ABILITY);
RemoveStandFlags(UNIT_STAND_FLAGS_ALL); // one form stealth modified bytes
RemoveByteFlag(UNIT_FIELD_BYTES_2, 1, UNIT_BYTE2_FLAG_FFA_PVP | UNIT_BYTE2_FLAG_SANCTUARY);
+2 -3
View File
@@ -400,9 +400,8 @@ enum PlayerFlags
PLAYER_FLAGS_UNK21 = 0x00100000,
PLAYER_FLAGS_UNK22 = 0x00200000,
PLAYER_FLAGS_UNK23 = 0x00400000,
PLAYER_FLAGS_UNK24 = 0x00800000, // disabled all abilitys on tab except autoattack
PLAYER_FLAGS_UNK25 = 0x01000000, // disabled all melee ability on tab include autoattack
PLAYER_ALLOW_ONLY_ABILITY = 0x00800000, // used by bladestorm and killing spree
PLAYER_FLAGS_UNK25 = 0x01000000 // disabled all melee ability on tab include autoattack
};
// used for PLAYER__FIELD_KNOWN_TITLES field (uint64), (1<<bit_index) without (-1)
+42 -19
View File
@@ -3554,6 +3554,9 @@ uint8 Spell::CanCast(bool strict)
// check cooldowns to prevent cheating
if(m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->HasSpellCooldown(m_spellInfo->Id))
{
//can cast triggered (by aura only?) spells while have this flag
if (!m_IsTriggeredSpell && ((Player*)m_caster)->HasFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY))
return SPELL_FAILED_SPELL_IN_PROGRESS;
if(m_triggeredByAuraSpell)
return SPELL_FAILED_DONT_REPORT;
else
@@ -3591,17 +3594,34 @@ uint8 Spell::CanCast(bool strict)
}
}
// caster state requirements
if(m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraState)))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot)))
return SPELL_FAILED_CASTER_AURASTATE;
bool reqAuraState=true;
Unit::AuraList const& stateAuras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
for(Unit::AuraList::const_iterator j = stateAuras.begin();j != stateAuras.end(); ++j)
{
if((*j)->isAffectedOnSpell(m_spellInfo))
{
reqAuraState=false;
break;
}
}
if (reqAuraState)
{
// caster state requirements
if(m_spellInfo->CasterAuraState && !m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraState)))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_spellInfo->CasterAuraStateNot && m_caster->HasAuraState(AuraState(m_spellInfo->CasterAuraStateNot)))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_spellInfo->casterAuraSpell && !m_caster->HasAura(m_spellInfo->casterAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_spellInfo->excludeCasterAuraSpell && m_caster->HasAura(m_spellInfo->excludeCasterAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
return SPELL_FAILED_AFFECTING_COMBAT;
}
// Caster aura req check if need
if(m_spellInfo->casterAuraSpell && !m_caster->HasAura(m_spellInfo->casterAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_spellInfo->excludeCasterAuraSpell && m_caster->HasAura(m_spellInfo->excludeCasterAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
// cancel autorepeat spells if cast start when moving
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
@@ -3617,20 +3637,23 @@ uint8 Spell::CanCast(bool strict)
if(target)
{
// target state requirements (not allowed state), apply to self also
if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot)))
return SPELL_FAILED_TARGET_AURASTATE;
if (reqAuraState)
{
// target state requirements (not allowed state), apply to self also
if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot)))
return SPELL_FAILED_TARGET_AURASTATE;
// Target aura req check if need
if(m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell))
return SPELL_FAILED_CASTER_AURASTATE;
if(m_spellInfo->targetAuraSpell && !target->HasAura(m_spellInfo->targetAuraSpell))
return SPELL_FAILED_TARGET_AURASTATE;
if(m_spellInfo->excludeTargetAuraSpell && target->HasAura(m_spellInfo->excludeTargetAuraSpell))
return SPELL_FAILED_TARGET_AURASTATE;
}
if(target != m_caster)
{
// target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds
if(m_spellInfo->TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState)))
if(reqAuraState && m_spellInfo->TargetAuraState && !target->HasAuraState(AuraState(m_spellInfo->TargetAuraState)))
return SPELL_FAILED_TARGET_AURASTATE;
// Not allow casting on flying player
+1 -1
View File
@@ -306,7 +306,7 @@ enum AuraType
SPELL_AURA_259 = 259,
SPELL_AURA_SCREEN_EFFECT = 260,
SPELL_AURA_PHASE = 261,
SPELL_AURA_262 = 262,
SPELL_AURA_ABILITY_IGNORE_AURASTATE = 262,
SPELL_AURA_ALLOW_ONLY_ABILITY = 263,
SPELL_AURA_264 = 264,
SPELL_AURA_265 = 265,
+20 -2
View File
@@ -316,8 +316,8 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&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::HandlePhase, //261 SPELL_AURA_PHASE undetactable invisibility? implemented in Unit::isVisibleForOrDetect
&Aura::HandleNULL, //262
&Aura::HandleNULL, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
&Aura::HandleNoImmediateEffect, //262 SPELL_AURA_ABILITY_IGNORE_AURASTATE implemented in spell::cancast
&Aura::HandleAuraAllowOnlyAbility, //263 SPELL_AURA_ALLOW_ONLY_ABILITY player can use only abilities set in SpellClassMask
&Aura::HandleNULL, //264 unused
&Aura::HandleNULL, //265 unused
&Aura::HandleNULL, //266 unused
@@ -4967,6 +4967,23 @@ void Aura::HandleNoReagentUseAura(bool Apply, bool Real)
/*** OTHERS ***/
/*********************************************************/
void Aura::HandleAuraAllowOnlyAbility(bool apply, bool Real)
{
if(!Real)
return;
if(!apply && m_target->HasAuraType(SPELL_AURA_ALLOW_ONLY_ABILITY))
return;
if(m_target->GetTypeId()==TYPEID_PLAYER)
{
if (apply)
m_target->SetFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY);
else
m_target->RemoveFlag(PLAYER_FLAGS, PLAYER_ALLOW_ONLY_ABILITY);
}
}
void Aura::HandleShapeshiftBoosts(bool apply)
{
uint32 spellId = 0;
@@ -6538,3 +6555,4 @@ void Aura::HandlePhase(bool apply, bool Real)
if(m_target->GetVisibility()!=VISIBILITY_OFF)
m_target->SetVisibility(m_target->GetVisibility());
}
+1
View File
@@ -305,6 +305,7 @@ class TRINITY_DLL_SPEC Aura
Unit* GetTriggerTarget() const;
// add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras
void HandleAuraAllowOnlyAbility(bool apply, bool Real);
void HandleShapeshiftBoosts(bool apply);
// Allow Apply Aura Handler to modify and access m_AuraDRGroup