Update aura system:

* Change system logic - unify Auras, AreaAuras and PersistentAreaAuras:
  * Aura has now its owner - which is the WorldObject, which applies aura (creates AuraApplication object) dependant on aura radius, and effect type
  * Owner can be Dynobj (DynObjAura class) for PersistentAreaAuras, or Unit (UnitAura class) for Area and nonArea auras
  * Aura data is shared for all units which have AuraApplication of the Aura
   * Because of that AuraEffect handlers , and periodic tick functions can't modify AuraEffect object (they are const now)
  * Remove spell source and AreaAuraEffect classes
  * Add AuraEffect::UpdatePeriodic function, to allow periodic aura object modification (target independant)
  * Add AuraEffect::CalculateAmount and AuraEffect::CalculateSpellMod function, to allow non-default amount calculation
  * AreaAura updates are done in owner _UpdateSpells cycle
  * Since now you don't need to wait an aura update cycle to get area aura applied on it's correct target list
  * And you can access area aura target list
  * Add basic support for aura amount recalculation
  * Save recalculation state and base amount of auras to db
  * Add AuraEffect::CalculatePeriodic function to determine if aura is periodic, and to set correct tick number after aura is loaded from db
  * Add ChangeAmount function in addition to SetAmount function, to allow easy reapplication of AuraEffect handlers on all targets
  * Sort aura effect handlers in SpellAuras.cpp and .h by their use
  * Add check for already existing aura of that type to some AuraEffect handlers, to prevent incorrect effect removal
  * SPELL_AURA_CONVERT_RUNE and MOD_POWER_REGEN and MOD_REGEN hacky handlers are now implemented correctly
  * Send aura application client update only once per unit update - prevent unnecesary packet spam
 * Fix ByteBuffer::appendPackGUID function - it added additionall 0s at the end of the packet
 * Fix memory leak at player creation (not deleted auras)
 * Updated some naming conventions (too many to mention)
 * Added Unit::GetAuraOfRankedSpell() function
 * Remove procflags on aura remove, use Aura::HandleAuraSpecificMods instead
 * Added functions to maintain owned auras (GetOwnedAuras, GetOwnedAura, RemoveOwnedAura, etc)
 * Implement AURA_INTERRUPT_FLAG_LANDING
 * Implement EffectPlayerNotification (thanks to Spp)
 * Remove wrong aura 304 handler
 * Add better handler for death runes
 * Remove unnecesary variables from DynamicObject class, and cleanup related code, link dynobj duration with aura
 * Add GetAuraEffectTriggerTarget function in CreatureAi for special target selection for periodic trigger auras used in a script
 * Add many assert() procection from idiots using some functions in wrong way
 * I am to lazy to write here anything more
Thanks to Visagalis for testing this patch
PS: Do not make patches like this, please

--HG--
branch : trunk
This commit is contained in:
QAston
2010-01-10 01:23:15 +01:00
parent a0f7762cab
commit 8e9d2cdf01
55 changed files with 10071 additions and 9861 deletions
+8
View File
@@ -445,10 +445,14 @@ CREATE TABLE `character_aura` (
`caster_guid` bigint(20) unsigned NOT NULL default '0' COMMENT 'Full Global Unique Identifier',
`spell` int(11) unsigned NOT NULL default '0',
`effect_mask` tinyint(3) unsigned NOT NULL default '0',
`recalculate_mask` tinyint(3) unsigned NOT NULL default '0',
`stackcount` tinyint(3) unsigned NOT NULL default '1',
`amount0` int(11) NOT NULL default '0',
`amount1` int(11) NOT NULL default '0',
`amount2` int(11) NOT NULL default '0',
`base_amount0` int(11) NOT NULL default '0',
`base_amount1` int(11) NOT NULL default '0',
`base_amount2` int(11) NOT NULL default '0',
`maxduration` int(11) NOT NULL default '0',
`remaintime` int(11) NOT NULL default '0',
`remaincharges` tinyint(3) unsigned NOT NULL default '0',
@@ -1517,10 +1521,14 @@ CREATE TABLE `pet_aura` (
`caster_guid` bigint(20) unsigned NOT NULL default '0' COMMENT 'Full Global Unique Identifier',
`spell` int(11) unsigned NOT NULL default '0',
`effect_mask` tinyint(3) unsigned NOT NULL default '0',
`recalculate_mask` tinyint(3) unsigned NOT NULL default '0',
`stackcount` tinyint(3) unsigned NOT NULL default '1',
`amount0` int(11) NOT NULL default '0',
`amount1` int(11) NOT NULL default '0',
`amount2` int(11) NOT NULL default '0',
`base_amount0` int(11) NOT NULL default '0',
`base_amount1` int(11) NOT NULL default '0',
`base_amount2` int(11) NOT NULL default '0',
`maxduration` int(11) NOT NULL default '0',
`remaintime` int(11) NOT NULL default '0',
`remaincharges` tinyint(3) unsigned NOT NULL default '0',
@@ -0,0 +1,5 @@
ALTER TABLE `character_aura`
ADD COLUMN `base_amount0` INT(11) NOT NULL DEFAULT '0' AFTER `amount2`,
ADD COLUMN `base_amount1` INT(11) NOT NULL DEFAULT '0' AFTER `base_amount0`,
ADD COLUMN `base_amount2` INT(11) NOT NULL DEFAULT '0' AFTER `base_amount1`,
ADD COLUMN `recalculate_mask` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `effect_mask`;
+5
View File
@@ -0,0 +1,5 @@
ALTER TABLE `pet_aura` DROP PRIMARY KEY,
ADD COLUMN `base_amount0` INT(11) NOT NULL DEFAULT '0' AFTER `amount2`,
ADD COLUMN `base_amount1` INT(11) NOT NULL DEFAULT '0' AFTER `base_amount0`,
ADD COLUMN `base_amount2` INT(11) NOT NULL DEFAULT '0' AFTER `base_amount1`,
ADD COLUMN `recalculate_mask` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0' AFTER `effect_mask`;
@@ -0,0 +1 @@
DELETE FROM spell_proc_event WHERE procEx & 0x6000;
-14
View File
@@ -5778,9 +5778,6 @@ INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFam
( 15286, 0x20, 6, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Vampiric Embrace
( 15337, 0x00, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Improved Spirit Tap (Rank 1)
( 15338, 0x00, 6, 0x00002000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Improved Spirit Tap (Rank 2)
( 15318, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x00002000, 0, 0, 0), -- Shadow Affinity (Rank 1)
( 15272, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x00002000, 0, 0, 0), -- Shadow Affinity (Rank 2)
( 15320, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x02000000, 0x00002000, 0, 0, 0), -- Shadow Affinity (Rank 3)
( 15346, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 6, 0, 0), -- Seal of Reckoning
( 15362, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Inspiration (Rank 2)
( 15363, 0x00, 6, 0x10001E00, 0x00010004, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Inspiration (Rank 3)
@@ -5986,9 +5983,6 @@ INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFam
( 30937, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Mark of Shadow
( 31124, 0x00, 8, 0x01000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blade Twisting (Rank 1)
( 31126, 0x00, 8, 0x01000006, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blade Twisting (Rank 2)
( 31221, 0x00, 8, 0x00400000, 0x00000000, 0x00000000, 0x00000400, 0x00006001, 0, 0, 0), -- Master of Subtlety (Rank 1)
( 31222, 0x00, 8, 0x00400000, 0x00000000, 0x00000000, 0x00000400, 0x00006001, 0, 0, 0), -- Master of Subtlety (Rank 2)
( 31223, 0x00, 8, 0x00400000, 0x00000000, 0x00000000, 0x00000400, 0x00006001, 0, 0, 0), -- Master of Subtlety (Rank 3)
( 31244, 0x00, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00000004, 0, 0, 0), -- Quick Recovery (Rank 1)
( 31245, 0x00, 8, 0x003E0000, 0x00000009, 0x00000000, 0x00000000, 0x00000004, 0, 0, 0), -- Quick Recovery (Rank 2)
( 31394, 0x20, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Mark of Shadow
@@ -6208,7 +6202,6 @@ INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFam
( 44557, 0x00, 3, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Enduring Winter (Rank 1)
( 44560, 0x00, 3, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Enduring Winter (Rank 2)
( 44561, 0x00, 3, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Enduring Winter (Rank 3)
( 44745, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00004000, 0x00002000, 0, 0, 0), -- Shattered Barrier (Rank 1)
( 44835, 0x00, 7, 0x00000000, 0x00000080, 0x00000000, 0x00000010, 0x00000000, 0, 0, 0), -- Maim Interrupt
( 45054, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Augment Pain
( 45057, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 30), -- Evasive Maneuvers
@@ -6261,9 +6254,6 @@ INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFam
( 47515, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Divine Aegis (Rank 3)
( 47516, 0x00, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Grace (Rank 1)
( 47517, 0x00, 6, 0x00001800, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Grace (Rank 2)
( 47535, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00004000, 0x00002000, 0, 0, 12), -- Rapture (Rank 1)
( 47536, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00004000, 0x00002000, 0, 0, 12), -- Rapture (Rank 2)
( 47537, 0x00, 6, 0x00000001, 0x00000000, 0x00000000, 0x00004000, 0x00002000, 0, 0, 12), -- Rapture (Rank 3)
( 47569, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Improved Shadowform (Rank 1)
( 47570, 0x00, 6, 0x00004000, 0x00000000, 0x00000000, 0x00004000, 0x00000000, 0, 0, 0), -- Improved Shadowform (Rank 2)
( 47580, 0x00, 6, 0x00000000, 0x00000000, 0x00000040, 0x00000000, 0x00010000, 0, 0, 0), -- Pain and Suffering (Rank 1)
@@ -6434,8 +6424,6 @@ INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFam
( 53709, 0x02, 10, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shield of the templar
( 53710, 0x02, 10, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shield of the templar
( 53711, 0x02, 10, 0x00004000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Shield of the templar
( 53754, 0x00, 5, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00006000, 0, 0, 0), -- Improved Fear (Rank 1)
( 53759, 0x00, 5, 0x00000000, 0x00000400, 0x00000000, 0x00000000, 0x00006000, 0, 0, 0), -- Improved Fear (Rank 2)
( 54149, 0x00, 10, 0x00200000, 0x00010000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 0), -- Infusion of Light (Rank 2)
( 54151, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 3)
( 54154, 0x00, 10, 0x00800000, 0x00000000, 0x00000000, 0x00000000, 0x00040000, 0, 0, 0), -- Judgements of the Pure (Rank 4)
@@ -6451,7 +6439,6 @@ INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFam
( 54747, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Burning Determination (Rank 1)
( 54749, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00010000, 0, 0, 0), -- Burning Determination (Rank 2)
( 54754, 0x00, 7, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Rejuvenation
( 54787, 0x00, 3, 0x00000000, 0x00000001, 0x00000000, 0x00004000, 0x00002000, 0, 0, 0), -- Shattered Barrier (Rank 2)
( 54808, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 60), -- Sonic Shield
( 54838, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 45), -- Purified Spirit
( 54841, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000002, 0, 0, 3), -- Thunder Capacitor
@@ -6496,7 +6483,6 @@ INSERT INTO `spell_proc_event` (`entry`,`SchoolMask`,`SpellFamilyName`,`SpellFam
( 58364, 0x00, 4, 0x00000400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Revenge
( 58372, 0x00, 4, 0x00000002, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Hamstring
( 58386, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000020, 0, 0, 0), -- Glyph of Overpower
( 58426, 0x00, 8, 0x00400000, 0x00000000, 0x00000000, 0x00000400, 0x00006001, 0, 0, 0), -- Overkill
( 58442, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 15), -- Airy Pale Ale
( 58444, 0x00, 0, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 5), -- Worg Tooth Oatmeal Stout
( 58626, 0x00, 15, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Glyph of Death Grip
@@ -413,15 +413,7 @@ struct TRINITY_DLL_DECL boss_veknilashAI : public boss_twinemperorsAI
{
pTarget->setFaction(14);
pTarget->AI()->AttackStart(m_creature->getThreatManager().getHostilTarget());
SpellEntry *spell = GET_SPELL(SPELL_MUTATE_BUG);
uint8 eff_mask=0;
for (int i=0; i<3; ++i)
{
if (!spell->Effect[i])
continue;
eff_mask|=1<<i;
}
pTarget->AddAura(new Aura(spell, eff_mask, pTarget, pTarget, pTarget));
pTarget->AddAura(SPELL_MUTATE_BUG, pTarget);
pTarget->SetHealth(pTarget->GetMaxHealth());
}
@@ -498,15 +490,7 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI
void CastSpellOnBug(Creature *pTarget)
{
pTarget->setFaction(14);
SpellEntry *spell = GET_SPELL(SPELL_EXPLODEBUG);
uint8 eff_mask=0;
for (int i=0; i<3; ++i)
{
if (!spell->Effect[i])
continue;
eff_mask|=1<<i;
}
pTarget->AddAura(new Aura(spell, eff_mask, pTarget, pTarget, pTarget));
pTarget->AddAura(SPELL_EXPLODEBUG, pTarget);
pTarget->SetHealth(pTarget->GetMaxHealth());
}
@@ -53,19 +53,6 @@ EndScriptData */
#define SPELL_STORM_BUFF 2148
#define SPELL_STORM 26546
struct TRINITY_DLL_DECL aqsentinelAI;
class TRINITY_DLL_DECL SentinelAbilityAura : public Aura
{
public:
~SentinelAbilityAura();
Unit* GetTriggerTarget() const;
SentinelAbilityAura(aqsentinelAI *abilityOwner, SpellEntry *spell, uint32 ability, uint32 eff);
protected:
aqsentinelAI *aOwner;
int32 currentBasePoints;
uint32 abilityId;
};
struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI
{
uint32 ability;
@@ -222,16 +209,7 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI
void GainSentinelAbility(uint32 id)
{
const SpellEntry *spell = GetSpellStore()->LookupEntry(id);
uint8 eff_mask=0;
for (int i=0; i<3; ++i)
{
if (!spell->Effect[i])
continue;
eff_mask=1<<i;
}
SentinelAbilityAura *a = new SentinelAbilityAura(this, (SpellEntry*)spell, id, eff_mask);
m_creature->AddAura(a);
m_creature->AddAura(id, m_creature);
}
void EnterCombat(Unit *who)
@@ -260,7 +238,7 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI
}
}
Unit *GetHatedManaUser()
Unit *GetHatedManaUser() const
{
std::list<HostilReference*>::iterator i;
for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ++i)
@@ -271,6 +249,28 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI
}
return NULL;
}
Unit* GetAuraEffectTriggerTarget(uint32 spellId, uint8 effIndex) const
{
switch (spellId)
{
case SPELL_KNOCK_BUFF:
case SPELL_THUNDER_BUFF:
case SPELL_MSTRIKE_BUFF:
case SPELL_STORM_BUFF:
return m_creature->getVictim();
case SPELL_MANAB_BUFF:
return GetHatedManaUser();
case SPELL_MENDING_BUFF:
case SPELL_REFLECTAF_BUFF:
case SPELL_REFLECTSFr_BUFF:
case SPELL_THORNS_BUFF:
default:
return m_creature;
}
}
};
CreatureAI* GetAI_mob_anubisath_sentinelAI(Creature* pCreature)
{
@@ -285,34 +285,3 @@ void AddSC_mob_anubisath_sentinel()
newscript->GetAI = &GetAI_mob_anubisath_sentinelAI;
newscript->RegisterSelf();
}
SentinelAbilityAura::~SentinelAbilityAura() {}
Unit* SentinelAbilityAura::GetTriggerTarget() const
{
switch (abilityId)
{
case SPELL_KNOCK_BUFF:
case SPELL_THUNDER_BUFF:
case SPELL_MSTRIKE_BUFF:
case SPELL_STORM_BUFF:
return aOwner->m_creature->getVictim();
case SPELL_MANAB_BUFF:
return aOwner->GetHatedManaUser();
case SPELL_MENDING_BUFF:
case SPELL_REFLECTAF_BUFF:
case SPELL_REFLECTSFr_BUFF:
case SPELL_THORNS_BUFF:
default:
return aOwner->m_creature;
}
}
SentinelAbilityAura::SentinelAbilityAura(aqsentinelAI *abilityOwner, SpellEntry *spell, uint32 ability, uint32 eff)
: Aura(spell, eff, abilityOwner->m_creature, abilityOwner->m_creature, abilityOwner->m_creature, NULL)
{
aOwner = abilityOwner;
abilityId = ability;
}
@@ -133,9 +133,8 @@ struct TRINITY_DLL_DECL boss_trollgoreAI : public ScriptedAI
{
if (uiAuraCountTimer <= diff)
{
if (m_creature->HasAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME)))
if (Aura *pConsumeAura = m_creature->GetAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME)))
{
Aura *pConsumeAura = m_creature->GetAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME));
if (pConsumeAura && pConsumeAura->GetStackAmount() > 9)
bAchiev = false;
}
@@ -225,7 +225,7 @@ struct TRINITY_DLL_DECL mob_tempest_minionAI : public ScriptedAI
if(me->hasUnitState(UNIT_STAT_CASTING))
return;
if(Aura *OverchargedAura = m_creature->GetAura(SPELL_OVERCHARGED))
if(Aura * OverchargedAura = m_creature->GetAura(SPELL_OVERCHARGED))
{
if(OverchargedAura->GetStackAmount() < 10)
{
@@ -92,10 +92,8 @@ struct TRINITY_DLL_DECL mob_voidtravelerAI : public ScriptedAI
{
if (sacrificed)
{
SpellEntry *spell = GET_SPELL(HeroicMode?H_SPELL_EMPOWERING_SHADOWS:SPELL_EMPOWERING_SHADOWS);
if (spell)
Vorpil->AddAura(new Aura(spell, 1, Vorpil, me, me));
Vorpil->SetHealth(Vorpil->GetHealth()+Vorpil->GetMaxHealth()/25);
m_creature->AddAura(HEROIC(H_SPELL_EMPOWERING_SHADOWS, SPELL_EMPOWERING_SHADOWS), Vorpil);
Vorpil->SetHealth(Vorpil->GetHealth() + Vorpil->GetMaxHealth()/25);
DoCast(m_creature, SPELL_SHADOW_NOVA, true);
m_creature->Kill(m_creature);
return;
@@ -636,21 +636,7 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI
{
m_creature->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z);
if (m_creature->IsWithinDist3d(MIDDLE_X, MIDDLE_Y, MIDDLE_Z, 3))
{
SpellEntry *spell = GET_SPELL(SPELL_SURGE);
if (spell)
{
uint8 eff_mask=0;
for (uint8 i = 0; i < 3; ++i)
{
if (!spell->Effect[i])
continue;
eff_mask|=1<<i;
}
Vashj->AddAura(new Aura(spell, eff_mask, Vashj, Vashj, Vashj));
}
m_creature->Kill(m_creature);
}
DoCast(m_creature, SPELL_SURGE);
}
if (!Vashj->isInCombat() || CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase != 2 || Vashj->isDead())
{
@@ -497,14 +497,8 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI
demon->AI()->AttackStart((*itr));
CAST_AI(mob_inner_demonAI, demon->AI())->victimGUID = (*itr)->GetGUID();
uint8 eff_mask=0;
for (int i=0; i<3; ++i)
{
if (!spell->Effect[i])
continue;
eff_mask|=1<<i;
}
(*itr)->AddAura(new Aura(spell, eff_mask, *itr, *itr, *itr));
(*itr)->AddAura(SPELL_INSIDIOUS_WHISPER, *itr);
if (InnerDemon_Count > 4)
InnerDemon_Count = 0;
@@ -232,14 +232,8 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI
if (SpellEntry *nova = GET_SPELL(SPELL_BURNING_NOVA))
{
uint8 eff_mask=0;
for (int i=0; i<3; ++i)
{
if (!nova->Effect[i])
continue;
eff_mask|=1<<i;
}
m_creature->AddAura(new Aura(nova, eff_mask, me, me, me));
if (Aura * aura = Aura::TryCreate(nova, me, me))
aura->ApplyForTargets();
}
if (HeroicMode)
@@ -190,7 +190,7 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI
if (!pWho->IsWithinDistInMap(m_creature, RANGE_GUARDS_MARK))
return;
Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK, 0);
Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK);
if (pMarkAura)
{
// the target wasn't able to move out of our range within 25 seconds
@@ -202,7 +202,7 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI
return;
}
if (pMarkAura->GetAuraDuration() < AURA_DURATION_TIME_LEFT)
if (pMarkAura->GetDuration() < AURA_DURATION_TIME_LEFT)
{
if (!pLastSpawnedGuard->getVictim())
pLastSpawnedGuard->AI()->AttackStart(pWho);
+10 -8
View File
@@ -34,6 +34,7 @@
#include "MapManager.h"
#include "Object.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "Util.h"
namespace Trinity
@@ -427,15 +428,16 @@ void BattleGround::Update(uint32 diff)
{
plr->RemoveAurasDueToSpell(SPELL_ARENA_PREPARATION);
// remove auras with duration lower than 30s
Unit::AuraMap & aurMap = plr->GetAuras();
for (Unit::AuraMap::iterator iter = aurMap.begin(); iter != aurMap.end();)
Unit::AuraMap & auraMap = plr->GetOwnedAuras();
for (Unit::AuraMap::iterator iter = auraMap.begin(); iter != auraMap.end();)
{
if (!iter->second->IsPermanent()
&& iter->second->GetAuraDuration()<=30*IN_MILISECONDS
&& iter->second->IsPositive()
&& (!(iter->second->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
&& (!iter->second->IsAuraType(SPELL_AURA_MOD_INVISIBILITY)))
plr->RemoveAura(iter);
Aura * aura = iter->second;
if (!aura->IsPermanent()
&& aura->GetDuration() <= 30*IN_MILISECONDS
&& aura->IsPositive(plr)
&& (!(aura->GetSpellProto()->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY))
&& (!aura->HasEffectType(SPELL_AURA_MOD_INVISIBILITY)))
plr->RemoveOwnedAura(iter);
else
++iter;
}
+2
View File
@@ -232,6 +232,8 @@ SET(game_STAT_SRCS
SpellAuraDefines.h
SpellAuras.cpp
SpellAuras.h
SpellAuraEffects.cpp
SpellAuraEffects.h
Spell.cpp
SpellEffects.cpp
SpellId.h
+3 -1
View File
@@ -68,7 +68,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points, instance_id, speccount, activespec FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_mask,stackcount,amount0, amount1, amount2 ,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADSPELLS, "SELECT spell,active,disabled FROM character_spell WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADQUESTSTATUS, "SELECT quest,status,rewarded,explored,timer,mobcount1,mobcount2,mobcount3,mobcount4,itemcount1,itemcount2,itemcount3,itemcount4 FROM character_queststatus WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADDAILYQUESTSTATUS,"SELECT quest,time FROM character_queststatus_daily WHERE guid = '%u'", GUID_LOPART(m_guid));
@@ -454,6 +454,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
if(!pNewChar->Create( objmgr.GenerateLowGuid(HIGHGUID_PLAYER), name, race_, class_, gender, skin, face, hairStyle, hairColor, facialHair, outfitId ))
{
// Player not create (race/class problem?)
pNewChar->CleanupsBeforeDelete();
delete pNewChar;
data << (uint8)CHAR_CREATE_ERROR;
@@ -472,6 +473,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data )
loginDatabase.PExecute("DELETE FROM realmcharacters WHERE acctid= '%d' AND realmid = '%d'", GetAccountId(), realmID);
loginDatabase.PExecute("INSERT INTO realmcharacters (numchars, acctid, realmid) VALUES (%u, %u, %u)", charcount, GetAccountId(), realmID);
pNewChar->CleanupsBeforeDelete();
delete pNewChar; // created only to call SaveToDB()
data << (uint8)CHAR_CREATE_SUCCESS;
+3 -2
View File
@@ -38,6 +38,7 @@
#include "Player.h"
#include "ScriptCalls.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "Util.h"
bool WorldSession::processChatmessageFurtherAfterSecurityChecks(std::string& msg, uint32 lang)
@@ -88,7 +89,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
if(langDesc->skill_id != 0 && !_player->HasSkill(langDesc->skill_id))
{
// also check SPELL_AURA_COMPREHEND_LANGUAGE (client offers option to speak in that language)
Unit::AuraEffectList const& langAuras = _player->GetAurasByType(SPELL_AURA_COMPREHEND_LANGUAGE);
Unit::AuraEffectList const& langAuras = _player->GetAuraEffectsByType(SPELL_AURA_COMPREHEND_LANGUAGE);
bool foundAura = false;
for (Unit::AuraEffectList::const_iterator i = langAuras.begin(); i != langAuras.end(); ++i)
{
@@ -159,7 +160,7 @@ void WorldSession::HandleMessagechatOpcode( WorldPacket & recv_data )
}
// but overwrite it by SPELL_AURA_MOD_LANGUAGE auras (only single case used)
Unit::AuraEffectList const& ModLangAuras = _player->GetAurasByType(SPELL_AURA_MOD_LANGUAGE);
Unit::AuraEffectList const& ModLangAuras = _player->GetAuraEffectsByType(SPELL_AURA_MOD_LANGUAGE);
if(!ModLangAuras.empty())
lang = ModLangAuras.front()->GetMiscValue();
}
+23 -7
View File
@@ -47,6 +47,7 @@
#include "GameEventMgr.h"
#include "CreatureGroups.h"
#include "Vehicle.h"
#include "SpellAuraEffects.h"
// apply implementation of the singletons
#include "Policies/SingletonImp.h"
@@ -142,7 +143,7 @@ m_creatureInfo(NULL), m_reactState(REACT_AGGRESSIVE), m_formation(NULL)
, m_AlreadySearchedAssistance(false)
, m_creatureData(NULL), m_PlayerDamageReq(0)
{
m_regenTimer = 2000;
m_regenTimer = CREATURE_REGEN_INTERVAL;
m_valuesCount = UNIT_END;
for (uint8 i = 0; i < CREATURE_MAX_SPELLS; ++i)
@@ -571,12 +572,12 @@ void Creature::Update(uint32 diff)
RegenerateMana();
/*if(!bIsPolymorphed) // only increase the timer if not polymorphed
m_regenTimer += 2000 - diff;
m_regenTimer += CREATURE_REGEN_INTERVAL - diff;
}
else
if(!bIsPolymorphed) // if polymorphed, skip the timer
m_regenTimer -= diff;*/
m_regenTimer = 2000;
m_regenTimer = CREATURE_REGEN_INTERVAL;
break;
}
case DEAD_FALLING:
@@ -611,6 +612,14 @@ void Creature::RegenerateMana()
else
addvalue = maxValue/3;
// Apply modifiers (if any).
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if ((*i)->GetMiscValue() == POWER_MANA)
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) * CREATURE_REGEN_INTERVAL / (5 * IN_MILISECONDS);
ModifyPower(POWER_MANA, addvalue);
}
@@ -641,6 +650,13 @@ void Creature::RegenerateHealth()
else
addvalue = maxValue/3;
// Apply modifiers (if any).
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * CREATURE_REGEN_INTERVAL / (5 * IN_MILISECONDS);
ModifyHealth(addvalue);
}
@@ -1988,16 +2004,16 @@ bool Creature::LoadCreaturesAddon(bool reload)
}
// skip already applied aura
if(HasAuraEffect(cAura->spell_id,cAura->effect_idx))
if(HasAura(cAura->spell_id))
{
if(!reload)
sLog.outErrorDb("Creature (GUID: %u Entry: %u) has duplicate aura (spell %u effect %u) in `auras` field.",GetGUIDLow(),GetEntry(),cAura->spell_id,cAura->effect_idx);
sLog.outErrorDb("Creature (GUID: %u Entry: %u) has duplicate aura (spell %u) in `auras` field.",GetGUIDLow(),GetEntry(),cAura->spell_id);
continue;
}
AddAuraEffect(AdditionalSpellInfo, cAura->effect_idx, this, this);
sLog.outDebug("Spell: %u with Aura %u added to creature (GUID: %u Entry: %u)", cAura->spell_id, AdditionalSpellInfo->EffectApplyAuraName[cAura->effect_idx],GetGUIDLow(),GetEntry());
AddAura(AdditionalSpellInfo, cAura->effectMask, this);
sLog.outDebug("Spell: %u with AuraEffectMask %u added to creature (GUID: %u Entry: %u)", cAura->spell_id, cAura->effectMask,GetGUIDLow(),GetEntry());
}
}
return true;
+2 -1
View File
@@ -64,6 +64,7 @@ enum CreatureFlagsExtra
#endif
#define MAX_KILL_CREDIT 2
#define CREATURE_REGEN_INTERVAL 2 * IN_MILISECONDS
// from `creature_template` table
struct CreatureInfo
@@ -241,7 +242,7 @@ struct CreatureData
struct CreatureDataAddonAura
{
uint32 spell_id;
uint8 effect_idx;
uint8 effectMask;
};
// from `creature_addon` table
+3
View File
@@ -121,6 +121,9 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
// Called when spell hits a target
virtual void SpellHitTarget(Unit* target, const SpellEntry*) {}
// Called to get trigger target for aura effect
virtual Unit * GetAuraEffectTriggerTarget(uint32 spellId, uint8 effIndex) {return NULL;}
// Called when the creature is target of hostile action: swing, hostile spell landed, fear/etc)
//virtual void AttackedBy(Unit* attacker);
virtual bool IsEscorted() { return false; }
+2 -2
View File
@@ -295,7 +295,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
{
//Note: checked only aura for effect 0, if need check aura for effect 1/2 then
// possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx)
Aura* aura = m_creature->GetAura(event.buffed.spellId,0);
Aura const * aura = m_creature->GetAura(event.buffed.spellId);
if(!aura || aura->GetStackAmount() < event.buffed.amount)
return false;
@@ -311,7 +311,7 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction
//Note: checked only aura for effect 0, if need check aura for effect 1/2 then
// possible way: pack in event.buffed.amount 2 uint16 (ammount+effectIdx)
Aura* aura = pActionInvoker->GetAura(event.buffed.spellId,0);
Aura const * aura = m_creature->GetAura(event.buffed.spellId);
if(!aura || aura->GetStackAmount() < event.buffed.amount)
return false;
+1
View File
@@ -1342,6 +1342,7 @@ struct SoundEntriesEntry
};
#define MAX_SPELL_EFFECTS 3
#define MAX_EFFECT_MASK 7
struct SpellEntry
{
+48 -49
View File
@@ -36,6 +36,9 @@ DynamicObject::DynamicObject() : WorldObject()
m_updateFlag = (UPDATEFLAG_HIGHGUID | UPDATEFLAG_HAS_POSITION | UPDATEFLAG_POSITION);
m_valuesCount = DYNAMICOBJECT_END;
m_aura = 0;
m_duration = 0;
}
void DynamicObject::AddToWorld()
@@ -70,13 +73,13 @@ void DynamicObject::RemoveFromWorld()
}
}
bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, uint32 effMask, const Position &pos, int32 duration, float radius, bool active)
bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, const Position &pos, float radius, bool active)
{
SetMap(caster->GetMap());
Relocate(pos);
if(!IsPositionValid())
{
sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",spellId,effMask,GetPositionX(),GetPositionY());
sLog.outError("DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)",spellId,GetPositionX(),GetPositionY());
return false;
}
@@ -85,17 +88,11 @@ bool DynamicObject::Create(uint32 guidlow, Unit *caster, uint32 spellId, uint32
SetEntry(spellId);
SetFloatValue( OBJECT_FIELD_SCALE_X, 1 );
SetUInt64Value( DYNAMICOBJECT_CASTER, caster->GetGUID() );
SetUInt32Value( DYNAMICOBJECT_BYTES, 0x00000001 );
SetUInt32Value( DYNAMICOBJECT_BYTES, 0x00000001 ); // effectMask?
SetUInt32Value( DYNAMICOBJECT_SPELLID, spellId );
SetFloatValue( DYNAMICOBJECT_RADIUS, radius);
SetFloatValue( DYNAMICOBJECT_RADIUS, radius );
SetUInt32Value( DYNAMICOBJECT_CASTTIME, getMSTime() ); // new 2.4.0
m_aliveDuration = duration;
m_radius = radius;
m_effMask = effMask;
m_spellId = spellId;
m_updateTimer = 0;
m_isWorldObject = active;
return true;
}
@@ -116,45 +113,25 @@ void DynamicObject::Update(uint32 p_time)
return;
}
bool deleteThis = false;
bool expired = false;
if(m_aliveDuration > int32(p_time))
m_aliveDuration -= p_time;
if (m_aura)
{
if (!m_aura->IsRemoved())
m_aura->UpdateOwner(p_time, this);
if (m_aura->IsRemoved() || m_aura->IsExpired())
expired = true;
}
else
deleteThis = true;
/*
// have radius and work as persistent effect
if(m_radius)
{
// TODO: make a timer and update this in larger intervals
CellPair p(Trinity::ComputeCellPair(GetPositionX(), GetPositionY()));
Cell cell(p);
cell.data.Part.reserved = ALL_DISTRICT;
cell.SetNoCreate();
Trinity::DynamicObjectUpdater notifier(*this, caster);
TypeContainerVisitor<Trinity::DynamicObjectUpdater, WorldTypeMapContainer > world_object_notifier(notifier);
TypeContainerVisitor<Trinity::DynamicObjectUpdater, GridTypeMapContainer > grid_object_notifier(notifier);
CellLock<GridReadGuard> cell_lock(cell, p);
cell_lock->Visit(cell_lock, world_object_notifier, *GetMap(), *this, m_radius);
cell_lock->Visit(cell_lock, grid_object_notifier, *GetMap(), *this, m_radius);
}
*/
if (m_effMask)
{
if (m_updateTimer < p_time)
{
Trinity::DynamicObjectUpdater notifier(*this,caster);
VisitNearbyObject(GetRadius(), notifier);
m_updateTimer = 500; // is this official-like?
} else m_updateTimer -= p_time;
if(GetDuration() > int32(p_time))
m_duration -= p_time;
else
expired = true;
}
if (deleteThis)
if (expired)
{
caster->RemoveDynObjectWithGUID(GetGUID());
Delete();
@@ -163,21 +140,43 @@ void DynamicObject::Update(uint32 p_time)
void DynamicObject::Delete()
{
if (m_aura)
{
// dynObj may be removed in Aura::Remove - we cannot delete there
// so recheck aura here
if (!m_aura->IsRemoved())
m_aura->_Remove(AURA_REMOVE_BY_DEFAULT);
delete m_aura;
m_aura = NULL;
}
SendObjectDeSpawnAnim(GetGUID());
RemoveFromWorld();
AddObjectToRemoveList();
}
int32 DynamicObject::GetDuration() const
{
if (!m_aura)
return m_duration;
else
return m_aura->GetDuration();
}
void DynamicObject::SetDuration(int32 newDuration)
{
if (!m_aura)
m_duration = newDuration;
else
m_aura->SetDuration(newDuration);
}
void DynamicObject::Delay(int32 delaytime)
{
m_aliveDuration -= delaytime;
for (AffectedSet::iterator iunit = m_affected.begin(); iunit != m_affected.end(); ++iunit)
if (*iunit)
(*iunit)->DelayAura(m_spellId, GetCaster()->GetGUID(), delaytime);
SetDuration(GetDuration() - delaytime);
}
bool DynamicObject::isVisibleForInState(Player const* u, bool inVisibleList) const
{
return IsInWorld() && u->IsInWorld()
&& (IsWithinDistInMap(u->m_seer,World::GetMaxVisibleDistanceForObject()+(inVisibleList ? World::GetVisibleObjectGreyDistance() : 0.0f), false));
}
}
+12 -20
View File
@@ -24,32 +24,28 @@
#include "Object.h"
class Unit;
class Aura;
struct SpellEntry;
class DynamicObject : public WorldObject, public GridObject<DynamicObject>
{
public:
typedef std::set<Unit*> AffectedSet;
explicit DynamicObject();
void AddToWorld();
void RemoveFromWorld();
bool Create(uint32 guidlow, Unit *caster, uint32 spellId, uint32 effMask, const Position &pos, int32 duration, float radius, bool active);
bool Create(uint32 guidlow, Unit *caster, uint32 spellId, const Position &pos, float radius, bool active);
void Update(uint32 p_time);
void Delete();
uint32 GetSpellId() const { return m_spellId; }
uint32 GetEffectMask() const { return m_effMask; }
void AddEffect(uint32 effIndex) { m_effMask |= (1<<effIndex); }
bool HasEffect(uint32 effIndex) const { return m_effMask & (1<<effIndex); }
uint32 GetDuration() const { return m_aliveDuration; }
uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
Unit* GetCaster() const;
float GetRadius() const { return m_radius; }
bool IsAffecting(Unit *unit) const { return m_affected.find(unit) != m_affected.end(); }
void AddAffected(Unit *unit) { m_affected.insert(unit); }
void RemoveAffected(Unit *unit) { m_affected.erase(unit); }
void SetDuration(int32 newDuration);
int32 GetDuration() const;
void SetAura(Aura * aura) {assert (!m_aura && aura); m_aura = aura;}
void Delay(int32 delaytime);
uint32 GetSpellId() const { return GetUInt32Value(DYNAMICOBJECT_SPELLID); }
uint64 GetCasterGUID() const { return GetUInt64Value(DYNAMICOBJECT_CASTER); }
float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
Unit* GetCaster() const;
bool isVisibleForInState(Player const* u, bool inVisibleList) const;
void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); }
@@ -59,11 +55,7 @@ class DynamicObject : public WorldObject, public GridObject<DynamicObject>
void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); }
protected:
uint32 m_spellId;
uint32 m_effMask;
int32 m_aliveDuration;
uint32 m_updateTimer;
float m_radius;
AffectedSet m_affected;
int32 m_duration; // for non-aura dynobjects
Aura * m_aura;
};
#endif
#endif
-23
View File
@@ -221,27 +221,6 @@ namespace Trinity
template<class NOT_INTERESTED> void Visit(GridRefManager<NOT_INTERESTED> &) {}
};
struct TRINITY_DLL_DECL DynamicObjectUpdater
{
DynamicObject &i_dynobject;
Unit* i_check;
DynamicObjectUpdater(DynamicObject &dynobject, Unit* caster) : i_dynobject(dynobject)
{
i_check = caster;
Unit* owner = i_check->GetOwner();
if(owner)
i_check = owner;
}
template<class T> inline void Visit(GridRefManager<T> &) {}
#ifdef WIN32
template<> inline void Visit<Player>(PlayerMapType &);
template<> inline void Visit<Creature>(CreatureMapType &);
#endif
void VisitHelper(Unit* target);
};
// SEARCHERS & LIST SEARCHERS & WORKERS
// WorldObject searchers & workers
@@ -1292,8 +1271,6 @@ namespace Trinity
template<> inline void PlayerRelocationNotifier::Visit<Creature>(CreatureMapType &);
template<> inline void CreatureRelocationNotifier::Visit<Player>(PlayerMapType &);
template<> inline void CreatureRelocationNotifier::Visit<Creature>(CreatureMapType &);
template<> inline void DynamicObjectUpdater::Visit<Creature>(CreatureMapType &);
template<> inline void DynamicObjectUpdater::Visit<Player>(PlayerMapType &);
#endif
}
#endif
-86
View File
@@ -170,92 +170,6 @@ Trinity::CreatureRelocationNotifier::Visit(CreatureMapType &m)
}
}
inline void Trinity::DynamicObjectUpdater::VisitHelper(Unit* target)
{
if(!target->isAlive() || target->isInFlight() )
return;
if(target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->isTotem())
return;
if (!i_dynobject.IsWithinDistInMap(target, i_dynobject.GetRadius()))
return;
//Check targets for not_selectable unit flag and remove
if (target->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
return;
// Evade target
if( target->GetTypeId() == TYPEID_UNIT && ((Creature*)target)->IsInEvadeMode() )
return;
//Check player targets and remove if in GM mode or GM invisibility (for not self casting case)
if( target->GetTypeId() == TYPEID_PLAYER && target != i_check && (((Player*)target)->isGameMaster() || ((Player*)target)->GetVisibility()==VISIBILITY_OFF) )
return;
if (i_dynobject.IsAffecting(target))
return;
if(target->HasAura(i_dynobject.GetSpellId(), i_check->GetGUID()))
return;
uint32 eff_index = 0;
for (; eff_index < MAX_SPELL_EFFECTS; ++eff_index)
if(i_dynobject.HasEffect(eff_index))
break;
if(eff_index == MAX_SPELL_EFFECTS)
return;
SpellEntry const *spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId());
if(spellInfo->EffectImplicitTargetB[eff_index] == TARGET_DEST_DYNOBJ_ALLY
|| spellInfo->EffectImplicitTargetB[eff_index] == TARGET_UNIT_AREA_ALLY_DST)
{
if(!i_check->IsFriendlyTo(target))
return;
}
else if( i_check->GetTypeId() == TYPEID_PLAYER )
{
if (i_check->IsFriendlyTo( target ))
return;
i_check->CombatStart(target);
}
else
{
if (!i_check->IsHostileTo( target ))
return;
i_check->CombatStart(target);
}
// Check target immune to spell or aura
if (target->IsImmunedToSpell(spellInfo) || target->IsImmunedToSpellEffect(spellInfo, eff_index))
return;
// Apply PersistentAreaAura on target
Aura *aur = new Aura(spellInfo, i_dynobject.GetEffectMask(), target, &i_dynobject, i_check);
aur->SetAuraDuration(i_dynobject.GetDuration());
if(target->AddAura(aur, true))
i_dynobject.AddAffected(target);
}
template<>
inline void
Trinity::DynamicObjectUpdater::Visit(CreatureMapType &m)
{
for (CreatureMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
VisitHelper(itr->getSource());
}
template<>
inline void
Trinity::DynamicObjectUpdater::Visit(PlayerMapType &m)
{
for (PlayerMapType::iterator itr=m.begin(); itr != m.end(); ++itr)
VisitHelper(itr->getSource());
}
// SEARCHERS & LIST SEARCHERS & WORKERS
// WorldObject searchers & workers
+8 -8
View File
@@ -703,8 +703,8 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
{
if(auramask & (uint64(1) << i))
{
Aura * pAura = player->GetVisibleAura(i);
*data << uint32(pAura ? pAura->GetId() : 0);
AuraApplication const * aurApp = player->GetVisibleAura(i);
*data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
*data << uint8(1);
}
}
@@ -785,8 +785,8 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player *player, WorldPacke
{
if(auramask & (uint64(1) << i))
{
Aura * pAura = pet->GetVisibleAura(i);
*data << uint32(pAura ? pAura->GetId() : 0);
AuraApplication const * aurApp = player->GetVisibleAura(i);
*data << uint32(aurApp ? aurApp->GetBase()->GetId() : 0);
*data << uint8(1);
}
}
@@ -843,10 +843,10 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data << (uint64) auramask; // placeholder
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if(Aura * pAura = player->GetVisibleAura(i))
if(AuraApplication * aurApp = player->GetVisibleAura(i))
{
auramask |= (uint64(1) << i);
data << (uint32) pAura->GetId();
data << (uint32) aurApp->GetBase()->GetId();
data << (uint8) 1;
}
}
@@ -869,10 +869,10 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode( WorldPacket &recv_data )
data << (uint64) petauramask; // placeholder
for (uint8 i = 0; i < MAX_AURAS; ++i)
{
if(Aura * pAura = pet->GetVisibleAura(i))
if(AuraApplication * auraApp = pet->GetVisibleAura(i))
{
petauramask |= (uint64(1) << i);
data << (uint32) pAura->GetId();
data << (uint32) auraApp->GetBase()->GetId();
data << (uint8) 1;
}
}
+23 -38
View File
@@ -54,6 +54,7 @@
#include "InstanceData.h"
#include "AuctionHouseBot.h"
#include "CreatureEventAIMgr.h"
#include "SpellAuraEffects.h"
#include "DBCEnums.h"
bool ChatHandler::HandleAHBotOptionsCommand(const char *args)
@@ -4387,25 +4388,8 @@ bool ChatHandler::HandleAuraCommand(const char *args)
// number or [name] Shift-click form |color|Hspell:spell_id|h[name]|h|r or Htalent form
uint32 spellID = extractSpellIdFromLink((char*)args);
SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID );
uint8 eff_mask=0;
if(spellInfo)
{
for (uint32 i = 0; i<3; ++i)
{
uint8 eff = spellInfo->Effect[i];
if (eff>=TOTAL_SPELL_EFFECTS)
continue;
if( IsAreaAuraEffect(eff) ||
eff == SPELL_EFFECT_APPLY_AURA ||
eff == SPELL_EFFECT_PERSISTENT_AREA_AURA )
{
eff_mask|=1<<i;
}
}
Aura *Aur = new Aura(spellInfo, eff_mask, target, target, target);
target->AddAura(Aur);
}
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry( spellID ))
Aura::TryCreate(spellInfo, target, target);
return true;
}
@@ -5117,39 +5101,41 @@ bool ChatHandler::HandleListAurasCommand (const char * /*args*/)
char const* talentStr = GetTrinityString(LANG_TALENT);
char const* passiveStr = GetTrinityString(LANG_PASSIVE);
Unit::AuraMap const& uAuras = unit->GetAuras();
Unit::AuraApplicationMap const& uAuras = unit->GetAppliedAuras();
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURAS, uAuras.size());
for (Unit::AuraMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr)
for (Unit::AuraApplicationMap::const_iterator itr = uAuras.begin(); itr != uAuras.end(); ++itr)
{
bool talent = GetTalentSpellCost(itr->second->GetId()) > 0;
bool talent = GetTalentSpellCost(itr->second->GetBase()->GetId()) > 0;
char const* name = itr->second->GetSpellProto()->SpellName[GetSessionDbcLocale()];
AuraApplication const * aurApp = itr->second;
Aura const * aura = aurApp->GetBase();
char const* name = aura->GetSpellProto()->SpellName[GetSessionDbcLocale()];
if (m_session)
{
std::ostringstream ss_name;
ss_name << "|cffffffff|Hspell:" << itr->second->GetId() << "|h[" << name << "]|h|r";
ss_name << "|cffffffff|Hspell:" << aura->GetId() << "|h[" << name << "]|h|r";
PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffectMask(),
itr->second->GetAuraCharges(), itr->second->GetStackAmount(),itr->second->GetAuraSlot(),
itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(),
PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), aurApp->GetEffectMask(),
aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
aura->GetDuration(), aura->GetMaxDuration(),
ss_name.str().c_str(),
(itr->second->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID()));
(aura->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(aura->GetCasterGUID()));
}
else
{
PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, itr->second->GetId(), itr->second->GetEffectMask(),
itr->second->GetAuraCharges(), itr->second->GetStackAmount(),itr->second->GetAuraSlot(),
itr->second->GetAuraDuration(), itr->second->GetAuraMaxDuration(),
PSendSysMessage(LANG_COMMAND_TARGET_AURADETAIL, aura->GetId(), aurApp->GetEffectMask(),
aura->GetCharges(), aura->GetStackAmount(), aurApp->GetSlot(),
aura->GetDuration(), aura->GetMaxDuration(),
name,
(itr->second->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
IS_PLAYER_GUID(itr->second->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(itr->second->GetCasterGUID()));
(aura->IsPassive() ? passiveStr : ""),(talent ? talentStr : ""),
IS_PLAYER_GUID(aura->GetCasterGUID()) ? "player" : "creature",GUID_LOPART(aura->GetCasterGUID()));
}
}
for (uint16 i = 0; i < TOTAL_AURAS; ++i)
{
Unit::AuraEffectList const& uAuraList = unit->GetAurasByType(AuraType(i));
Unit::AuraEffectList const& uAuraList = unit->GetAuraEffectsByType(AuraType(i));
if (uAuraList.empty()) continue;
PSendSysMessage(LANG_COMMAND_TARGET_LISTAURATYPE, uAuraList.size(), i);
for (Unit::AuraEffectList::const_iterator itr = uAuraList.begin(); itr != uAuraList.end(); ++itr)
@@ -7376,9 +7362,8 @@ bool ChatHandler::HandleFreezeCommand(const char *args)
}
//m_session->GetPlayer()->CastSpell(player,spellID,false);
SpellEntry const *spellInfo = sSpellStore.LookupEntry( 9454 );
Aura *Aur = new Aura(spellInfo, 1, player, player, player);
player->AddAura(Aur);
if (SpellEntry const *spellInfo = sSpellStore.LookupEntry(9454))
Aura::TryCreate(spellInfo, player, player);
//save player
player->SaveToDB();
+3 -2
View File
@@ -42,6 +42,7 @@
#include "CellImpl.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "SpellAuraEffects.h"
#include "TemporarySummon.h"
#include "Totem.h"
@@ -1805,7 +1806,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
if(petType == SUMMON_PET && pet->LoadPetFromDB(this, entry))
{
// Remove Demonic Sacrifice auras (known pet)
Unit::AuraEffectList const& auraClassScripts = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr!=auraClassScripts.end();)
{
if((*itr)->GetMiscValue()==2228)
@@ -1886,7 +1887,7 @@ Pet* Player::SummonPet(uint32 entry, float x, float y, float z, float ang, PetTy
if(petType == SUMMON_PET)
{
// Remove Demonic Sacrifice auras (known pet)
Unit::AuraEffectList const& auraClassScripts = GetAurasByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
Unit::AuraEffectList const& auraClassScripts = GetAuraEffectsByType(SPELL_AURA_OVERRIDE_CLASS_SCRIPTS);
for (Unit::AuraEffectList::const_iterator itr = auraClassScripts.begin(); itr!=auraClassScripts.end();)
{
if((*itr)->GetMiscValue()==2228)
+43 -20
View File
@@ -781,27 +781,40 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
{
// Now add the auras, format "spellid effectindex spellid effectindex..."
char *p,*s;
std::vector<int> val;
std::map<uint32, uint32> val;
s=p=(char*)reinterpret_cast<char const*>(addon->auras);
if(p)
{
uint32 currSpellId = 0;
bool spell = true;
while (p[0]!=0)
{
++p;
if (p[0]==' ')
if (p[0] == ' ' || p[0] == 0)
{
val.push_back(atoi(s));
if (spell)
currSpellId = atoi(s);
else
{
uint8 eff = atoi(s);
if (eff >=3)
{
sLog.outErrorDb("Creature (%s: %u) has wrong `auras` data in `%s`(too high aura effect: %d for spell: %d)",guidEntryStr,addon->guidOrEntry,table,eff,currSpellId);
}
val[currSpellId] |= 1<<eff;
}
spell = !spell;
if (p[0] == 0)
break;
s=++p;
}
}
if (p!=s)
val.push_back(atoi(s));
// free char* loaded memory
delete[] (char*)reinterpret_cast<char const*>(addon->auras);
// wrong list
if (val.size()%2)
if (!spell)
{
addon->auras = NULL;
sLog.outErrorDb("Creature (%s: %u) has wrong `auras` data in `%s`.",guidEntryStr,addon->guidOrEntry,table);
@@ -817,17 +830,17 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
}
// replace by new structures array
const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()/2+1];
const_cast<CreatureDataAddonAura*&>(addon->auras) = new CreatureDataAddonAura[val.size()+1];
uint32 i=0;
for (uint32 j = 0; j < val.size()/2; ++j)
for (std::map<uint32, uint32>::iterator itr = val.begin(); itr!=val.end();++itr)
{
CreatureDataAddonAura& cAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
cAura.spell_id = (uint32)val[2*j+0];
cAura.effect_idx = (uint32)val[2*j+1];
if ( cAura.effect_idx > 2 )
cAura.spell_id = itr->first;
cAura.effectMask = itr->second;
if ( cAura.effectMask > 7 || !cAura.effectMask)
{
sLog.outErrorDb("Creature (%s: %u) has wrong effect %u for spell %u in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.effect_idx,cAura.spell_id,table);
sLog.outErrorDb("Creature (%s: %u) has wrong effect for spell %u in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.spell_id,table);
continue;
}
SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(cAura.spell_id);
@@ -836,11 +849,21 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
sLog.outErrorDb("Creature (%s: %u) has wrong spell %u defined in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.spell_id,table);
continue;
}
if (!AdditionalSpellInfo->Effect[cAura.effect_idx] || !AdditionalSpellInfo->EffectApplyAuraName[cAura.effect_idx])
for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
{
sLog.outErrorDb("Creature (%s: %u) has not aura effect %u of spell %u defined in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,cAura.effect_idx,cAura.spell_id,table);
continue;
if ((1<<eff) & cAura.effectMask)
{
if (!AdditionalSpellInfo->Effect[eff] || !AdditionalSpellInfo->EffectApplyAuraName[eff])
{
sLog.outErrorDb("Creature (%s: %u) has not aura effect %u of spell %u defined in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,eff,cAura.spell_id,table);
continue;
}
else if (AdditionalSpellInfo->Effect[eff] == SPELL_EFFECT_PERSISTENT_AREA_AURA)
{
sLog.outErrorDb("Creature (%s: %u) has persistent area aura effect %u of spell %u defined in `auras` field in `%s`.",guidEntryStr,addon->guidOrEntry,eff,cAura.spell_id,table);
continue;
}
}
}
++i;
@@ -849,7 +872,7 @@ void ObjectMgr::ConvertCreatureAddonAuras(CreatureDataAddon* addon, char const*
// fill terminator element (after last added)
CreatureDataAddonAura& endAura = const_cast<CreatureDataAddonAura&>(addon->auras[i]);
endAura.spell_id = 0;
endAura.effect_idx = 0;
endAura.effectMask = 0;
}
void ObjectMgr::LoadCreatureAddons(SQLStorage& creatureaddons, char const* entryName, char const* comment)
@@ -7641,9 +7664,9 @@ bool PlayerCondition::Meets(Player const * player) const
}
case CONDITION_AD_COMMISSION_AURA:
{
Unit::AuraMap const& auras = player->GetAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
if((itr->second->GetSpellProto()->Attributes & 0x1000010) && itr->second->GetSpellProto()->SpellVisual[0]==3580)
Unit::AuraApplicationMap const& auras = player->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
if((itr->second->GetBase()->GetSpellProto()->Attributes & 0x1000010) && itr->second->GetBase()->GetSpellProto()->SpellVisual[0]==3580)
return true;
return false;
}
+1 -1
View File
@@ -1078,7 +1078,7 @@ void OutdoorPvPWG::HandlePlayerLeaveZone(Player * plr, uint32 zone)
void OutdoorPvPWG::PromotePlayer(Player *killer) const
{
Aura *aur;
Aura * aur;
if (aur = killer->GetAura(SPELL_RECRUIT))
{
if (aur->GetStackAmount() >= 5)
+53 -30
View File
@@ -27,6 +27,7 @@
#include "Pet.h"
#include "Formulas.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "CreatureAI.h"
#include "Unit.h"
#include "Util.h"
@@ -57,7 +58,7 @@ m_declinedname(NULL), m_owner(owner)
}
m_name = "Pet";
m_regenTimer = 4000;
m_regenTimer = PET_FOCUS_REGEN_INTERVAL;
m_isWorldObject = true;
}
@@ -553,13 +554,13 @@ void Pet::Update(uint32 diff)
{
case POWER_FOCUS:
Regenerate(POWER_FOCUS);
m_regenTimer += 4000 - diff;
m_regenTimer += PET_FOCUS_REGEN_INTERVAL - diff;
if(!m_regenTimer) ++m_regenTimer;
break;
// in creature::update
//case POWER_ENERGY:
// Regenerate(POWER_ENERGY);
// m_regenTimer += 2000 - diff;
// m_regenTimer += CREATURE_REGEN_INTERVAL - diff;
// if(!m_regenTimer) ++m_regenTimer;
// break;
default:
@@ -617,11 +618,13 @@ void Creature::Regenerate(Powers power)
}
// Apply modifiers (if any).
AuraEffectList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if ((*i)->GetMiscValue() == power)
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * (isHunterPet()? PET_FOCUS_REGEN_INTERVAL : CREATURE_REGEN_INTERVAL) / (5 * IN_MILISECONDS);
ModifyPower(power, (int32)addvalue);
}
@@ -1154,24 +1157,29 @@ void Pet::_LoadAuras(uint32 timediff)
{
sLog.outDebug("Loading auras for pet %u",GetGUIDLow());
QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_mask,stackcount,amount0,amount1,amount2,maxduration,remaintime,remaincharges FROM pet_aura WHERE guid = '%u'",m_charmInfo->GetPetNumber());
QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges FROM pet_aura WHERE guid = '%u'",m_charmInfo->GetPetNumber());
if (result)
{
do
{
int32 damage[3];
int32 baseDamage[3];
Field *fields = result->Fetch();
uint64 caster_guid = fields[0].GetUInt64();
uint32 spellid = fields[1].GetUInt32();
uint8 effmask = fields[2].GetUInt8();
uint8 stackcount = fields[3].GetUInt8();
damage[0] = fields[4].GetInt32();
damage[1] = fields[5].GetInt32();
damage[2] = fields[6].GetInt32();
int32 maxduration = fields[7].GetInt32();
int32 remaintime = fields[8].GetInt32();
uint8 remaincharges = fields[9].GetUInt8();
uint8 recalculatemask = fields[3].GetUInt8();
uint8 stackcount = fields[4].GetUInt8();
damage[0] = fields[5].GetInt32();
damage[1] = fields[6].GetInt32();
damage[2] = fields[7].GetInt32();
baseDamage[0] = fields[8].GetInt32();
baseDamage[1] = fields[9].GetInt32();
baseDamage[2] = fields[10].GetInt32();
int32 maxduration = fields[11].GetInt32();
int32 remaintime = fields[12].GetInt32();
uint8 remaincharges = fields[13].GetUInt8();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if(!spellproto)
@@ -1198,15 +1206,17 @@ void Pet::_LoadAuras(uint32 timediff)
else
remaincharges = 0;
Aura* aura = new Aura(spellproto, effmask, this, this, this);
aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]);
if(!aura->CanBeSaved())
if (Aura * aura = Aura::TryCreate( spellproto, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
{
delete aura;
continue;
if (!aura->CanBeSaved())
{
aura->Remove();
continue;
}
aura->SetLoadedState(maxduration,remaintime,remaincharges,stackcount,recalculatemask,&damage[0]);
aura->ApplyForTargets();
sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
}
AddAura(aura);
sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
}
while (result->NextRow());
@@ -1218,26 +1228,39 @@ void Pet::_SaveAuras()
{
CharacterDatabase.PExecute("DELETE FROM pet_aura WHERE guid = '%u'", m_charmInfo->GetPetNumber());
AuraMap const& auras = GetAuras();
for (AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr)
for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end() ; ++itr)
{
if (!itr->second->CanBeSaved())
continue;
int32 amounts[MAX_SPELL_EFFECTS];
Aura * aura = itr->second;
int32 damage[MAX_SPELL_EFFECTS];
int32 baseDamage[MAX_SPELL_EFFECTS];
uint8 effMask = 0;
uint8 recalculateMask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (AuraEffect *partAura = itr->second->GetPartAura(i))
amounts[i] = partAura->GetAmount();
if (aura->GetEffect(i))
{
baseDamage[i] = aura->GetEffect(i)->GetBaseAmount();
damage[i] = aura->GetEffect(i)->GetAmount();
effMask |= (1<<i);
if (aura->GetEffect(i)->CanBeRecalculated())
recalculateMask |= (1<<i);
}
else
amounts[i] = 0;
{
baseDamage[i] = NULL;
damage[i] = NULL;
}
}
CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_mask,stackcount,amount0,amount1,amount2,maxduration,remaintime,remaincharges) "
"VALUES ('%u', '" UI64FMTD "', '%u', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%u')",
m_charmInfo->GetPetNumber(), itr->second->GetCasterGUID(), itr->second->GetId(), itr->second->GetEffectMask(),
itr->second->GetStackAmount(), amounts[0], amounts[1], amounts[2],
itr->second->GetAuraMaxDuration(), itr->second->GetAuraDuration(),itr->second->GetAuraCharges());
CharacterDatabase.PExecute("INSERT INTO pet_aura (guid,caster_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges) "
"VALUES ('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u')",
m_charmInfo->GetPetNumber(), itr->second->GetCasterGUID(), itr->second->GetId(), effMask, recalculateMask,
itr->second->GetStackAmount(), damage[0], damage[1], damage[2], baseDamage[0], baseDamage[1], baseDamage[2],
itr->second->GetMaxDuration(), itr->second->GetDuration(),itr->second->GetCharges());
}
}
+1
View File
@@ -118,6 +118,7 @@ typedef std::vector<uint32> AutoSpellList;
#define PET_FOLLOW_DIST 1
#define PET_FOLLOW_ANGLE (M_PI/2)
#define PET_FOCUS_REGEN_INTERVAL 4 * IN_MILISECONDS
class Player;
+221 -159
View File
@@ -65,6 +65,7 @@
#include "GameEventMgr.h"
#include "AchievementMgr.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include <cmath>
@@ -945,7 +946,7 @@ int32 Player::getMaxTimer(MirrorTimerType timer)
if (!isAlive() || HasAuraType(SPELL_AURA_WATER_BREATHING) || GetSession()->GetSecurity() >= sWorld.getConfig(CONFIG_DISABLE_BREATHING))
return DISABLED_MIRROR_TIMER;
int32 UnderWaterTime = 3*MINUTE*IN_MILISECONDS;
AuraEffectList const& mModWaterBreathing = GetAurasByType(SPELL_AURA_MOD_WATER_BREATHING);
AuraEffectList const& mModWaterBreathing = GetAuraEffectsByType(SPELL_AURA_MOD_WATER_BREATHING);
for (AuraEffectList::const_iterator i = mModWaterBreathing.begin(); i != mModWaterBreathing.end(); ++i)
UnderWaterTime = uint32(UnderWaterTime * (100.0f + (*i)->GetAmount()) / 100.0f);
return UnderWaterTime;
@@ -2022,14 +2023,12 @@ void Player::RegenerateAll()
HasAuraType(SPELL_AURA_MOD_HEALTH_REGEN_IN_COMBAT) || IsPolymorphed() )
{
RegenerateHealth();
if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
{
Regenerate(POWER_RAGE);
if (getClass() == CLASS_DEATH_KNIGHT)
Regenerate(POWER_RUNIC_POWER);
}
}
Regenerate(POWER_RAGE);
if (getClass() == CLASS_DEATH_KNIGHT)
Regenerate(POWER_RUNIC_POWER);
if(getClass() == CLASS_DEATH_KNIGHT)
Regenerate(POWER_RUNE);
@@ -2051,18 +2050,6 @@ void Player::Regenerate(Powers power)
return;
uint32 curValue = GetPower(power);
switch (power)
{
case POWER_RAGE:
case POWER_RUNIC_POWER:
if (curValue == 0)
return;
break;
default:
if (curValue == maxValue)
return;
break;
}
// TODO: possible use of miscvalueb instead of amount
if (HasAuraTypeWithValue(SPELL_AURA_PREVENT_REGENERATE_POWER, power))
@@ -2077,22 +2064,28 @@ void Player::Regenerate(Powers power)
bool recentCast = IsUnderLastManaUseEffect();
float ManaIncreaseRate = sWorld.getRate(RATE_POWER_MANA);
if (recentCast) // Trinity Updates Mana in intervals of 2s, which is correct
addvalue = GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_INTERRUPTED_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
else
addvalue = GetFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
addvalue += GetFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER) * ManaIncreaseRate * 0.001f * m_regenTimer;
} break;
case POWER_RAGE: // Regenerate rage
{
float RageDecreaseRate = sWorld.getRate(RATE_POWER_RAGE_LOSS);
addvalue = 20 * RageDecreaseRate; // 2 rage by tick (= 2 seconds => 1 rage/sec)
if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
{
float RageDecreaseRate = sWorld.getRate(RATE_POWER_RAGE_LOSS);
addvalue += -20 * RageDecreaseRate; // 2 rage by tick (= 2 seconds => 1 rage/sec)
}
} break;
case POWER_ENERGY: // Regenerate energy (rogue)
addvalue = 0.01f * m_regenTimer;
addvalue += 0.01f * m_regenTimer;
break;
case POWER_RUNIC_POWER:
{
float RunicPowerDecreaseRate = sWorld.getRate(RATE_POWER_RUNICPOWER_LOSS);
addvalue = 30 * RunicPowerDecreaseRate; // 3 RunicPower by tick
if (!isInCombat() && !HasAuraType(SPELL_AURA_INTERRUPT_REGEN))
{
float RunicPowerDecreaseRate = sWorld.getRate(RATE_POWER_RUNICPOWER_LOSS);
addvalue += -30 * RunicPowerDecreaseRate; // 3 RunicPower by tick
}
} break;
case POWER_RUNE:
case POWER_FOCUS:
@@ -2102,44 +2095,58 @@ void Player::Regenerate(Powers power)
}
// Mana regen calculated in Player::UpdateManaRegen()
// Exist only for POWER_MANA, POWER_ENERGY, POWER_FOCUS auras
if (power != POWER_MANA)
{
AuraEffectList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
AuraEffectList const& ModPowerRegenPCTAuras = GetAuraEffectsByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i)
if ((*i)->GetMiscValue() == power)
addvalue *= ((*i)->GetAmount() + 100) / 100.0f;
// Butchery requires combat for this effect
if (power != POWER_RUNIC_POWER || isInCombat())
addvalue += GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, power) * ((power != POWER_ENERGY) ? m_regenTimerCount : m_regenTimer) / (5 * IN_MILISECONDS);
}
addvalue += m_powerFraction[power];
uint32 integerValue = uint32(addvalue);
switch (power)
if (addvalue < 0.0f)
{
case POWER_RAGE:
case POWER_RUNIC_POWER:
if(curValue > integerValue)
{
curValue -= integerValue;
m_powerFraction[power] = addvalue - integerValue;
}
else
{
curValue = 0;
m_powerFraction[power] = 0;
}
break;
default:
curValue += integerValue;
if (curValue == 0)
return;
}
else if (addvalue > 0.0f)
{
if (curValue == maxValue)
return;
}
else
return;
if (curValue > maxValue)
{
curValue = maxValue;
m_powerFraction[power] = 0;
}
else
m_powerFraction[power] = addvalue - integerValue;
break;
addvalue += m_powerFraction[power];
uint32 integerValue = uint32(abs(addvalue));
if (addvalue < 0.0f)
{
if(curValue > integerValue)
{
curValue -= integerValue;
m_powerFraction[power] = addvalue + integerValue;
}
else
{
curValue = 0;
m_powerFraction[power] = 0;
}
}
else
{
curValue += integerValue;
if (curValue > maxValue)
{
curValue = maxValue;
m_powerFraction[power] = 0;
}
else
m_powerFraction[power] = addvalue - integerValue;
}
if(m_regenTimerCount >= 2000)
SetPower(power, curValue);
@@ -2168,9 +2175,11 @@ void Player::RegenerateHealth()
addvalue = OCTRegenHPPerSpirit()* HealthIncreaseRate;
if (!isInCombat())
{
AuraEffectList const& mModHealthRegenPct = GetAurasByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
AuraEffectList const& mModHealthRegenPct = GetAuraEffectsByType(SPELL_AURA_MOD_HEALTH_REGEN_PERCENT);
for (AuraEffectList::const_iterator i = mModHealthRegenPct.begin(); i != mModHealthRegenPct.end(); ++i)
addvalue *= (100.0f + (*i)->GetAmount()) / 100.0f;
addvalue += GetTotalAuraModifier(SPELL_AURA_MOD_REGEN) * 2 * IN_MILISECONDS / (5 * IN_MILISECONDS);
}
else if (HasAuraType(SPELL_AURA_MOD_REGEN_DURING_COMBAT))
addvalue *= GetTotalAuraModifier(SPELL_AURA_MOD_REGEN_DURING_COMBAT) / 100.0f;
@@ -2330,7 +2339,7 @@ void Player::SetGameMaster(bool on)
else
{
// restore phase
AuraEffectList const& phases = GetAurasByType(SPELL_AURA_PHASE);
AuraEffectList const& phases = GetAuraEffectsByType(SPELL_AURA_PHASE);
SetPhaseMask(!phases.empty() ? phases.front()->GetMiscValue() : PHASEMASK_NORMAL,false);
m_ExtraFlags &= ~ PLAYER_EXTRA_GM_ON;
@@ -4454,9 +4463,9 @@ void Player::ResurrectPlayer(float restore_percent, bool applySickness)
{
int32 delta = (int32(getLevel()) - startLevel + 1)*MINUTE;
if(Aura* Aur = GetAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS, GetGUID()))
if(Aura * aur = GetAura(SPELL_ID_PASSIVE_RESURRECTION_SICKNESS, GetGUID()))
{
Aur->SetAuraDuration(delta*IN_MILISECONDS);
aur->SetDuration(delta*IN_MILISECONDS);
}
}
}
@@ -5194,10 +5203,10 @@ void Player::ApplyRatingMod(CombatRating cr, int32 value, bool apply)
int32 amount = uint32(m_baseRatingValue[cr]);
// Apply bonus from SPELL_AURA_MOD_RATING_FROM_STAT
// stat used stored in miscValueB for this aura
AuraEffectList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
AuraEffectList const& modRatingFromStat = GetAuraEffectsByType(SPELL_AURA_MOD_RATING_FROM_STAT);
for (AuraEffectList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
if ((*i)->GetMiscValue() & (1<<cr))
amount += int32(GetStat(Stats((*i)->GetMiscBValue())) * (*i)->GetAmount() / 100.0f);
amount += int32(GetStat(Stats((*i)->GetMiscValueB())) * (*i)->GetAmount() / 100.0f);
if (amount < 0)
amount = 0;
SetUInt32Value(PLAYER_FIELD_COMBAT_RATING_1 + cr, uint32(amount));
@@ -5723,16 +5732,16 @@ void Player::SetSkill(uint32 id, uint16 currVal, uint16 maxVal)
SetUInt32Value(PLAYER_SKILL_BONUS_INDEX(i),0);
// temporary bonuses
AuraEffectList const& mModSkill = GetAurasByType(SPELL_AURA_MOD_SKILL);
AuraEffectList const& mModSkill = GetAuraEffectsByType(SPELL_AURA_MOD_SKILL);
for (AuraEffectList::const_iterator j = mModSkill.begin(); j != mModSkill.end(); ++j)
if ((*j)->GetMiscValue() == int32(id))
(*j)->ApplyModifier(true);
(*j)->HandleEffect(this, 0, true);
// permanent bonuses
AuraEffectList const& mModSkillTalent = GetAurasByType(SPELL_AURA_MOD_SKILL_TALENT);
AuraEffectList const& mModSkillTalent = GetAuraEffectsByType(SPELL_AURA_MOD_SKILL_TALENT);
for (AuraEffectList::const_iterator j = mModSkillTalent.begin(); j != mModSkillTalent.end(); ++j)
if ((*j)->GetMiscValue() == int32(id))
(*j)->ApplyModifier(true);
(*j)->HandleEffect(this, 0, true);
// Learn all spells for skill
learnSkillRewardedSpells(id, currVal);
@@ -6826,19 +6835,21 @@ void Player::DuelComplete(DuelCompleteType type)
duel->initiator->RemoveGameObject(obj,true);
/* remove auras */
AuraMap &itsAuras = duel->opponent->GetAuras();
for (AuraMap::iterator i = itsAuras.begin(); i != itsAuras.end();)
AuraApplicationMap &itsAuras = duel->opponent->GetAppliedAuras();
for (AuraApplicationMap::iterator i = itsAuras.begin(); i != itsAuras.end();)
{
if (!i->second->IsPositive() && i->second->GetCasterGUID() == GetGUID() && i->second->GetAuraApplyTime() >= duel->startTime)
Aura const * aura = i->second->GetBase();
if (!i->second->IsPositive() && aura->GetCasterGUID() == GetGUID() && aura->GetApplyTime() >= duel->startTime)
duel->opponent->RemoveAura(i);
else
++i;
}
AuraMap &myAuras = GetAuras();
for (AuraMap::iterator i = myAuras.begin(); i != myAuras.end();)
AuraApplicationMap &myAuras = GetAppliedAuras();
for (AuraApplicationMap::iterator i = myAuras.begin(); i != myAuras.end();)
{
if (!i->second->IsPositive() && i->second->GetCasterGUID() == duel->opponent->GetGUID() && i->second->GetAuraApplyTime() >= duel->startTime)
Aura const * aura = i->second->GetBase();
if (!i->second->IsPositive() && aura->GetCasterGUID() == duel->opponent->GetGUID() && aura->GetApplyTime() >= duel->startTime)
RemoveAura(i);
else
++i;
@@ -7215,20 +7226,20 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
void Player::_ApplyWeaponDependentAuraMods(Item *item,WeaponAttackType attackType,bool apply)
{
AuraEffectList const& auraCritList = GetAurasByType(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
AuraEffectList const& auraCritList = GetAuraEffectsByType(SPELL_AURA_MOD_WEAPON_CRIT_PERCENT);
for (AuraEffectList::const_iterator itr = auraCritList.begin(); itr!=auraCritList.end(); ++itr)
_ApplyWeaponDependentAuraCritMod(item,attackType,*itr,apply);
AuraEffectList const& auraDamageFlatList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_DONE);
AuraEffectList const& auraDamageFlatList = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_DONE);
for (AuraEffectList::const_iterator itr = auraDamageFlatList.begin(); itr!=auraDamageFlatList.end(); ++itr)
_ApplyWeaponDependentAuraDamageMod(item,attackType,*itr,apply);
AuraEffectList const& auraDamagePCTList = GetAurasByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
AuraEffectList const& auraDamagePCTList = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraEffectList::const_iterator itr = auraDamagePCTList.begin(); itr!=auraDamagePCTList.end(); ++itr)
_ApplyWeaponDependentAuraDamageMod(item,attackType,*itr,apply);
}
void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply)
void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply)
{
// generic not weapon specific case processes in aura code
if (aura->GetSpellProto()->EquippedItemClass == -1)
@@ -7247,7 +7258,7 @@ void Player::_ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attac
HandleBaseModValue(mod, FLAT_MOD, float (aura->GetAmount()), apply);
}
void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply)
void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect const* aura, bool apply)
{
//don't apply mod if item is broken
if (item->IsBroken())
@@ -7271,7 +7282,7 @@ void Player::_ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType att
}
UnitModifierType unitModType = TOTAL_VALUE;
switch (aura->GetAuraName())
switch (aura->GetAuraType())
{
case SPELL_AURA_MOD_DAMAGE_DONE: unitModType = TOTAL_VALUE; break;
case SPELL_AURA_MOD_DAMAGE_PERCENT_DONE: unitModType = TOTAL_PCT; break;
@@ -7322,9 +7333,9 @@ void Player::ApplyEquipSpell(SpellEntry const* spellInfo, Item* item, bool apply
if (form_change) // check aura active state from other form
{
AuraMap const& auras = GetAuras();
for (AuraMap::const_iterator itr = auras.lower_bound(spellInfo->Id); itr != auras.upper_bound(spellInfo->Id); ++itr)
if (!item || itr->second->GetCastItemGUID()==item->GetGUID())
AuraApplicationMap const& auras = GetAppliedAuras();
for (AuraApplicationMap::const_iterator itr = auras.lower_bound(spellInfo->Id); itr != auras.upper_bound(spellInfo->Id); ++itr)
if (!item || itr->second->GetBase()->GetCastItemGUID() == item->GetGUID())
return;
}
@@ -13851,7 +13862,7 @@ void Player::RewardQuest( Quest const *pQuest, uint32 reward, Object* questGiver
uint32 XP = q_status.m_rewarded ? 0 : uint32(pQuest->XPValue( this )*sWorld.getRate(RATE_XP_QUEST));
// handle SPELL_AURA_MOD_XP_QUEST_PCT auras
Unit::AuraEffectList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_XP_QUEST_PCT);
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_QUEST_PCT);
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
XP = uint32(XP*(1.0f + (*i)->GetAmount() / 100.0f));
@@ -16007,24 +16018,29 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
{
sLog.outDebug("Loading auras for player %u",GetGUIDLow());
//QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_mask,stackcount,amount0,amount1,amount2,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'",GetGUIDLow());
//QueryResult *result = CharacterDatabase.PQuery("SELECT caster_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'",GetGUIDLow());
if (result)
{
do
{
int32 damage[3];
int32 baseDamage[3];
Field *fields = result->Fetch();
uint64 caster_guid = fields[0].GetUInt64();
uint32 spellid = fields[1].GetUInt32();
uint8 effmask = fields[2].GetUInt8();
uint8 stackcount = fields[3].GetUInt8();
damage[0] = fields[4].GetInt32();
damage[1] = fields[5].GetInt32();
damage[2] = fields[6].GetInt32();
int32 maxduration = fields[7].GetInt32();
int32 remaintime = fields[8].GetInt32();
uint8 remaincharges = fields[9].GetUInt8();
uint8 recalculatemask = fields[3].GetUInt8();
uint8 stackcount = fields[4].GetUInt8();
damage[0] = fields[5].GetInt32();
damage[1] = fields[6].GetInt32();
damage[2] = fields[7].GetInt32();
baseDamage[0] = fields[8].GetInt32();
baseDamage[1] = fields[9].GetInt32();
baseDamage[2] = fields[10].GetInt32();
int32 maxduration = fields[11].GetInt32();
int32 remaintime = fields[12].GetInt32();
uint8 remaincharges = fields[13].GetUInt8();
SpellEntry const* spellproto = sSpellStore.LookupEntry(spellid);
if (!spellproto)
@@ -16051,15 +16067,17 @@ void Player::_LoadAuras(QueryResult *result, uint32 timediff)
else
remaincharges = 0;
Aura* aura = new Aura(spellproto, effmask, this, this, this);
aura->SetLoadedState(caster_guid,maxduration,remaintime,remaincharges, stackcount, &damage[0]);
if (!aura->CanBeSaved())
if (Aura * aura = Aura::TryCreate(spellproto, effmask, this, NULL, &baseDamage[0], NULL, caster_guid))
{
delete aura;
continue;
if (!aura->CanBeSaved())
{
aura->Remove();
continue;
}
aura->SetLoadedState(maxduration,remaintime,remaincharges,stackcount,recalculatemask,&damage[0]);
aura->ApplyForTargets();
sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
}
AddAura(aura);
sLog.outDetail("Added aura spellid %u, effectmask %u", spellproto->Id, effmask);
}
while (result->NextRow());
@@ -17170,26 +17188,39 @@ void Player::_SaveAuras()
{
CharacterDatabase.PExecute("DELETE FROM character_aura WHERE guid = '%u'",GetGUIDLow());
AuraMap const& auras = GetAuras();
for (AuraMap::const_iterator itr = auras.begin(); itr !=auras.end() ; ++itr)
for (AuraMap::const_iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end() ; ++itr)
{
if (!itr->second->CanBeSaved())
continue;
int32 amounts[MAX_SPELL_EFFECTS];
Aura * aura = itr->second;
int32 damage[MAX_SPELL_EFFECTS];
int32 baseDamage[MAX_SPELL_EFFECTS];
uint8 effMask = 0;
uint8 recalculateMask = 0;
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
if (AuraEffect * partAura = itr->second->GetPartAura(i))
amounts[i] = partAura->GetAmount();
if (aura->GetEffect(i))
{
baseDamage[i] = aura->GetEffect(i)->GetBaseAmount();
damage[i] = aura->GetEffect(i)->GetAmount();
effMask |= (1<<i);
if (aura->GetEffect(i)->CanBeRecalculated())
recalculateMask |= (1<<i);
}
else
amounts[i] = 0;
{
baseDamage[i] = NULL;
damage[i] = NULL;
}
}
CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_mask,stackcount,amount0,amount1,amount2,maxduration,remaintime,remaincharges) "
"VALUES ('%u', '" UI64FMTD "', '%u', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%u')",
GetGUIDLow(), itr->second->GetCasterGUID(), itr->second->GetId(), itr->second->GetEffectMask(),
itr->second->GetStackAmount(), amounts[0], amounts[1], amounts[2],
itr->second->GetAuraMaxDuration(),itr->second->GetAuraDuration(),itr->second->GetAuraCharges());
CharacterDatabase.PExecute("INSERT INTO character_aura (guid,caster_guid,spell,effect_mask,recalculate_mask,stackcount,amount0,amount1,amount2,base_amount0,base_amount1,base_amount2,maxduration,remaintime,remaincharges) "
"VALUES ('%u', '" UI64FMTD "', '%u', '%u', '%u', '%u', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%d', '%u')",
GetGUIDLow(), itr->second->GetCasterGUID(), itr->second->GetId(), effMask, recalculateMask,
itr->second->GetStackAmount(), damage[0], damage[1], damage[2], baseDamage[0], baseDamage[1], baseDamage[2],
itr->second->GetMaxDuration(), itr->second->GetDuration(),itr->second->GetCharges());
}
}
@@ -18204,6 +18235,7 @@ bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mo
void Player::AddSpellMod(SpellModifier* mod, bool apply)
{
sLog.outDebug("Player::AddSpellMod %d", mod->spellId);
uint16 Opcode = (mod->type == SPELLMOD_FLAT) ? SMSG_SET_FLAT_SPELL_MODIFIER : SMSG_SET_PCT_SPELL_MODIFIER;
int i = 0;
@@ -18236,7 +18268,9 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
else
{
m_spellMods[mod->op].remove(mod);
delete mod;
// mods bound to aura will be removed in AuraEffect::~AuraEffect
if (!mod->ownerAura)
delete mod;
}
}
@@ -18253,7 +18287,7 @@ void Player::RestoreSpellMods(Spell * spell)
SpellModifier *mod = *itr;
// spellmods without aura set cannot be charged
if (!mod->ownerAura || !mod->ownerAura->GetAuraCharges())
if (!mod->ownerAura || !mod->ownerAura->GetCharges())
continue;
// check if mod affected this spell
@@ -18271,12 +18305,12 @@ void Player::RestoreSpellMods(Spell * spell)
mod->charges++;
// Do not set more spellmods than avalible
if (mod->ownerAura->GetAuraCharges() < mod->charges)
mod->charges = mod->ownerAura->GetAuraCharges();
if (mod->ownerAura->GetCharges() < mod->charges)
mod->charges = mod->ownerAura->GetCharges();
// Skip this check for now - aura charges may change due to various reason
// TODO: trac these changes correctly
//assert (mod->ownerAura->GetAuraCharges() <= mod->charges);
//assert (mod->ownerAura->GetCharges() <= mod->charges);
}
}
}
@@ -18287,27 +18321,28 @@ void Player::RemoveSpellMods(Spell * spell)
return;
std::set <Aura *> checkedSpells;
AuraEffectList const & auraList = GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
AuraEffectList const & auraList = GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
for (AuraEffectList::const_iterator itr = auraList.begin(); itr != auraList.end();)
{
AuraEffect * aur = *itr;
AuraEffect * aurEff = *itr;
Aura * aura = aurEff->GetBase();
++itr;
if (!aur->GetParentAura()->GetAuraCharges())
if (!aura->GetCharges())
continue;
SpellEntry const * spellInfo = aur->GetSpellProto();
SpellEntry const * spellInfo = aura->GetSpellProto();
if (spellInfo->SpellFamilyName != spell->m_spellInfo->SpellFamilyName ||
checkedSpells.find(aur->GetParentAura()) != checkedSpells.end())
checkedSpells.find(aura) != checkedSpells.end())
continue;
if (spell->m_spellInfo->SpellFamilyFlags & spellInfo->EffectSpellClassMask[aur->GetEffIndex()]
if (spell->m_spellInfo->SpellFamilyFlags & spellInfo->EffectSpellClassMask[aurEff->GetEffIndex()]
// this is for fingers of frost, look at spell::finish part, a charge will be taken by the triggering spell
&& aur->GetParentAura()->GetAuraDuration() != aur->GetParentAura()->GetAuraMaxDuration())
&& aura->GetDuration() != aura->GetMaxDuration())
{
checkedSpells.insert(aur->GetParentAura());
spell->m_appliedMods.erase(aur->GetParentAura());
if (aur->GetParentAura()->DropAuraCharge())
checkedSpells.insert(aura);
spell->m_appliedMods.erase(aura);
if (aura->DropCharge())
itr = auraList.begin();
}
}
@@ -18323,7 +18358,7 @@ void Player::RemoveSpellMods(Spell * spell)
++itr;
// spellmods without aura set cannot be charged
if (!mod->ownerAura || !mod->ownerAura->GetAuraCharges())
if (!mod->ownerAura || !mod->ownerAura->GetCharges())
continue;
// check if mod affected this spell
@@ -18334,7 +18369,7 @@ void Player::RemoveSpellMods(Spell * spell)
// remove from list
spell->m_appliedMods.erase(iterMod);
if (mod->ownerAura->DropAuraCharge())
if (mod->ownerAura->DropCharge())
itr = m_spellMods[i].begin();
}
}
@@ -19565,7 +19600,7 @@ void Player::SetBattleGroundEntryPoint()
// Mount spell id storing
if (IsMounted())
{
AuraEffectList const& auras = GetAurasByType(SPELL_AURA_MOUNTED);
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOUNTED);
if (!auras.empty())
m_bgData.mountSpell = (*auras.begin())->GetId();
}
@@ -20181,15 +20216,15 @@ void Player::SendInitialPacketsAfterAddToMap()
};
for (AuraType const* itr = &auratypes[0]; itr && itr[0] != SPELL_AURA_NONE; ++itr)
{
Unit::AuraEffectList const& auraList = GetAurasByType(*itr);
Unit::AuraEffectList const& auraList = GetAuraEffectsByType(*itr);
if(!auraList.empty())
auraList.front()->ApplyModifier(true,true);
auraList.front()->HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true);
}
if(HasAuraType(SPELL_AURA_MOD_STUN))
SetMovement(MOVE_ROOT);
// manual send package (have code in ApplyModifier(true,true); that don't must be re-applied.
// manual send package (have code in HandleEffect(this, AURA_EFFECT_HANDLE_SEND_FOR_CLIENT, true); that don't must be re-applied.
if(HasAuraType(SPELL_AURA_MOD_ROOT))
{
WorldPacket data2(SMSG_FORCE_MOVE_ROOT, 10);
@@ -20489,29 +20524,28 @@ void Player::SendAurasForTarget(Unit *target)
Unit::VisibleAuraMap const *visibleAuras = target->GetVisibleAuras();
for (Unit::VisibleAuraMap::const_iterator itr = visibleAuras->begin(); itr != visibleAuras->end(); ++itr)
{
Aura * aura=itr->second;
data << uint8(aura->GetAuraSlot());
AuraApplication * auraApp = itr->second;
Aura * aura = auraApp->GetBase();
data << uint8(auraApp->GetSlot());
data << uint32(aura->GetId());
// flags
data << aura->m_auraFlags;
uint32 flags = auraApp->GetFlags();
if (aura->GetMaxDuration() > 0)
flags |= AFLAG_DURATION;
data << uint8(flags);
// level
data << aura->m_auraLevel;
data << uint8(aura->GetCasterLevel());
// charges
data << uint8(aura->GetStackAmount()>1 ? aura->GetStackAmount() : aura->GetAuraCharges());
data << uint8(aura->GetStackAmount() > 1 ? aura->GetStackAmount() : (aura->GetCharges()) ? aura->GetCharges() : 1);
if(!(aura->m_auraFlags & AFLAG_CASTER))
{
if (Unit * caster = aura->GetCaster())
data.append(caster->GetPackGUID());
else
data << uint8(0);
}
if(!(flags & AFLAG_CASTER))
data.appendPackGUID(aura->GetCasterGUID());
if(aura->m_auraFlags & AFLAG_DURATION) // include aura duration
if(flags & AFLAG_DURATION) // include aura duration
{
data << uint32(aura->GetAuraMaxDuration());
data << uint32(aura->GetAuraDuration());
data << uint32(aura->GetMaxDuration());
data << uint32(aura->GetDuration());
}
}
@@ -20847,14 +20881,13 @@ bool Player::CanNoReagentCast(SpellEntry const* spellInfo) const
void Player::RemoveItemDependentAurasAndCasts( Item * pItem )
{
AuraMap& auras = GetAuras();
for (AuraMap::iterator itr = auras.begin(); itr != auras.end();)
for (AuraMap::iterator itr = m_ownedAuras.begin(); itr != m_ownedAuras.end();)
{
Aura* aura = itr->second;
Aura * aura = itr->second;
// skip passive (passive item dependent spells work in another way) and not self applied auras
SpellEntry const* spellInfo = aura->GetSpellProto();
if(aura->IsPassive() || aura->GetCasterGUID()!=GetGUID())
if(aura->IsPassive() || aura->GetCasterGUID() != GetGUID())
{
++itr;
continue;
@@ -20868,7 +20901,7 @@ void Player::RemoveItemDependentAurasAndCasts( Item * pItem )
}
// no alt item, remove aura, restart check
RemoveAura(itr);
RemoveOwnedAura(itr);
}
// currently casted spells can be dependent from item
@@ -20883,7 +20916,7 @@ uint32 Player::GetResurrectionSpellId()
// search priceless resurrection possibilities
uint32 prio = 0;
uint32 spell_id = 0;
AuraEffectList const& dummyAuras = GetAurasByType(SPELL_AURA_DUMMY);
AuraEffectList const& dummyAuras = GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (AuraEffectList::const_iterator itr = dummyAuras.begin(); itr != dummyAuras.end(); ++itr)
{
// Soulstone Resurrection // prio: 3 (max, non death persistent)
@@ -20997,7 +21030,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
uint32 itr_xp = (member_with_max_level == not_gray_member_with_max_level) ? uint32(xp*rate) : uint32((xp*rate/2)+1);
// handle SPELL_AURA_MOD_XP_PCT auras
Unit::AuraEffectList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_XP_PCT);
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_PCT);
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
itr_xp = uint32(itr_xp*(1.0f + (*i)->GetAmount() / 100.0f));
@@ -21031,7 +21064,7 @@ bool Player::RewardPlayerAndGroupAtKill(Unit* pVictim)
RewardReputation(pVictim,1);
// handle SPELL_AURA_MOD_XP_PCT auras
Unit::AuraEffectList const& ModXPPctAuras = GetAurasByType(SPELL_AURA_MOD_XP_PCT);
Unit::AuraEffectList const& ModXPPctAuras = GetAuraEffectsByType(SPELL_AURA_MOD_XP_PCT);
for (Unit::AuraEffectList::const_iterator i = ModXPPctAuras.begin(); i != ModXPPctAuras.end(); ++i)
xp = uint32(xp*(1.0f + (*i)->GetAmount() / 100.0f));
@@ -21158,11 +21191,11 @@ void Player::UpdateZoneDependentAuras( uint32 newZone )
void Player::UpdateAreaDependentAuras( uint32 newArea )
{
// remove auras from spells with area limitations
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end();)
for (AuraMap::iterator iter = m_ownedAuras.begin(); iter != m_ownedAuras.end();)
{
// use m_zoneUpdateId for speed: UpdateArea called from UpdateZone or instead UpdateZone in both cases m_zoneUpdateId up-to-date
if(spellmgr.GetSpellAllowedInLocationError(iter->second->GetSpellProto(),GetMapId(),m_zoneUpdateId,newArea,this) != SPELL_CAST_OK)
RemoveAura(iter);
RemoveOwnedAura(iter);
else
++iter;
}
@@ -21575,7 +21608,7 @@ void Player::InitGlyphsForLevel()
bool Player::isTotalImmune()
{
AuraEffectList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
AuraEffectList const& immune = GetAuraEffectsByType(SPELL_AURA_SCHOOL_IMMUNITY);
uint32 immuneMask = 0;
for (AuraEffectList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
@@ -21626,7 +21659,7 @@ void Player::SetTitle(CharTitlesEntry const* title, bool lost)
/*-----------------------TRINITY--------------------------*/
bool Player::isTotalImmunity()
{
AuraEffectList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
AuraEffectList const& immune = GetAuraEffectsByType(SPELL_AURA_SCHOOL_IMMUNITY);
for (AuraEffectList::const_iterator itr = immune.begin(); itr != immune.end(); ++itr)
{
@@ -21656,9 +21689,9 @@ void Player::UpdateCharmedAI()
//kill self if charm aura has infinite duration
if(charmer->IsInEvadeMode())
{
AuraEffectList const& auras = GetAurasByType(SPELL_AURA_MOD_CHARM);
AuraEffectList const& auras = GetAuraEffectsByType(SPELL_AURA_MOD_CHARM);
for (AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetParentAura()->IsPermanent())
if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetBase()->IsPermanent())
{
charmer->DealDamage(this, GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
return;
@@ -21680,6 +21713,34 @@ void Player::UpdateCharmedAI()
}
}
void Player::RemoveRunesByAuraEffect(AuraEffect const * aura)
{
for(uint8 i = 0; i < MAX_RUNES; ++i)
{
if (m_runes->runes[i].ConvertAura == aura)
{
ConvertRune(i, GetBaseRune(i));
SetRuneConvertAura(i, NULL);
}
}
}
void Player::RestoreBaseRune(uint8 index)
{
AuraEffect const * aura = m_runes->runes[index].ConvertAura;
ConvertRune(index, GetBaseRune(index));
SetRuneConvertAura(index, NULL);
// Don't drop passive talents providing rune convertion
if (!aura || aura->GetAuraType() != SPELL_AURA_CONVERT_RUNE)
return;
for(uint8 i = 0; i < MAX_RUNES; ++i)
{
if (aura == m_runes->runes[i].ConvertAura)
return;
}
aura->GetBase()->Remove();
}
void Player::ConvertRune(uint8 index, RuneType newType)
{
SetCurrentRune(index, newType);
@@ -21732,6 +21793,7 @@ void Player::InitRunes()
SetBaseRune(i, runeSlotTypes[i]); // init base types
SetCurrentRune(i, runeSlotTypes[i]); // init current types
SetRuneCooldown(i, 0); // reset cooldowns
SetRuneConvertAura(i, NULL);
m_runes->SetRuneState(i);
}
@@ -21915,7 +21977,7 @@ uint32 Player::GetPhaseMaskForSpawn() const
phase = GetPhaseMask();
else
{
AuraEffectList const& phases = GetAurasByType(SPELL_AURA_PHASE);
AuraEffectList const& phases = GetAuraEffectsByType(SPELL_AURA_PHASE);
if (!phases.empty())
phase = phases.front()->GetMiscValue();
}
@@ -22034,7 +22096,7 @@ void Player::HandleFall(MovementInfo const& movementInfo)
DEBUG_LOG("FALLDAMAGE z=%f sz=%f pZ=%f FallTime=%d mZ=%f damage=%d SF=%d" , movementInfo.z, height, GetPositionZ(), movementInfo.fallTime, height, damage, safe_fall);
}
}
RemoveAura(44795); // No fly zone - Parachute
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_LANDING); // No fly zone - Parachute
}
void Player::UpdateAchievementCriteria( AchievementCriteriaTypes type, uint32 miscvalue1/*=0*/, uint32 miscvalue2/*=0*/, Unit *unit/*=NULL*/, uint32 time/*=0*/ )
+9 -4
View File
@@ -111,7 +111,7 @@ struct SpellModifier
int32 value;
flag96 mask;
uint32 spellId;
Aura *const ownerAura;
Aura * const ownerAura;
};
typedef UNORDERED_MAP<uint32, PlayerTalent*> PlayerTalentMap;
@@ -297,6 +297,7 @@ struct RuneInfo
uint8 BaseRune;
uint8 CurrentRune;
uint8 Cooldown;
AuraEffect const * ConvertAura;
};
struct Runes
@@ -1924,8 +1925,8 @@ class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player>
void _RemoveAllStatBonuses();
void _ApplyWeaponDependentAuraMods(Item *item, WeaponAttackType attackType, bool apply);
void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply);
void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect* aura, bool apply);
void _ApplyWeaponDependentAuraCritMod(Item *item, WeaponAttackType attackType, AuraEffect const * aura, bool apply);
void _ApplyWeaponDependentAuraDamageMod(Item *item, WeaponAttackType attackType, AuraEffect const * aura, bool apply);
void _ApplyItemMods(Item *item,uint8 slot,bool apply);
void _RemoveAllItemMods();
@@ -2259,6 +2260,10 @@ class TRINITY_DLL_SPEC Player : public Unit, public GridObject<Player>
void SetBaseRune(uint8 index, RuneType baseRune) { m_runes->runes[index].BaseRune = baseRune; }
void SetCurrentRune(uint8 index, RuneType currentRune) { m_runes->runes[index].CurrentRune = currentRune; }
void SetRuneCooldown(uint8 index, uint8 cooldown) { m_runes->runes[index].Cooldown = cooldown; m_runes->SetRuneState(index, (cooldown == 0) ? true : false); }
void SetRuneConvertAura(uint8 index, AuraEffect const * aura) { m_runes->runes[index].ConvertAura = aura; }
void AddRuneByAuraEffect(uint8 index, RuneType newType, AuraEffect const * aura) { SetRuneConvertAura(index, aura); ConvertRune(index, newType); }
void RemoveRunesByAuraEffect(AuraEffect const * aura);
void RestoreBaseRune(uint8 index);
void ConvertRune(uint8 index, RuneType newType);
void ResyncRunes(uint8 count);
void AddRunePower(uint8 index);
@@ -2594,6 +2599,7 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
if(!IsAffectedBySpellmod(spellInfo,mod,spell))
continue;
if (mod->type == SPELLMOD_FLAT)
totalflat += mod->value;
else if (mod->type == SPELLMOD_PCT)
@@ -2611,7 +2617,6 @@ template <class T> T Player::ApplySpellMod(uint32 spellId, SpellModOp op, T &bas
DropModCharge(mod, spell);
}
float diff = (float)basevalue*(float)totalpct/100.0f + (float)totalflat;
basevalue = T((float)basevalue + diff);
return T(diff);
+1 -1
View File
@@ -2495,7 +2495,7 @@ enum DiminishingReturnsType
enum DiminishingGroup
{
// Common Groups
DIMINISHING_NONE,
DIMINISHING_NONE = 0,
DIMINISHING_CONTROL_STUN, // Player Controlled stuns
DIMINISHING_TRIGGER_STUN, // By aura proced stuns, usualy chance on hit talents
DIMINISHING_CONTROL_ROOT, // Immobilizing effects from casted spells
+111 -165
View File
@@ -50,6 +50,7 @@
#include "TemporarySummon.h"
#include "Vehicle.h"
#include "ScriptCalls.h"
#include "SpellAuraEffects.h"
#define SPELL_CHANNEL_UPDATE_INTERVAL (1 * IN_MILISECONDS)
@@ -382,8 +383,6 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_delayStart = 0;
m_delayAtDamageCount = 0;
m_canTrigger=true;
m_applyMultiplierMask = 0;
m_effectMask = 0;
m_auraScaleMask = 0;
@@ -455,7 +454,6 @@ Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 origi
m_preCastSpell = 0;
m_triggeredByAuraSpell = NULL;
m_spellAura = NULL;
m_spellDynObj = NULL;
//Auto Shot & Shoot (wand)
m_autoRepeat = IsAutoRepeatRangedSpell(m_spellInfo);
@@ -773,7 +771,7 @@ void Spell::SelectSpellTargets()
}
}
void Spell::prepareDataForTriggerSystem(AuraEffect * triggeredByAura)
void Spell::prepareDataForTriggerSystem(AuraEffect const * triggeredByAura)
{
//==========================================================================================
// Now fill data for trigger system, need know:
@@ -828,10 +826,6 @@ void Spell::prepareDataForTriggerSystem(AuraEffect * triggeredByAura)
Effects which are result of aura proc from triggered spell cannot proc
to prevent chain proc of these spells
*/
if ((triggeredByAura && !triggeredByAura->GetParentAura()->GetTarget()->CanProc()))
{
m_canTrigger=false;
}
// Ranged autorepeat attack is set as triggered spell - ignore it
if (!(m_procAttacker & PROC_FLAG_SUCCESSFUL_RANGED_HIT))
@@ -1072,7 +1066,7 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
//Spells with this flag cannot trigger if effect is casted on self
// Slice and Dice, relentless strikes, eviscerate
bool canEffectTrigger = m_canTrigger && (m_spellInfo->AttributesEx4 & (SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST) ? m_caster!=unitTarget : true);
bool canEffectTrigger = unitTarget->CanProc() && (m_spellInfo->AttributesEx4 & (SPELL_ATTR_EX4_CANT_PROC_FROM_SELFCAST) ? m_caster!=unitTarget : true);
Unit * spellHitTarget = NULL;
if (missInfo==SPELL_MISS_NONE) // In case spell hit target, do all effect on that target
@@ -1166,9 +1160,6 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
if (canEffectTrigger && missInfo != SPELL_MISS_REFLECT)
caster->ProcDamageAndSpell(unitTarget, procAttacker, procVictim, procEx, addhealth, m_attackType, m_spellInfo, m_triggeredByAuraSpell);
if (m_spellAura)
m_spellAura->SetProcDamage(addhealth);
int32 gain = caster->DealHeal(unitTarget, addhealth, m_spellInfo, crit);
unitTarget->getHostilRefManager().threatAssist(caster, float(gain) * 0.5f, m_spellInfo);
}
@@ -1197,10 +1188,14 @@ void Spell::DoAllEffectOnTarget(TargetInfo *target)
((Player *)caster)->CastItemCombatSpell(unitTarget, m_attackType, procVictim, procEx);
}
if (m_spellAura)
m_spellAura->SetProcDamage(damageInfo.damage);
caster->DealSpellDamage(&damageInfo, true);
// Haunt
if(m_spellInfo->SpellFamilyName == SPELLFAMILY_WARLOCK && m_spellInfo->SpellFamilyFlags[1] & 0x40000 && m_spellAura && m_spellAura->GetEffect(1))
{
AuraEffect * aurEff = m_spellAura->GetEffect(1);
aurEff->SetAmount(aurEff->GetAmount() * damageInfo.damage / 100);
}
}
// Passive spell hits/misses or active spells only misses (only triggers)
else
@@ -1339,7 +1334,7 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
uint8 aura_effmask = 0;
for (uint8 i = 0; i < 3; ++i)
if (effectMask & (1<<i) && (m_spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA || IsAreaAuraEffect(m_spellInfo->Effect[i])))
if (effectMask & (1<<i) && IsUnitOwnedAuraEffect(m_spellInfo->Effect[i]))
aura_effmask |= 1<<i;
if (aura_effmask)
@@ -1355,51 +1350,49 @@ SpellMissInfo Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask, bool
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
basePoints[i] = aurSpellInfo->EffectBasePoints[i];
}
}
else
{
for (uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i)
{
basePoints[i] = m_currentBasePoints[i];
if (m_spellInfo->Effect[i] != aurSpellInfo->Effect[i])
{
aurSpellInfo = m_spellInfo;
break;
}
}
}
if(m_originalCaster)
{
Aura *Aur = new Aura(aurSpellInfo, aura_effmask, unit, m_caster, m_originalCaster, basePoints, m_CastItem);
if (!Aur->IsAreaAura())
{
// Now Reduce spell duration using data received at spell hit
int32 duration = Aur->GetAuraMaxDuration();
int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup,aurSpellInfo);
unitTarget->ApplyDiminishingToDuration(m_diminishGroup, duration, m_originalCaster, m_diminishLevel,limitduration);
Aur->setDiminishGroup(m_diminishGroup);
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, Aur->IsPositive());
//mod duration of channeled aura by spell haste
if (IsChanneledSpell(m_spellInfo))
m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
if(duration != Aur->GetAuraMaxDuration())
if (m_spellAura = Aura::TryCreate(aurSpellInfo, effectMask, unit,
m_originalCaster,(aurSpellInfo == m_spellInfo)? &m_currentBasePoints[0] : &basePoints[0], m_CastItem))
{
Aur->SetAuraMaxDuration(duration);
Aur->SetAuraDuration(duration);
}
// Now Reduce spell duration using data received at spell hit
int32 duration = m_spellAura->GetMaxDuration();
int32 limitduration = GetDiminishingReturnsLimitDuration(m_diminishGroup,aurSpellInfo);
unit->ApplyDiminishingToDuration(m_diminishGroup, duration, m_originalCaster, m_diminishLevel,limitduration);
((UnitAura*)m_spellAura)->SetDiminishGroup(m_diminishGroup);
// Prayer of Mending (jump animation), we need formal caster instead original for correct animation
if( aurSpellInfo->SpellFamilyName == SPELLFAMILY_PRIEST)
{
if(aurSpellInfo->SpellFamilyFlags[1] & 0x000020)
m_caster->CastSpell(unit, 41637, true, NULL, NULL, m_originalCasterGUID);
}
}
// Set aura only when successfully applied
if (unit->AddAura(Aur, false))
m_spellAura = Aur;
bool positive = IsPositiveSpell(m_spellAura->GetId());
AuraApplication * aurApp = m_spellAura->GetApplicationOfTarget(m_originalCaster->GetGUID());
if (aurApp)
positive = aurApp->IsPositive();
duration = m_originalCaster->ModSpellDuration(aurSpellInfo, unit, duration, positive);
//mod duration of channeled aura by spell haste
if (IsChanneledSpell(m_spellInfo))
m_originalCaster->ModSpellCastTime(aurSpellInfo, duration, this);
if(duration != m_spellAura->GetMaxDuration())
{
m_spellAura->SetMaxDuration(duration);
m_spellAura->SetDuration(duration);
}
// Prayer of Mending (jump animation), we need formal caster instead original for correct animation
if(aurSpellInfo->SpellFamilyName == SPELLFAMILY_PRIEST)
{
if(aurSpellInfo->SpellFamilyFlags[1] & 0x000020)
m_caster->CastSpell(unit, 41637, true, NULL, NULL, m_originalCasterGUID);
}
}
}
}
@@ -1451,10 +1444,9 @@ void Spell::DoTriggersOnSpellHit(Unit *unit)
if (!_duration)
{
Aura * aur = unit->GetAura(m_spellInfo->Id, m_caster->GetGUID());
_duration = aur ? aur->GetAuraDuration() : -1;
_duration = aur ? aur->GetDuration() : -1;
}
triggeredAur->SetAuraDuration(_duration);
triggeredAur->SetPermanent(false);
triggeredAur->SetDuration(_duration);
}
}
}
@@ -1541,12 +1533,12 @@ bool Spell::UpdateChanneledTargetList()
{
if (needAuraMask & ihit->effectMask)
{
if(Aura * aur = unit->GetAura(m_spellInfo->Id, m_originalCasterGUID))
if(AuraApplication * aurApp = unit->GetAuraApplication(m_spellInfo->Id, m_originalCasterGUID))
{
if (m_caster != unit && !m_caster->IsWithinDistInMap(unit,range))
{
ihit->effectMask &= ~aur->GetEffectMask();
unit->RemoveAura(aur);
ihit->effectMask &= ~aurApp->GetEffectMask();
unit->RemoveAura(aurApp);
continue;
}
}
@@ -1615,10 +1607,10 @@ void Spell::SearchChainTarget(std::list<Unit*> &TagUnitMap, float max_range, uin
// Get spell max affected targets
/*uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets;
Unit::AuraList const& mod = m_caster->GetAurasByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS);
Unit::AuraList const& mod = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS);
for (Unit::AuraList::const_iterator m = mod.begin(); m != mod.end(); ++m)
{
if (!(*m)->isAffectedOnSpell(m_spellInfo))
if (!(*m)->IsAffectedOnSpell(m_spellInfo))
continue;
unMaxTargets+=(*m)->GetAmount();
}*/
@@ -2448,9 +2440,9 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
{
if(uint32 maxTargets = m_spellValue->MaxAffectedTargets)
{
Unit::AuraEffectList const& Auras = m_caster->GetAurasByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS);
Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_MAX_AFFECTED_TARGETS);
for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j)
if((*j)->isAffectedOnSpell(m_spellInfo))
if((*j)->IsAffectedOnSpell(m_spellInfo))
maxTargets += (*j)->GetAmount();
if(m_spellInfo->Id == 5246) //Intimidating Shout
@@ -2572,7 +2564,7 @@ void Spell::SelectEffectTargets(uint32 i, uint32 cur)
}
}
void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura)
void Spell::prepare(SpellCastTargets const* targets, AuraEffect const * triggeredByAura)
{
if (m_CastItem)
m_castItemGUID = m_CastItem->GetGUID();
@@ -2677,7 +2669,7 @@ void Spell::prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura
if(triggeredByAura)
{
SendChannelUpdate(0);
triggeredByAura->GetParentAura()->SetAuraDuration(0);
triggeredByAura->GetBase()->SetDuration(0);
}
SendCastResult(result);
@@ -2761,11 +2753,10 @@ void Spell::cancel()
case SPELL_STATE_CASTING:
{
for (std::list<TargetInfo>::iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if(ihit->missCondition == SPELL_MISS_NONE)
if(Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
if(unit->isAlive())
unit->RemoveAurasDueToSpell(m_spellInfo->Id, m_originalCasterGUID, AURA_REMOVE_BY_CANCEL);
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if ((*ihit).missCondition == SPELL_MISS_NONE)
if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
unit->RemoveOwnedAura(m_spellInfo->Id, m_originalCasterGUID, 0, AURA_REMOVE_BY_CANCEL);
SendChannelUpdate(0);
SendInterrupted(0);
@@ -2912,18 +2903,18 @@ void Spell::cast(bool skipCheck)
// are there any spells need to be triggered after hit?
// handle SPELL_AURA_ADD_TARGET_TRIGGER auras
Unit::AuraEffectList const& targetTriggers = m_caster->GetAurasByType(SPELL_AURA_ADD_TARGET_TRIGGER);
Unit::AuraEffectList const& targetTriggers = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_TARGET_TRIGGER);
for (Unit::AuraEffectList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i)
{
if (!(*i)->isAffectedOnSpell(m_spellInfo))
if (!(*i)->IsAffectedOnSpell(m_spellInfo))
continue;
SpellEntry const *auraSpellInfo = (*i)->GetSpellProto();
uint32 auraSpellIdx = (*i)->GetEffIndex();
if(SpellEntry const *spellInfo = sSpellStore.LookupEntry(auraSpellInfo->EffectTriggerSpell[auraSpellIdx]))
{
// Calculate chance at that moment (can be depend for example from combo points)
int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBasePoints(), NULL);
m_ChanceTriggerSpells.push_back(std::make_pair(spellInfo, chance * (*i)->GetParentAura()->GetStackAmount()));
int32 chance = m_caster->CalculateSpellDamage(auraSpellInfo, auraSpellIdx, (*i)->GetBaseAmount(), NULL);
m_ChanceTriggerSpells.push_back(std::make_pair(spellInfo, chance * (*i)->GetBase()->GetStackAmount()));
}
}
@@ -3091,6 +3082,7 @@ uint64 Spell::handle_delayed(uint64 t_offset)
void Spell::_handle_immediate_phase()
{
m_spellAura = NULL;
// handle some immediate features of the spell here
HandleThreatSpells(m_spellInfo->Id);
@@ -4204,52 +4196,8 @@ void Spell::TakeRunePower()
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
plr->SetLastUsedRune(RuneType(rune));
runeCost[rune]--;
bool auraFound = false;
plr->ConvertRune(i, plr->GetBaseRune(i));
// * * * * * * * * * * *
// update convert rune auras
// * * * * * * * * * * *
// Remove rune from SPELL_AURA_CONVERT_RUNE when rune is used
// To prevent overriding other rune convert effects
Unit::AuraEffectList const& runeconvert = m_caster->GetAurasByType(SPELL_AURA_CONVERT_RUNE);
for (Unit::AuraEffectList::const_iterator itr = runeconvert.begin(); itr != runeconvert.end(); ++itr)
{
// Remove rune of aura if avalible
if ((*itr)->GetAmount() & (1<<i))
{
(*itr)->SetAmount((*itr)->GetAmount() & ~(1<<i));
auraFound = true;
}
// All runes from aura used - remove aura
if (!(*itr)->GetAmount())
plr->RemoveAura((*itr)->GetParentAura(), AURA_REMOVE_BY_EXPIRE);
break;
}
if (!auraFound)
{
// Decrease used rune count for dk talent auras
// To prevent overriding other rune convert effects
Unit::AuraEffectList const& runeconvert = m_caster->GetAurasByType(SPELL_AURA_CONVERT_RUNE);
for (Unit::AuraEffectList::const_iterator itr = runeconvert.begin(); itr != runeconvert.end(); ++itr)
{
if (plr->GetBaseRune(i) != RUNE_DEATH)
{
// Death Rune Mastery
if ((*itr)->GetSpellProto()->SpellIconID != 2622)
continue;
}
// Blood of the North
// Reaping
else if ((*itr)->GetSpellProto()->SpellIconID != 3041 &&
(*itr)->GetSpellProto()->SpellIconID != 22)
continue;
// Remove rune of aura if avalible
if ((*itr)->GetAmount() & (1<<i))
(*itr)->SetAmount((*itr)->GetAmount() & ~(1<<i));
break;
}
}
plr->RestoreBaseRune(i);
if(runeCost[RUNE_DEATH] == 0)
break;
@@ -4401,10 +4349,10 @@ SpellCastResult Spell::CheckCast(bool strict)
{
bool checkForm = true;
// Ignore form req aura
Unit::AuraEffectList const& ignore = m_caster->GetAurasByType(SPELL_AURA_MOD_IGNORE_SHAPESHIFT);
Unit::AuraEffectList const& ignore = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_IGNORE_SHAPESHIFT);
for (Unit::AuraEffectList::const_iterator i = ignore.begin(); i != ignore.end(); ++i)
{
if (!(*i)->isAffectedOnSpell(m_spellInfo))
if (!(*i)->IsAffectedOnSpell(m_spellInfo))
continue;
checkForm = false;
break;
@@ -4422,10 +4370,10 @@ SpellCastResult Spell::CheckCast(bool strict)
}
bool reqCombat=true;
Unit::AuraEffectList const& stateAuras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
Unit::AuraEffectList const& stateAuras = m_caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_IGNORE_AURASTATE);
for (Unit::AuraEffectList::const_iterator j = stateAuras.begin(); j != stateAuras.end(); ++j)
{
if((*j)->isAffectedOnSpell(m_spellInfo))
if((*j)->IsAffectedOnSpell(m_spellInfo))
{
if ((*j)->GetMiscValue()==1)
{
@@ -5395,48 +5343,46 @@ SpellCastResult Spell::CheckCasterAuras() const
if(school_immune || mechanic_immune || dispel_immune)
{
//Checking auras is needed now, because you are prevented by some state but the spell grants immunity.
Unit::AuraMap const& auras = m_caster->GetAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
Unit::AuraApplicationMap const& auras = m_caster->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
if(itr->second)
{
if( GetAllSpellMechanicMask(itr->second->GetSpellProto()) & mechanic_immune )
continue;
if( GetSpellSchoolMask(itr->second->GetSpellProto()) & school_immune )
continue;
if( (1<<(itr->second->GetSpellProto()->Dispel)) & dispel_immune)
continue;
Aura const * aura = itr->second->GetBase();
if( GetAllSpellMechanicMask(aura->GetSpellProto()) & mechanic_immune )
continue;
if( GetSpellSchoolMask(aura->GetSpellProto()) & school_immune )
continue;
if( (1<<(aura->GetSpellProto()->Dispel)) & dispel_immune)
continue;
//Make a second check for spell failed so the right SPELL_FAILED message is returned.
//That is needed when your casting is prevented by multiple states and you are only immune to some of them.
for (uint8 i=0; i<MAX_SPELL_EFFECTS; ++i)
//Make a second check for spell failed so the right SPELL_FAILED message is returned.
//That is needed when your casting is prevented by multiple states and you are only immune to some of them.
for (uint8 i=0; i<MAX_SPELL_EFFECTS; ++i)
{
if (AuraEffect * part = aura->GetEffect(i))
{
if (AuraEffect * part = itr->second->GetPartAura(i))
switch(part->GetAuraType())
{
switch(part->GetAuraName())
{
case SPELL_AURA_MOD_STUN:
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))
return SPELL_FAILED_STUNNED;
break;
case SPELL_AURA_MOD_CONFUSE:
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED))
return SPELL_FAILED_CONFUSED;
break;
case SPELL_AURA_MOD_FEAR:
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED))
return SPELL_FAILED_FLEEING;
break;
case SPELL_AURA_MOD_SILENCE:
case SPELL_AURA_MOD_PACIFY:
case SPELL_AURA_MOD_PACIFY_SILENCE:
if( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY)
return SPELL_FAILED_PACIFIED;
else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE)
return SPELL_FAILED_SILENCED;
break;
default: break;
}
case SPELL_AURA_MOD_STUN:
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_STUNNED))
return SPELL_FAILED_STUNNED;
break;
case SPELL_AURA_MOD_CONFUSE:
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_CONFUSED))
return SPELL_FAILED_CONFUSED;
break;
case SPELL_AURA_MOD_FEAR:
if (!(m_spellInfo->AttributesEx5 & SPELL_ATTR_EX5_USABLE_WHILE_FEARED))
return SPELL_FAILED_FLEEING;
break;
case SPELL_AURA_MOD_SILENCE:
case SPELL_AURA_MOD_PACIFY:
case SPELL_AURA_MOD_PACIFY_SILENCE:
if( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_PACIFY)
return SPELL_FAILED_PACIFIED;
else if ( m_spellInfo->PreventionType==SPELL_PREVENTION_TYPE_SILENCE)
return SPELL_FAILED_SILENCED;
break;
default: break;
}
}
}
@@ -5465,7 +5411,7 @@ bool Spell::CanAutoCast(Unit* target)
else
{
if( AuraEffect * aureff = target->GetAuraEffect(m_spellInfo->Id, j))
if (aureff->GetParentAura()->GetStackAmount() >= m_spellInfo->StackAmount)
if (aureff->GetBase()->GetStackAmount() >= m_spellInfo->StackAmount)
return false;
}
}
@@ -6134,8 +6080,8 @@ void Spell::DelayedChannel()
for (std::list<TargetInfo>::const_iterator ihit = m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if ((*ihit).missCondition == SPELL_MISS_NONE)
if (Unit* unit = m_caster->GetGUID() == ihit->targetGUID ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
unit->DelayAura(m_spellInfo->Id, m_caster->GetGUID(), delaytime);
if (Unit* unit = (m_caster->GetGUID() == ihit->targetGUID) ? m_caster : ObjectAccessor::GetUnit(*m_caster, ihit->targetGUID))
unit->DelayOwnedAuras(m_spellInfo->Id, m_originalCasterGUID, delaytime);
// partially interrupt persistent area auras
if(DynamicObject* dynObj = m_caster->GetDynObject(m_spellInfo->Id))
@@ -6509,10 +6455,10 @@ void Spell::CalculateDamageDoneForAllTargets()
}
bool usesAmmo = true;
Unit::AuraEffectList const& Auras = m_caster->GetAurasByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
Unit::AuraEffectList const& Auras = m_caster->GetAuraEffectsByType(SPELL_AURA_ABILITY_CONSUME_NO_AMMO);
for (Unit::AuraEffectList::const_iterator j = Auras.begin(); j != Auras.end(); ++j)
{
if((*j)->isAffectedOnSpell(m_spellInfo))
if((*j)->IsAffectedOnSpell(m_spellInfo))
usesAmmo=false;
}
+6 -8
View File
@@ -363,6 +363,7 @@ class Spell
void EffectPlayMusic(uint32 i);
void EffectSpecCount(uint32 i);
void EffectActivateSpec(uint32 i);
void EffectPlayerNotification(uint32 i);
void EffectCastButtons(uint32 i);
void EffectRechargeManaGem(uint32 i);
@@ -371,7 +372,7 @@ class Spell
Spell( Unit* Caster, SpellEntry const *info, bool triggered, uint64 originalCasterGUID = 0, Spell** triggeringContainer = NULL, bool skipCheck = false );
~Spell();
void prepare(SpellCastTargets const* targets, AuraEffect* triggeredByAura = NULL);
void prepare(SpellCastTargets const* targets, AuraEffect const * triggeredByAura = NULL);
void cancel();
void update(uint32 difftime);
void cast(bool skipCheck = false);
@@ -440,8 +441,7 @@ class Spell
void HandleEffects(Unit *pUnitTarget,Item *pItemTarget,GameObject *pGOTarget,uint32 i);
void HandleThreatSpells(uint32 spellId);
//void HandleAddAura(Unit* Target);
const SpellEntry * const m_spellInfo;
int32 m_currentBasePoints[3]; // cache SpellEntry::EffectBasePoints and use for set custom base points
Item* m_CastItem;
@@ -492,7 +492,6 @@ class Spell
void CleanupTargetList();
void SetSpellValue(SpellValueMod mod, int32 value);
//void SetSpellValue(SpellValueMod mod, float value);
protected:
void SendLoot(uint64 guid, LootType loottype);
@@ -545,8 +544,8 @@ class Spell
Item* itemTarget;
GameObject* gameObjTarget;
int32 damage;
Aura * m_spellAura; // only used in DoAllEffectOnTarget
DynamicObject *m_spellDynObj; // only used in DoAllEffectOnTarget
// used in effects handlers
Aura * m_spellAura;
// this is set in Spell Hit, but used in Apply Aura handler
DiminishingLevels m_diminishLevel;
@@ -566,8 +565,7 @@ class Spell
uint32 m_procAttacker; // Attacker trigger flags
uint32 m_procVictim; // Victim trigger flags
uint32 m_procEx;
bool m_canTrigger;
void prepareDataForTriggerSystem(AuraEffect * triggeredByAura);
void prepareDataForTriggerSystem(AuraEffect const * triggeredByAura);
//*****************************************
// Spell target subsystem
+4 -9
View File
@@ -21,7 +21,6 @@
#define TRINITY_SPELLAURADEFINES_H
#define MAX_AURAS 64 // client support up to 255, but it will cause problems with group auras updating
#define FRIENDLY_AA_REMOVE_TIME 2*IN_MILISECONDS
enum AURA_FLAGS
{
@@ -349,19 +348,15 @@ enum AuraType
SPELL_AURA_301 = 301,
SPELL_AURA_302 = 302,
SPELL_AURA_303 = 303,
SPELL_AURA_MOD_INEBRIATION = 304,
SPELL_AURA_304 = 304,
SPELL_AURA_MOD_MINIMUM_SPEED = 305,
SPELL_AURA_306 = 306,
TOTAL_AURAS = 307
};
enum AreaAuraType
enum AuraObjectType
{
AREA_AURA_PARTY,
AREA_AURA_RAID,
AREA_AURA_FRIEND,
AREA_AURA_ENEMY,
AREA_AURA_PET,
AREA_AURA_OWNER
UNIT_AURA_TYPE,
DYNOBJ_AURA_TYPE,
};
#endif
File diff suppressed because it is too large Load Diff
+263
View File
@@ -0,0 +1,263 @@
#ifndef TRINITY_SPELLAURAEFFECTS_H
#define TRINITY_SPELLAURAEFFECTS_H
class Unit;
class DynamicObject;
class AuraEffect;
class Aura;
#include "SpellAuras.h"
#define AURA_EFFECT_HANDLE_DEFAULT 0
#define AURA_EFFECT_HANDLE_REAL 0x01
#define AURA_EFFECT_HANDLE_SEND_FOR_CLIENT 0x02
#define AURA_EFFECT_HANDLE_CHANGE_AMOUNT 0x04
#define AURA_EFFECT_HANDLE_STAT 0x08
#define AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK (AURA_EFFECT_HANDLE_SEND_FOR_CLIENT | AURA_EFFECT_HANDLE_REAL)
#define AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK (AURA_EFFECT_HANDLE_CHANGE_AMOUNT | AURA_EFFECT_HANDLE_REAL)
#define AURA_EFFECT_HANDLE_CHANGE_AMOUNT_SEND_FOR_CLIENT_MASK (AURA_EFFECT_HANDLE_CHANGE_AMOUNT_MASK | AURA_EFFECT_HANDLE_SEND_FOR_CLIENT_MASK)
typedef void(AuraEffect::*pAuraEffectHandler)(AuraApplication const * aurApp, uint8 mode, bool apply) const;
class TRINITY_DLL_SPEC AuraEffect
{
friend Aura::Aura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID);
friend Aura::~Aura();
private:
~AuraEffect();
explicit AuraEffect(Aura * base, uint8 effIndex, int32 *baseAmount, Unit * caster);
public:
Unit * GetCaster() const { return GetBase()->GetCaster(); }
uint64 GetCasterGUID() const { return GetBase()->GetCasterGUID(); }
Aura * GetBase() const { return m_base; }
void GetTargetList(std::list<Unit*> & targetList) const;
SpellEntry const * GetSpellProto() const { return m_spellProto; }
uint32 GetId() const { return m_spellProto->Id; }
uint32 GetEffIndex() const { return m_effIndex; }
int32 GetBaseAmount() const { return m_baseAmount; }
int32 GetAmplitude() const { return m_amplitude; }
int32 GetMiscValueB() const { return m_spellProto->EffectMiscValueB[m_effIndex]; }
int32 GetMiscValue() const { return m_spellProto->EffectMiscValue[m_effIndex]; }
AuraType GetAuraType() const { return (AuraType)m_spellProto->EffectApplyAuraName[m_effIndex]; }
int32 GetAmount() const { return m_amount; }
void SetAmount(int32 amount) { m_amount = amount; m_canBeRecalculated = false;}
int32 CalculateAmount(Unit * caster);
void CalculatePeriodic(Unit * caster, bool create = false);
void CalculateSpellMod();
void ChangeAmount(int32 newAmount, bool mark = true);
void RecalculateAmount() { if(!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(GetCaster()), false); }
void RecalculateAmount(Unit * caster) { if(!CanBeRecalculated()) return; ChangeAmount(CalculateAmount(caster), false); }
bool CanBeRecalculated() const { return m_canBeRecalculated; }
void SetCanBeRecalculated(bool val) { m_canBeRecalculated = val; }
void HandleEffect(AuraApplication const * aurApp, uint8 mode, bool apply);
void HandleEffect(Unit * target, uint8 mode, bool apply);
void ApplySpellMod(Unit * target, bool apply);
void Update(uint32 diff, Unit * caster);
void UpdatePeriodic(Unit * caster);
uint32 GetTickNumber() const { return m_tickNumber; }
int32 GetTotalTicks() const { return m_amplitude ? (GetBase()->GetMaxDuration() / m_amplitude) : 1;}
void ResetPeriodic() {m_periodicTimer = m_amplitude; m_tickNumber = 0;}
bool IsPeriodic() const { return m_isPeriodic; }
bool IsAffectedOnSpell(SpellEntry const *spell) const;
void PeriodicTick(Unit * target, Unit * caster) const;
void PeriodicDummyTick(Unit * target, Unit * caster) const;
Unit* GetTriggerTarget(Unit * target) const;
void TriggerSpell(Unit * target, Unit * caster) const;
void TriggerSpellWithValue(Unit * target, Unit * caster) const;
void CleanupTriggeredSpells(Unit * target);
static bool IsPeriodicAuraType(uint32 type);
// add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras
void HandleShapeshiftBoosts(Unit * target, bool apply) const;
private:
Aura * const m_base;
SpellEntry const * const m_spellProto;
uint8 const m_effIndex;
int32 const m_baseAmount;
int32 m_amount;
bool m_canBeRecalculated:1;
SpellModifier *m_spellmod;
bool m_isPeriodic:1;
int32 m_periodicTimer;
int32 m_amplitude;
uint32 m_tickNumber;
private:
bool IsPeriodicTickCrit(Unit * target, Unit const * caster) const;
public:
// aura effect handlers
void HandleNULL(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
// not implemented
}
void HandleUnused(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
// useless
}
void HandleNoImmediateEffect(AuraApplication const * aurApp, uint8 mode, bool apply) const
{
// aura type not have immediate effect at add/remove and handled by ID in other code place
}
// visibility & phases
void HandleInvisibilityDetect(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleInvisibility(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModStealth(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleSpiritOfRedemption(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraGhost(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandlePhase(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// unit model
void HandleAuraModShapeshift(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraTransform(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModScale(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraCloneCaster(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// fight
void HandleFeignDeath(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModUnattackable(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModDisarm(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModSilence(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModPacify(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModPacifyAndSilence(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraAllowOnlyAbility(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// tracking
void HandleAuraTrackResources(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraTrackCreatures(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraTrackStealthed(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModStalked(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraUntrackable(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// skills & talents
void HandleAuraModPetTalentsPoints(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModSkill(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// movement
void HandleAuraMounted(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraAllowFlight(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraWaterWalk(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraFeatherFall(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraHover(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleWaterBreathing(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleForceMoveForward(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// threat
void HandleModThreat(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModTotalThreat(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModTaunt(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// control
void HandleModConfuse(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModFear(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModStun(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModRoot(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandlePreventFleeing(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// charm
void HandleModPossess(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModPossessPet(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModCharm(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleCharmConvert(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraControlVehicle(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// modify speed
void HandleAuraModIncreaseSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModIncreaseMountedSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModIncreaseFlightSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModIncreaseSwimSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModDecreaseSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModUseNormalSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// immunity
void HandleModStateImmunityMask(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModMechanicImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModEffectImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModStateImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModSchoolImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModDmgImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModDispelImmunity(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// modify stats
// resistance
void HandleAuraModResistanceExclusive(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModResistance(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModBaseResistancePCT(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModResistancePercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModBaseResistance(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModTargetResistance(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// stat
void HandleAuraModStat(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModPercentStat(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModSpellDamagePercentFromStat(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModSpellHealingPercentFromStat(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModSpellDamagePercentFromAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModSpellHealingPercentFromAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModHealingDone(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModTotalPercentStat(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModResistenceOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModExpertise(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// heal and energize
void HandleModPowerRegen(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModPowerRegenPCT(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModManaRegen(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModIncreaseHealth(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModIncreaseMaxHealth(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModIncreaseEnergy(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModIncreaseEnergyPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModIncreaseHealthPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraIncreaseBaseHealthPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// fight
void HandleAuraModParryPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModDodgePercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModBlockPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModRegenInterrupt(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModWeaponCritPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModHitChance(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModSpellHitChance(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModSpellCritChance(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModSpellCritChanceShool(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModCritPct(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// attack speed
void HandleModCastingSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModMeleeRangedSpeedPct(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModCombatSpeedPct(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModAttackSpeed(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModRangedHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleRangedAmmoHaste(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// combat rating
void HandleModRating(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModRatingFromStat(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// attack power
void HandleAuraModAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModRangedAttackPower(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModAttackPowerPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModRangedAttackPowerPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModRangedAttackPowerOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModAttackPowerOfStatPercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraModAttackPowerOfArmor(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// damage bonus
void HandleModDamageDone(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModDamagePercentDone(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModOffhandDamagePercent(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleShieldBlockValue(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// power cost
void HandleModPowerCostPCT(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleModPowerCost(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleArenaPreparation(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleNoReagentUseAura(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraRetainComboPoints(AuraApplication const * aurApp, uint8 mode, bool apply) const;
// others
void HandleAuraDummy(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleChannelDeathItem(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleBindSight(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleForceReaction(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraEmpathy(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleComprehendLanguage(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraConvertRune(AuraApplication const * aurApp, uint8 mode, bool apply) const;
void HandleAuraLinked(AuraApplication const * aurApp, uint8 mode, bool apply) const;
};
#endif
+1232 -7056
View File
File diff suppressed because it is too large Load Diff
+150 -362
View File
@@ -17,419 +17,207 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#ifndef TRINITY_SPELLAURAS_H
#define TRINITY_SPELLAURAS_H
#include "SpellAuraDefines.h"
class Unit;
class Unit;
struct SpellEntry;
struct SpellModifier;
struct ProcTriggerSpell;
// forward decl
class Aura;
class AuraEffect;
class Aura;
class DynamicObject;
typedef void(AuraEffect::*pAuraHandler)(bool Apply, bool Real, bool changeAmount);
// Real == true at aura add/remove
// Real == false at aura mod unapply/reapply; when adding/removing dependent aura/item/stat mods
//
// Code in aura handler can be guarded by if(Real) check if it should execution only at real add/remove of aura
//
// MAIN RULE: Code MUST NOT be guarded by if(Real) check if it modifies any stats
// (percent auras, stats mods, etc)
// Second rule: Code must be guarded by if(Real) check if it modifies object state (start/stop attack, send packets to client, etc)
//
// Other case choice: each code line moved under if(Real) check is Trinity speedup,
// each setting object update field code line moved under if(Real) check is significant Trinity speedup, and less server->client data sends
// each packet sending code moved under if(Real) check is _large_ Trinity speedup, and lot less server->client data sends
//
// changeAmount == true at changing existing aura amount - called wit real == false
// if aura has amount dependant effect handler has to allow proceeding it
// example: change speed aura, modifier aura
class AuraApplication
{
friend AuraApplication * Unit::__ApplyAura(Aura * aura);
friend void Unit::__UnapplyAura(AuraApplicationMap::iterator &i);
friend bool Unit::_ApplyAuraEffect(Aura * aura, uint8 effIndex);
private:
Unit * const m_target;
Aura * const m_base;
uint8 m_slot; // Aura slot on unit
uint8 m_flags; // Aura info flag
AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason
bool m_needClientUpdate:1;
bool m_isNeedManyNegativeEffects:1;
bool m_canBeRemoved:1; // used only in aura list update of AuraBase
explicit AuraApplication(Unit * target, Unit * caster, Aura * base);
void _Remove();
private:
bool _CheckPositive(Unit * caster) const;
void _HandleEffect(uint8 effIndex, bool apply);
public:
bool _CanBeRemoved() const {return m_canBeRemoved;}
void _SetCanBeRemoved(bool val) {m_canBeRemoved = val;}
Unit * GetTarget() const { return m_target; }
Aura * GetBase() const { return m_base; }
uint8 GetSlot() const { return m_slot; }
uint8 GetFlags() const { return m_flags; }
uint8 GetEffectMask() const { return m_flags & (AFLAG_EFF_INDEX_0 | AFLAG_EFF_INDEX_1 | AFLAG_EFF_INDEX_2); }
bool HasEffect(uint8 effect) const { assert(effect < MAX_SPELL_EFFECTS); return m_flags & (1<<effect); }
bool IsPositive() const { return m_flags & AFLAG_POSITIVE; }
void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; }
AuraRemoveMode GetRemoveMode() const {return m_removeMode;}
void SetNeedClientUpdate() { m_needClientUpdate = true;}
bool IsNeedClientUpdate() const { return m_needClientUpdate;}
void ClientUpdate(bool remove = false);
};
class TRINITY_DLL_SPEC Aura
{
friend void Player::SendAurasForTarget(Unit *target);
public:
virtual ~Aura();
explicit Aura(SpellEntry const* spellproto, uint32 effMask, Unit *target, WorldObject *source, Unit *caster, int32 *currentBasePoints = NULL, Item *castItem = NULL);
typedef UNORDERED_MAP<uint64, AuraApplication *> ApplicationMap;
static Aura * TryCreate(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount = NULL, Item * castItem = NULL, uint64 casterGUID = 0);
static Aura * TryCreate(SpellEntry const* spellproto, WorldObject * owner, Unit * caster, int32 *baseAmount = NULL, Item * castItem = NULL, uint64 casterGUID = 0);
static Aura * Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount = NULL, Item * castItem = NULL, uint64 casterGUID = 0);
explicit Aura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID);
~Aura();
SpellEntry const* GetSpellProto() const { return m_spellProto; }
uint32 GetId() const{ return m_spellProto->Id; }
uint64 GetCastItemGUID() const { return m_castItemGuid; }
uint32 GetId() const{ return GetSpellProto()->Id; }
uint64 GetCastItemGUID() const { return m_castItemGuid; }
uint64 const& GetCasterGUID() const { return m_casterGuid; }
Unit* GetCaster() const;
uint64 const& GetSourceGUID() const { return m_sourceGuid; }
Unit *GetUnitSource() const;
Unit* GetTarget() const { return m_target; }
time_t GetAuraApplyTime() const { return m_applyTime; }
WorldObject * GetOwner() const { return m_owner; }
Unit * GetUnitOwner() const { assert(GetType() == UNIT_AURA_TYPE); return (Unit*)m_owner; }
DynamicObject * GetDynobjOwner() const { assert(GetType() == DYNOBJ_AURA_TYPE); return (DynamicObject*)m_owner; }
int32 GetAuraMaxDuration() const { return m_maxduration; }
void SetAuraMaxDuration(int32 duration) { m_maxduration = duration; }
int32 GetAuraDuration() const { return m_duration; }
void SetAuraDuration(int32 duration, bool withMods = false);
void RefreshAura() { SetAuraDuration(m_maxduration);}
bool IsExpired() const { return !GetAuraDuration() && !(IsPermanent() || IsPassive()); }
AuraObjectType GetType() const;
void SendAuraUpdate();
uint8 GetAuraSlot() const { return m_auraSlot; }
void SetAuraSlot(uint8 slot) { m_auraSlot = slot; }
uint8 GetAuraCharges() const { return m_procCharges; }
void SetAuraCharges(uint8 charges);
bool DropAuraCharge();
void SetProcDamage(uint32 val) { m_procDamage = val; }
uint32 GetProcDamage() const { return m_procDamage; }
virtual void _ApplyForTarget(Unit * target, Unit * caster, AuraApplication * auraApp);
virtual void _UnapplyForTarget(Unit * target, Unit * caster, AuraApplication * auraApp);
void _Remove(AuraRemoveMode removeMode);
virtual void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT) = 0;
virtual void UpdateTargetMapForEffect(Unit * caster, uint8 effIndex) = 0;
void UpdateTargetMap(Unit * caster);
void ApplyForTargets() {Unit * caster = GetCaster(); UpdateTargetMap(caster);}
void ApplyEffectForTargets(uint8 effIndex) {Unit * caster = GetCaster(); UpdateTargetMapForEffect(caster, effIndex);}
void UpdateOwner(uint32 diff, WorldObject * owner);
void Update(uint32 diff, Unit * caster);
time_t GetApplyTime() const { return m_applyTime; }
int32 GetMaxDuration() const { return m_maxDuration; }
void SetMaxDuration(int32 duration) { m_maxDuration = duration; }
int32 GetDuration() const { return m_duration; }
void SetDuration(int32 duration, bool withMods = false);
void RefreshDuration();
bool IsExpired() const { return !GetDuration();}
bool IsPermanent() const { return GetMaxDuration() == -1; }
uint8 GetCharges() const { return m_procCharges; }
void SetCharges(uint8 charges);
bool DropCharge();
uint8 GetStackAmount() const { return m_stackAmount; }
void SetStackAmount(uint8 num, bool applied = true);
bool modStackAmount(int32 num); // return true if last charge dropped
bool ModStackAmount(int32 num); // return true if last charge dropped
void SetRemoveMode(AuraRemoveMode mode) { m_removeMode = mode; }
uint8 GetRemoveMode() const {return m_removeMode;}
uint8 GetCasterLevel() const { return m_casterLevel; }
inline uint8 GetEffectMask() const {return m_auraFlags & 7;}
AuraEffect * GetPartAura (uint8 effIndex) const {assert (effIndex < MAX_SPELL_EFFECTS); return m_partAuras[effIndex];}
bool SetPartAura(AuraEffect* aurEff, uint8 effIndex);
bool IsPositive() const { return m_positive; }
void SetNegative() { m_positive = false; }
void SetPositive() { m_positive = true; }
bool IsPermanent() const { return m_permanent; }
void SetPermanent(bool val) { m_permanent = val; }
bool IsPassive() const { return m_isPassive; }
bool IsDeathPersistent() const { return m_isDeathPersist; }
bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
bool IsPassive() const;
bool IsDeathPersistent() const;
bool IsRemovedOnShapeLost(Unit * target) const { return (GetCasterGUID() == target->GetGUID() && m_spellProto->Stances && !(m_spellProto->AttributesEx2 & SPELL_ATTR_EX2_NOT_NEED_SHAPESHIFT) && !(m_spellProto->Attributes & SPELL_ATTR_NOT_SHAPESHIFT)); }
bool CanBeSaved() const;
bool IsRemoved() const { return m_isRemoved; }
bool IsPersistent() const;
bool IsAreaAura() const;
bool IsAuraType(AuraType type) const;
void SetLoadedState(uint64 caster_guid,int32 maxduration,int32 duration,int32 charges, uint8 stackamount, int32 * amount);
bool HasEffect(uint8 effIndex) const {return bool (m_partAuras[effIndex]);}
inline void HandleEffects(bool apply)
{
for (uint8 i = 0; i<MAX_SPELL_EFFECTS; ++i)
if (m_partAuras[i])
m_target->HandleAuraEffect(m_partAuras[i], apply);
}
void ApplyAllModifiers(bool apply, bool Real=false);
void HandleAuraSpecificMods(bool apply);
void Update(uint32 diff);
void _AddAura();
void _RemoveAura();
// Allow Apply Aura Handler to modify and access m_AuraDRGroup
void setDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; }
DiminishingGroup getDiminishGroup() const { return m_AuraDRGroup; }
bool IsVisible() const;
// Single cast aura helpers
void UnregisterSingleCastAura();
bool IsSingleTarget() const {return m_isSingleTargetAura;}
void SetIsSingleTarget(bool val) { m_isSingleTargetAura = val;}
bool IsSingleTarget() const {return m_isSingleTarget;}
void SetIsSingleTarget(bool val) { m_isSingleTarget = val;}
void SetLoadedState(int32 maxduration, int32 duration, int32 charges, uint8 stackamount, uint8 recalculateMask, int32 * amount);
// helpers for aura effects
bool HasEffect(uint8 effIndex) const { return bool(GetEffect(effIndex)); }
bool HasEffectType(AuraType type) const;
AuraEffect * GetEffect (uint8 effIndex) const { assert (effIndex < MAX_SPELL_EFFECTS); return m_effects[effIndex]; }
uint8 GetEffectMask() const { uint8 effMask = 0; for(uint8 i = 0; i < MAX_SPELL_EFFECTS; ++i) if (m_effects[i]) effMask |= 1<<i; return effMask; }
void RecalculateAmountOfEffects();
void HandleAllEffects(AuraApplication const * aurApp, uint8 mode, bool apply);
// Helpers for targets
ApplicationMap const & GetApplicationMap() {return m_applications;}
const AuraApplication * GetApplicationOfTarget (uint64 const & guid) const { ApplicationMap::const_iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
AuraApplication * GetApplicationOfTarget (uint64 const & guid) { ApplicationMap::iterator itr = m_applications.find(guid); if (itr != m_applications.end()) return itr->second; return NULL; }
bool IsAppliedOnTarget (uint64 const & guid) const { return m_applications.find(guid) != m_applications.end(); }
bool IsPositive(Unit * const target) const { return (GetApplicationOfTarget(target->GetGUID()))->IsPositive(); }
bool GetEffectMask(Unit * const target) const { return (GetApplicationOfTarget(target->GetGUID()))->GetEffectMask(); }
uint8 GetSlot(Unit * const target) const { return (GetApplicationOfTarget(target->GetGUID()))->GetSlot(); }
bool HasEffect(Unit * const target, uint8 eff) const { return (GetApplicationOfTarget(target->GetGUID()))->HasEffect(eff); }
void SetNeedClientUpdateForTargets() const;
void HandleAuraSpecificMods(AuraApplication const * aurApp, Unit * caster, bool apply);
private:
const SpellEntry * const m_spellProto;
Unit * const m_target;
//WorldObject * const m_source;
const uint64 m_sourceGuid;
const uint64 m_casterGuid;
const uint64 m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
const time_t m_applyTime;
void _DeleteRemovedApplications();
protected:
SpellEntry const * const m_spellProto;
uint64 const m_casterGuid;
uint64 const m_castItemGuid; // it is NOT safe to keep a pointer to the item because it may get deleted
time_t const m_applyTime;
WorldObject * const m_owner; //
int32 m_maxduration; // Max aura duration
int32 m_maxDuration; // Max aura duration
int32 m_duration; // Current time
int32 m_timeCla; // Timer for power per sec calcultion
AuraRemoveMode m_removeMode:8; // Store info for know remove aura reason
DiminishingGroup m_AuraDRGroup:8; // Diminishing
uint8 m_auraSlot; // Aura slot on unit (for show in client)
uint8 m_auraFlags; // Aura info flag (for send data to client)
uint8 m_auraLevel; // Aura level (store caster level for correct show level dep amount)
uint8 const m_casterLevel; // Aura level (store caster level for correct show level dep amount)
uint8 m_procCharges; // Aura charges (0 for infinite)
uint8 m_stackAmount; // Aura stack amount
AuraEffect * m_partAuras[3];
uint32 m_procDamage; // used in aura proc code
AuraEffect * m_effects[3];
ApplicationMap m_applications;
bool m_isDeathPersist:1;
bool m_isRemovedOnShapeLost:1;
bool m_isPassive:1;
bool m_positive:1;
bool m_permanent:1;
bool m_isRemoved:1;
bool m_isSingleTargetAura:1; // true if it's a single target spell and registered at caster - can change at spell steal for example
bool m_isSingleTarget:1; // true if it's a single target spell and registered at caster - can change at spell steal for example
bool IsVisible() const;
};
class TRINITY_DLL_SPEC AuraEffect
{
public:
friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints);
friend void Aura::SetStackAmount(uint8 stackAmount, bool applied);
//aura handlers
void HandleNULL(bool, bool, bool)
{
// NOT IMPLEMENTED
}
void HandleUnused(bool, bool, bool)
{
// NOT USED BY ANY SPELL OR USELESS
}
void HandleNoImmediateEffect(bool, bool, bool)
{
// aura not have immediate effect at add/remove and handled by ID in other code place
}
void HandleBindSight(bool Apply, bool Real, bool changeAmount);
void HandleModPossess(bool Apply, bool Real, bool changeAmount);
void HandlePeriodicDamage(bool Apply, bool Real, bool changeAmount);
void HandleAuraDummy(bool Apply, bool Real, bool changeAmount);
void HandleAuraPeriodicDummy(bool apply, bool Real, bool changeAmount);
void HandleModConfuse(bool Apply, bool Real, bool changeAmount);
void HandleModCharm(bool Apply, bool Real, bool changeAmount);
void HandleModFear(bool Apply, bool Real, bool changeAmount);
void HandlePeriodicHeal(bool Apply, bool Real, bool changeAmount);
void HandleModAttackSpeed(bool Apply, bool Real, bool changeAmount);
void HandleModMeleeRangedSpeedPct(bool apply, bool Real, bool changeAmount);
void HandleModCombatSpeedPct(bool apply, bool Real, bool changeAmount);
void HandleModThreat(bool Apply, bool Real, bool changeAmount);
void HandleModTaunt(bool Apply, bool Real, bool changeAmount);
void HandleFeignDeath(bool Apply, bool Real, bool changeAmount);
void HandleAuraModDisarm(bool Apply, bool Real, bool changeAmount);
void HandleAuraModStalked(bool Apply, bool Real, bool changeAmount);
void HandleAuraWaterWalk(bool Apply, bool Real, bool changeAmount);
void HandleAuraFeatherFall(bool Apply, bool Real, bool changeAmount);
void HandleAuraHover(bool Apply, bool Real, bool changeAmount);
void HandleAddModifier(bool Apply, bool Real, bool changeAmount);
void HandleAuraModStun(bool Apply, bool Real, bool changeAmount);
void HandleModDamageDone(bool Apply, bool Real, bool changeAmount);
void HandleAuraUntrackable(bool Apply, bool Real, bool changeAmount);
void HandleAuraEmpathy(bool Apply, bool Real, bool changeAmount);
void HandleModOffhandDamagePercent(bool apply, bool Real, bool changeAmount);
void HandleAuraModRangedAttackPower(bool Apply, bool Real, bool changeAmount);
void HandleAuraModIncreaseEnergyPercent(bool Apply, bool Real, bool changeAmount);
void HandleAuraModIncreaseHealthPercent(bool Apply, bool Real, bool changeAmount);
void HandleAuraModRegenInterrupt(bool Apply, bool Real, bool changeAmount);
void HandleHaste(bool Apply, bool Real, bool changeAmount);
void HandlePeriodicTriggerSpell(bool Apply, bool Real, bool changeAmount);
void HandlePeriodicTriggerSpellWithValue(bool apply, bool Real, bool changeAmount);
void HandlePeriodicEnergize(bool Apply, bool Real, bool changeAmount);
void HandleAuraModResistanceExclusive(bool Apply, bool Real, bool changeAmount);
void HandleAuraModPetTalentsPoints(bool Apply, bool Real, bool changeAmount);
void HandleModStealth(bool Apply, bool Real, bool changeAmount);
void HandleInvisibility(bool Apply, bool Real, bool changeAmount);
void HandleInvisibilityDetect(bool Apply, bool Real, bool changeAmount);
void HandleAuraModTotalHealthPercentRegen(bool Apply, bool Real, bool changeAmount);
void HandleAuraModTotalEnergyPercentRegen(bool Apply, bool Real, bool changeAmount);
void HandleAuraModResistance(bool Apply, bool Real, bool changeAmount);
void HandleAuraModRoot(bool Apply, bool Real, bool changeAmount);
void HandleAuraModSilence(bool Apply, bool Real, bool changeAmount);
void HandleAuraModStat(bool Apply, bool Real, bool changeAmount);
void HandleAuraModIncreaseSpeed(bool Apply, bool Real, bool changeAmount);
void HandleAuraModIncreaseMountedSpeed(bool Apply, bool Real, bool changeAmount);
void HandleAuraModIncreaseFlightSpeed(bool Apply, bool Real, bool changeAmount);
void HandleAuraModDecreaseSpeed(bool Apply, bool Real, bool changeAmount);
void HandleAuraModUseNormalSpeed(bool Apply, bool Real, bool changeAmount);
void HandleAuraModIncreaseHealth(bool Apply, bool Real, bool changeAmount);
void HandleAuraModIncreaseEnergy(bool Apply, bool Real, bool changeAmount);
void HandleAuraModShapeshift(bool Apply, bool Real, bool changeAmount);
void HandleAuraModEffectImmunity(bool Apply, bool Real, bool changeAmount);
void HandleAuraModStateImmunity(bool Apply, bool Real, bool changeAmount);
void HandleAuraModSchoolImmunity(bool Apply, bool Real, bool changeAmount);
void HandleAuraModDmgImmunity(bool Apply, bool Real, bool changeAmount);
void HandleAuraModDispelImmunity(bool Apply, bool Real, bool changeAmount);
void HandleAuraProcTriggerSpell(bool Apply, bool Real, bool changeAmount);
void HandleAuraTrackCreatures(bool Apply, bool Real, bool changeAmount);
void HandleAuraTrackResources(bool Apply, bool Real, bool changeAmount);
void HandleAuraModParryPercent(bool Apply, bool Real, bool changeAmount);
void HandleAuraModDodgePercent(bool Apply, bool Real, bool changeAmount);
void HandleAuraModBlockPercent(bool Apply, bool Real, bool changeAmount);
void HandleAuraModWeaponCritPercent(bool Apply, bool Real, bool changeAmount);
void HandlePeriodicLeech(bool Apply, bool Real, bool changeAmount);
void HandleModHitChance(bool Apply, bool Real, bool changeAmount);
void HandleModSpellHitChance(bool Apply, bool Real, bool changeAmount);
void HandleAuraModScale(bool Apply, bool Real, bool changeAmount);
void HandlePeriodicManaLeech(bool Apply, bool Real, bool changeAmount);
void HandlePeriodicHealthFunnel(bool apply, bool Real, bool changeAmount);
void HandleModCastingSpeed(bool Apply, bool Real, bool changeAmount);
void HandleAuraMounted(bool Apply, bool Real, bool changeAmount);
void HandleWaterBreathing(bool Apply, bool Real, bool changeAmount);
void HandleModBaseResistance(bool Apply, bool Real, bool changeAmount);
void HandleModRegen(bool Apply, bool Real, bool changeAmount);
void HandleModPowerRegen(bool Apply, bool Real, bool changeAmount);
void HandleModPowerRegenPCT(bool Apply, bool Real, bool changeAmount);
void HandleChannelDeathItem(bool Apply, bool Real, bool changeAmount);
void HandlePeriodicDamagePCT(bool Apply, bool Real, bool changeAmount);
void HandleAuraModAttackPower(bool Apply, bool Real, bool changeAmount);
void HandleAuraTransform(bool Apply, bool Real, bool changeAmount);
void HandleModSpellCritChance(bool Apply, bool Real, bool changeAmount);
void HandleAuraModIncreaseSwimSpeed(bool Apply, bool Real, bool changeAmount);
void HandleModPowerCostPCT(bool Apply, bool Real, bool changeAmount);
void HandleModPowerCost(bool Apply, bool Real, bool changeAmount);
void HandleFarSight(bool Apply, bool Real, bool changeAmount);
void HandleModPossessPet(bool Apply, bool Real, bool changeAmount);
void HandleModMechanicImmunity(bool Apply, bool Real, bool changeAmount);
void HandleModStateImmunityMask(bool apply, bool Real, bool changeAmount);
void HandleAuraModSkill(bool Apply, bool Real, bool changeAmount);
void HandleModDamagePercentDone(bool Apply, bool Real, bool changeAmount);
void HandleModPercentStat(bool Apply, bool Real, bool changeAmount);
void HandleModResistancePercent(bool Apply, bool Real, bool changeAmount);
void HandleAuraModBaseResistancePCT(bool Apply, bool Real, bool changeAmount);
void HandleModShieldBlockPCT(bool Apply, bool Real, bool changeAmount);
void HandleAuraTrackStealthed(bool Apply, bool Real, bool changeAmount);
void HandleModShieldBlock(bool Apply, bool Real, bool changeAmount);
void HandleForceReaction(bool Apply, bool Real, bool changeAmount);
void HandleAuraModRangedHaste(bool Apply, bool Real, bool changeAmount);
void HandleRangedAmmoHaste(bool Apply, bool Real, bool changeAmount);
void HandleModHealingDone(bool Apply, bool Real, bool changeAmount);
void HandleModTotalPercentStat(bool Apply, bool Real, bool changeAmount);
void HandleAuraModTotalThreat(bool Apply, bool Real, bool changeAmount);
void HandleModUnattackable(bool Apply, bool Real, bool changeAmount);
void HandleAuraModPacify(bool Apply, bool Real, bool changeAmount);
void HandleAuraGhost(bool Apply, bool Real, bool changeAmount);
void HandleAuraAllowFlight(bool Apply, bool Real, bool changeAmount);
void HandleModRating(bool apply, bool Real, bool changeAmount);
void HandleModRatingFromStat(bool apply, bool Real, bool changeAmount);
void HandleModTargetResistance(bool apply, bool Real, bool changeAmount);
void HandleAuraModAttackPowerPercent(bool apply, bool Real, bool changeAmount);
void HandleAuraModRangedAttackPowerPercent(bool apply, bool Real, bool changeAmount);
void HandleAuraModRangedAttackPowerOfStatPercent(bool apply, bool Real, bool changeAmount);
void HandleAuraModAttackPowerOfArmor(bool apply, bool Real, bool changeAmount);
void HandleAuraModAttackPowerOfStatPercent(bool apply, bool Real, bool changeAmount);
void HandleSpiritOfRedemption(bool apply, bool Real, bool changeAmount);
void HandleModManaRegen(bool apply, bool Real, bool changeAmount);
void HandleComprehendLanguage(bool apply, bool Real, bool changeAmount);
void HandleShieldBlockValue(bool apply, bool Real, bool changeAmount);
void HandleModSpellCritChanceShool(bool apply, bool Real, bool changeAmount);
void HandleAuraRetainComboPoints(bool apply, bool Real, bool changeAmount);
void HandleModSpellDamagePercentFromStat(bool apply, bool Real, bool changeAmount);
void HandleModSpellHealingPercentFromStat(bool apply, bool Real, bool changeAmount);
void HandleAuraControlVehicle(bool apply, bool Real, bool changeAmount);
void HandleModSpellDamagePercentFromAttackPower(bool apply, bool Real, bool changeAmount);
void HandleModSpellHealingPercentFromAttackPower(bool apply, bool Real, bool changeAmount);
void HandleAuraModPacifyAndSilence(bool Apply, bool Real, bool changeAmount);
void HandleAuraModIncreaseMaxHealth(bool apply, bool Real, bool changeAmount);
void HandleAuraModExpertise(bool apply, bool Real, bool changeAmount);
void HandleForceMoveForward(bool apply, bool Real, bool changeAmount);
void HandleAuraModResistenceOfStatPercent(bool apply, bool Real, bool changeAmount);
void HandleAuraPowerBurn(bool apply, bool Real, bool changeAmount);
void HandlePreventFleeing(bool apply, bool Real, bool changeAmount);
void HandleArenaPreparation(bool apply, bool Real, bool changeAmount);
void HandleAuraConvertRune(bool apply, bool Real, bool changeAmount);
void HandleAuraIncreaseBaseHealthPercent(bool Apply, bool Real, bool changeAmount);
void HandleNoReagentUseAura(bool Apply, bool Real, bool changeAmount);
void HandlePhase(bool Apply, bool Real, bool changeAmount);
void HandleAuraAllowOnlyAbility(bool apply, bool Real, bool changeAmount);
void HandleCharmConvert(bool apply, bool Real, bool changeAmount);
void HandleAuraInitializeImages(bool Apply, bool Real, bool changeAmount);
void HandleAuraCloneCaster(bool Apply, bool Real, bool changeAmount);
void HandleAuraModCritPct(bool Apply, bool Real, bool changeAmount);
void HandleAuraLinked(bool Apply, bool Real, bool changeAmount);
void HandleAuraModInebriation(bool apply, bool Real, bool changeAmount);
void HandleAuraEffectSpecificMods(bool apply, bool Real, bool changeAmount);
int32 CalculateCrowdControlAuraAmount(Unit * caster);
// add/remove SPELL_AURA_MOD_SHAPESHIFT (36) linked auras
void HandleShapeshiftBoosts(bool apply);
Unit * GetCaster() const { return m_parentAura->GetCaster(); }
uint64 GetCasterGUID() const{ return m_parentAura->GetCasterGUID(); }
Aura * GetParentAura() const { return m_parentAura; }
SpellEntry const* GetSpellProto() const { return m_spellProto; }
uint32 GetId() const { return m_spellProto->Id; }
uint32 GetEffIndex() const { return m_effIndex; }
int32 GetBasePoints() const { return m_currentBasePoints; }
int32 GetAuraAmplitude(){return m_amplitude;}
void ResetPeriodicTimer(){m_periodicTimer = m_amplitude;}
virtual void Update(uint32 diff);
uint32 GetTickNumber() const { return m_tickNumber; }
int32 GetTotalTicks () const { return m_amplitude ? (GetParentAura()->GetAuraMaxDuration() / m_amplitude) : 1;}
bool IsAreaAura() const { return m_isAreaAura; }
bool IsPeriodic() const { return m_isPeriodic; }
bool IsPersistent() const { return m_isPersistent; }
bool IsApplied() const { return m_isApplied; }
void SetApplied (bool val) {m_isApplied = val; }
bool isAffectedOnSpell(SpellEntry const *spell) const;
void ApplyModifier(bool apply, bool Real = false, bool changeAmount=false);
void RecalculateAmount(bool applied = true);
void HandleAuraEffect(bool apply);
void ApplyAllModifiers(bool apply, bool Real);
Unit* GetTriggerTarget() const;
void TriggerSpell();
void TriggerSpellWithValue();
void PeriodicTick();
void PeriodicDummyTick();
int32 GetMiscBValue() const {return m_spellProto->EffectMiscValueB[m_effIndex];}
int32 GetMiscValue() const {return m_spellProto->EffectMiscValue[m_effIndex];}
uint32 GetAuraName() const {return m_auraName;}
int32 GetAmount() const {return m_amount;}
void SetAmount(int32 amount) { m_amount = amount; }
void CleanupTriggeredSpells();
protected:
explicit AuraEffect(Aura * parentAura, uint8 effIndex, int32 *currentBasePoints = NULL);
Aura * const m_parentAura;
Unit * const m_target;
uint32 m_tickNumber;
const SpellEntry * const m_spellProto;
const uint8 m_effIndex;
const AuraType m_auraName;
int32 m_currentBasePoints;
int32 m_amount;
SpellModifier *m_spellmod;
int32 m_periodicTimer; // Timer for periodic auras
int32 m_amplitude;
bool m_isPeriodic:1;
bool m_isAreaAura:1;
bool m_isPersistent:1;
bool m_isApplied:1;
private:
bool IsPeriodicTickCrit(Unit const * pCaster) const;
Unit::AuraApplicationList m_removedApplications;
};
class TRINITY_DLL_SPEC AreaAuraEffect : public AuraEffect
class TRINITY_DLL_SPEC UnitAura : public Aura
{
public:
friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints);
void Update(uint32 diff);
Unit *GetSource() const { return GetParentAura()->GetUnitSource(); }
friend Aura * Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID);
protected:
explicit AreaAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints = NULL);
float m_radius;
int32 m_removeTime;
AreaAuraType m_areaAuraType;
explicit UnitAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID);
public:
void _ApplyForTarget(Unit * target, Unit * caster, AuraApplication * aurApp);
void _UnapplyForTarget(Unit * target, Unit * caster, AuraApplication * aurApp);
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void UpdateTargetMapForEffect(Unit * caster, uint8 effIndex);
// Allow Apply Aura Handler to modify and access m_AuraDRGroup
void SetDiminishGroup(DiminishingGroup group) { m_AuraDRGroup = group; }
DiminishingGroup GetDiminishGroup() const { return m_AuraDRGroup; }
private:
DiminishingGroup m_AuraDRGroup:8; // Diminishing
};
class TRINITY_DLL_SPEC PersistentAreaAuraEffect : public AuraEffect
class TRINITY_DLL_SPEC DynObjAura : public Aura
{
public:
friend AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints);
void Update(uint32 diff);
DynamicObject *GetSource() const;
friend Aura * Aura::Create(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID);
protected:
explicit PersistentAreaAuraEffect(Aura * parentAura, uint32 eff, int32 *currentBasePoints = NULL);
explicit DynObjAura(SpellEntry const* spellproto, uint8 effMask, WorldObject * owner, Unit * caster, int32 *baseAmount, Item * castItem, uint64 casterGUID);
public:
void Remove(AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void UpdateTargetMapForEffect(Unit * caster, uint8 effIndex);
};
AuraEffect* CreateAuraEffect(Aura * parentAura, uint32 effIndex, int32 *currentBasePoints = NULL);
#endif
+182 -162
View File
@@ -34,6 +34,7 @@
#include "SpellId.h"
#include "DynamicObject.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "Group.h"
#include "UpdateData.h"
#include "MapManager.h"
@@ -196,7 +197,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=
&Spell::EffectApplyAreaAura, //128 SPELL_EFFECT_APPLY_AREA_AURA_FRIEND
&Spell::EffectApplyAreaAura, //129 SPELL_EFFECT_APPLY_AREA_AURA_ENEMY
&Spell::EffectRedirectThreat, //130 SPELL_EFFECT_REDIRECT_THREAT
&Spell::EffectUnused, //131 SPELL_EFFECT_131 used in some test spells
&Spell::EffectPlayerNotification, //131 SPELL_EFFECT_PLAYER_NOTIFICATION
&Spell::EffectPlayMusic, //132 SPELL_EFFECT_PLAY_MUSIC sound id in misc value (SoundEntries.dbc)
&Spell::EffectUnlearnSpecialization, //133 SPELL_EFFECT_UNLEARN_SPECIALIZATION unlearn profession specialization
&Spell::EffectKillCredit, //134 SPELL_EFFECT_KILL_CREDIT misc value is creature entry
@@ -362,14 +363,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
case SPELL_POSITIVE_CHARGE_39090: spellId = SPELL_POSITIVE_CHARGE_39089; break;
case SPELL_NEGATIVE_CHARGE_39093: spellId = SPELL_NEGATIVE_CHARGE_39092; break;
}
Aura *aur = m_caster->GetAura(spellId);
if (!aur)
{
m_caster->CastSpell(m_caster, spellId, true);
aur = m_caster->GetAura(spellId);
}
if (aur)
aur->SetStackAmount(count);
m_caster->SetAuraStack(spellId, m_caster, count);
}
}
@@ -464,7 +458,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
// Check aura state for speed but aura state set not only for Immolate spell
if(unitTarget->HasAuraState(AURA_STATE_CONFLAGRATE))
{
if (unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x4))
if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x4, 0, 0))
damage += damage/4;
}
}
@@ -473,7 +467,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
{
AuraEffect const* aura = NULL; // found req. aura for damage calculation
Unit::AuraEffectList const &mPeriodic = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_DAMAGE);
Unit::AuraEffectList const &mPeriodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_DAMAGE);
for (Unit::AuraEffectList::const_iterator i = mPeriodic.begin(); i != mPeriodic.end(); ++i)
{
// for caster applied auras only
@@ -497,7 +491,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
if (aura)
{
uint32 pdamage = aura->GetAmount() > 0 ? aura->GetAmount() : 0;
pdamage = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellProto(), pdamage, DOT, aura->GetParentAura()->GetStackAmount());
pdamage = m_caster->SpellDamageBonus(unitTarget, aura->GetSpellProto(), pdamage, DOT, aura->GetBase()->GetStackAmount());
damage += pdamage * 4; // 4 ticks of 3 seconds = 12 secs
apply_direct_bonus = false;
// Glyph of Conflagrate
@@ -525,7 +519,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
{
int32 back_damage = m_caster->SpellDamageBonus(unitTarget, m_spellInfo, (uint32)damage, SPELL_DIRECT_DAMAGE);
// Pain and Suffering reduces damage
if (AuraEffect * aurEff = m_caster->GetDummyAura(SPELLFAMILY_PRIEST, 2874, 0))
if (AuraEffect * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST, 2874, 0))
back_damage -= aurEff->GetAmount() * back_damage / 100;
if(back_damage < unitTarget->GetHealth())
@@ -537,7 +531,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
// We are in Shadow Form
if (m_caster->m_form == FORM_SHADOW)
// We have Improved Mind Blast
if (AuraEffect * aurEff = m_caster->GetDummyAura(SPELLFAMILY_PRIEST,95,0))
if (AuraEffect * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_PRIEST,95,0))
// Chance has been successfully rolled
if (roll_chance_i(aurEff->GetAmount()))
m_caster->CastSpell(unitTarget, SPELL_MIND_TRAUMA_48301, true);
@@ -547,13 +541,13 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
{
// Glyph of Smite
if (AuraEffect * aurEff = m_caster->GetAuraEffect(55692, 0))
if (unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, m_caster->GetGUID()))
if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x100000, 0, 0, m_caster->GetGUID()))
damage += damage * aurEff->GetAmount() / 100;
}
// Improved Mind Blast (Mind Blast in shadow form bonus)
else if (m_caster->m_form == FORM_SHADOW && (m_spellInfo->SpellFamilyFlags[0] & 0x00002000))
{
Unit::AuraEffectList const& ImprMindBlast = m_caster->GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER);
Unit::AuraEffectList const& ImprMindBlast = m_caster->GetAuraEffectsByType(SPELL_AURA_ADD_FLAT_MODIFIER);
for(Unit::AuraEffectList::const_iterator i = ImprMindBlast.begin(); i != ImprMindBlast.end(); ++i)
{
if ((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_PRIEST &&
@@ -585,8 +579,8 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00000001)
{
// Improved Insect Swarm
if (AuraEffect const * aurEff = m_caster->GetDummyAura(SPELLFAMILY_DRUID, 1771, 0))
if (unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00200000))
if (AuraEffect const * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 1771, 0))
if (unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DRUID, 0x00200000, 0, 0))
damage = int32(damage*(100.0f+aurEff->GetAmount())/100.0f);
}
break;
@@ -600,16 +594,16 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
if (uint32 combo = ((Player*)m_caster)->GetComboPoints())
{
// Lookup for Deadly poison (only attacker applied)
if (AuraEffect const * aurEff = unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0, 0, m_caster->GetGUID()))
if (AuraEffect const * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0, 0, m_caster->GetGUID()))
{
// count consumed deadly poison doses at target
bool needConsume = true;
uint32 spellId = aurEff->GetId();
uint32 doses = aurEff->GetParentAura()->GetStackAmount();
uint32 doses = aurEff->GetBase()->GetStackAmount();
if (doses > combo)
doses = combo;
// Master Poisoner
Unit::AuraEffectList const& auraList = ((Player*)m_caster)->GetAurasByType(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK);
Unit::AuraEffectList const& auraList = ((Player*)m_caster)->GetAuraEffectsByType(SPELL_AURA_MOD_AURA_DURATION_BY_DISPEL_NOT_STACK);
for (Unit::AuraEffectList::const_iterator iter = auraList.begin(); iter != auraList.end(); ++iter)
{
if ((*iter)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_ROGUE && (*iter)->GetSpellProto()->SpellIconID == 1960)
@@ -662,7 +656,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
{
bool found = false;
// check dazed affect
Unit::AuraEffectList const& decSpeedList = unitTarget->GetAurasByType(SPELL_AURA_MOD_DECREASE_SPEED);
Unit::AuraEffectList const& decSpeedList = unitTarget->GetAuraEffectsByType(SPELL_AURA_MOD_DECREASE_SPEED);
for (Unit::AuraEffectList::const_iterator iter = decSpeedList.begin(); iter != decSpeedList.end(); ++iter)
{
if ((*iter)->GetSpellProto()->SpellIconID == 15 && (*iter)->GetSpellProto()->Dispel == 0)
@@ -729,7 +723,7 @@ void Spell::SpellDamageSchoolDmg(uint32 effect_idx)
case SPELLFAMILY_DEATHKNIGHT:
{
// Blood Boil - bonus for diseased targets
if (m_spellInfo->SpellFamilyFlags[0] & 0x00040000 && unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x00000002, m_caster->GetGUID()))
if (m_spellInfo->SpellFamilyFlags[0] & 0x00040000 && unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_DEATHKNIGHT, 0, 0, 0x00000002, m_caster->GetGUID()))
{
damage += m_damage / 2;
damage += int32(m_caster->GetTotalAttackPowerValue(RANGED_ATTACK)* 0.035f);
@@ -853,7 +847,7 @@ void Spell::EffectDummy(uint32 i)
AuraEffect* deepWound = unitTarget->GetAuraEffect(SPELL_DEEP_WOUNDS_12721, 0);
if (deepWound)
{
int32 remainingTicks = deepWound->GetParentAura()->GetAuraDuration() / deepWound->GetAuraAmplitude();
int32 remainingTicks = deepWound->GetBase()->GetDuration() / deepWound->GetAmplitude();
damage += remainingTicks * deepWound->GetAmount();
}
@@ -1637,7 +1631,7 @@ void Spell::EffectDummy(uint32 i)
int32 mana = damage;
// Improved Life Tap mod
if (AuraEffect const * aurEff = m_caster->GetDummyAura(SPELLFAMILY_WARLOCK, 208, 0))
if (AuraEffect const * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 208, 0))
mana = (aurEff->GetAmount() + 100)* mana / 100;
m_caster->CastCustomSpell(unitTarget, 31818, &mana, NULL, NULL, true);
@@ -1994,7 +1988,7 @@ void Spell::EffectDummy(uint32 i)
if (Item *item = ((Player*)m_caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
{
// Damage is increased by 25% if your off-hand weapon is enchanted with Flametongue.
if (m_caster->GetAura(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000))
if (m_caster->GetAuraEffect(SPELL_AURA_DUMMY, SPELLFAMILY_SHAMAN, 0x200000, 0, 0))
m_damage += m_damage * damage / 100;
}
return;
@@ -2339,15 +2333,15 @@ void Spell::EffectTriggerSpell(uint32 effIndex)
case 35729:
{
uint32 dispelMask = GetDispellMask(DISPEL_ALL);
Unit::AuraMap& Auras = unitTarget->GetAuras();
for (Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end();)
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = Auras.begin(); iter != Auras.end();)
{
// remove all harmful spells on you...
SpellEntry const* spell = iter->second->GetSpellProto();
SpellEntry const* spell = iter->second->GetBase()->GetSpellProto();
if((spell->DmgClass == SPELL_DAMAGE_CLASS_MAGIC // only affect magic spells
|| ((1<<spell->Dispel) & dispelMask))
// ignore positive and passive auras
&& !iter->second->IsPositive() && !iter->second->IsPassive())
&& !iter->second->IsPositive() && !iter->second->GetBase()->IsPassive())
{
m_caster->RemoveAura(iter);
}
@@ -2596,16 +2590,20 @@ void Spell::EffectTeleportUnits(uint32 i)
void Spell::EffectApplyAura(uint32 i)
{
if (m_spellAura)
if (AuraEffect * AurEff = m_spellAura->GetPartAura(i))
unitTarget->HandleAuraEffect(AurEff, true);
if (!m_spellAura)
return;
assert (unitTarget == m_spellAura->GetOwner());
if (!m_spellAura->IsRemoved())
m_spellAura->ApplyEffectForTargets(i);
}
void Spell::EffectApplyAreaAura(uint32 i)
{
if (m_spellAura)
if (AuraEffect * AurEff = m_spellAura->GetPartAura(i))
unitTarget->HandleAuraEffect(AurEff, true);
if (!m_spellAura)
return;
assert (unitTarget == m_spellAura->GetOwner());
if (!m_spellAura->IsRemoved())
m_spellAura->ApplyEffectForTargets(i);
}
void Spell::EffectUnlearnSpecialization( uint32 i )
@@ -2764,7 +2762,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
// Swiftmend - consumes Regrowth or Rejuvenation
else if (m_spellInfo->TargetAuraState == AURA_STATE_SWIFTMEND && unitTarget->HasAuraState(AURA_STATE_SWIFTMEND, m_spellInfo, m_caster))
{
Unit::AuraEffectList const& RejorRegr = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_HEAL);
Unit::AuraEffectList const& RejorRegr = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL);
// find most short by duration
AuraEffect *targetAura = NULL;
for (Unit::AuraEffectList::const_iterator i = RejorRegr.begin(); i != RejorRegr.end(); ++i)
@@ -2772,7 +2770,7 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
if((*i)->GetSpellProto()->SpellFamilyName == SPELLFAMILY_DRUID
&& (*i)->GetSpellProto()->SpellFamilyFlags[0] & 0x50)
{
if(!targetAura || (*i)->GetParentAura()->GetAuraDuration() < targetAura->GetParentAura()->GetAuraDuration())
if(!targetAura || (*i)->GetBase()->GetDuration() < targetAura->GetBase()->GetDuration())
targetAura = *i;
}
}
@@ -2813,11 +2811,11 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
if (AuraEffect const* aurEff = m_caster->GetAuraEffect(62971, 0))
{
Unit::AuraEffectList const& Periodic = unitTarget->GetAurasByType(SPELL_AURA_PERIODIC_HEAL);
Unit::AuraEffectList const& Periodic = unitTarget->GetAuraEffectsByType(SPELL_AURA_PERIODIC_HEAL);
for (Unit::AuraEffectList::const_iterator i = Periodic.begin(); i != Periodic.end(); ++i)
{
if (m_caster->GetGUID() == (*i)->GetCasterGUID())
addhealth += addhealth * (*i)->GetParentAura()->GetStackAmount() * aurEff->GetAmount() / 100;
addhealth += addhealth * aurEff->GetAmount() / 100;
}
}
}
@@ -2825,11 +2823,11 @@ void Spell::SpellDamageHeal(uint32 /*i*/)
else if (m_spellInfo->SpellFamilyName==SPELLFAMILY_SHAMAN && m_spellInfo->SpellFamilyFlags[0] & 0x100)
{
addhealth = caster->SpellHealingBonus(unitTarget, m_spellInfo, addhealth, HEAL);
if (AuraEffect * aurEff = unitTarget->GetAura(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, m_originalCasterGUID))
if (AuraEffect * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_HEAL, SPELLFAMILY_SHAMAN, 0, 0, 0x10, m_originalCasterGUID))
{
addhealth *= 1.25f;
// consume aura
unitTarget->RemoveAura(aurEff->GetParentAura());
unitTarget->RemoveAura(aurEff->GetBase());
}
}
// Death Pact - return pct of max health to caster
@@ -3099,29 +3097,34 @@ void Spell::EffectCreateRandomItem(uint32 i)
void Spell::EffectPersistentAA(uint32 i)
{
if(m_spellDynObj)
if (!m_spellAura)
{
assert(ObjectAccessor::GetObjectInWorld(m_spellDynObj->GetGUID(), (DynamicObject*)NULL) == m_spellDynObj);
m_spellDynObj->AddEffect(i);
return;
}
float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius);
float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
if(Player* modOwner = m_originalCaster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius);
Unit *caster = m_caster->GetEntry() == WORLD_TRIGGER ? m_originalCaster : m_caster;
DynamicObject* dynObj = new DynamicObject;
if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, m_targets.m_dstPos, radius, false))
{
delete dynObj;
return;
}
dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x01eeeeee);
caster->AddDynObject(dynObj);
dynObj->GetMap()->Add(dynObj);
Unit *caster = m_caster->GetEntry() == WORLD_TRIGGER ? m_originalCaster : m_caster;
int32 duration = GetSpellDuration(m_spellInfo);
DynamicObject* dynObj = new DynamicObject;
if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, 1<<i, m_targets.m_dstPos, duration, radius, false))
{
delete dynObj;
return;
if (Aura * aura = Aura::TryCreate(m_spellInfo, dynObj, caster, &m_currentBasePoints[0]))
m_spellAura = aura;
else
{
assert(false);
return;
}
}
dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x01eeeeee);
caster->AddDynObject(dynObj);
dynObj->GetMap()->Add(dynObj);
m_spellDynObj = dynObj;
assert(m_spellAura->GetDynobjOwner());
if (!m_spellAura->IsRemoved())
m_spellAura->ApplyEffectForTargets(i);
}
void Spell::EffectEnergize(uint32 i)
@@ -3181,10 +3184,10 @@ void Spell::EffectEnergize(uint32 i)
{
// find elixirs on target
uint32 elixir_mask = 0;
Unit::AuraMap& Auras = unitTarget->GetAuras();
for (Unit::AuraMap::iterator itr = Auras.begin(); itr != Auras.end(); ++itr)
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator itr = Auras.begin(); itr != Auras.end(); ++itr)
{
uint32 spell_id = itr->second->GetId();
uint32 spell_id = itr->second->GetBase()->GetId();
if(uint32 mask = spellmgr.GetSpellElixirMask(spell_id))
elixir_mask |= mask;
}
@@ -3724,7 +3727,7 @@ void Spell::EffectLearnSpell(uint32 i)
sLog.outDebug("Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow());
}
typedef std::list< std::pair<uint32, uint64> > DispelList;
typedef std::list< uint32 > DispelList;
void Spell::EffectDispel(uint32 i)
{
if(!unitTarget)
@@ -3735,15 +3738,15 @@ void Spell::EffectDispel(uint32 i)
// Create dispel mask by dispel type
uint32 dispel_type = m_spellInfo->EffectMiscValue[i];
uint32 dispelMask = GetDispellMask( DispelType(dispel_type));
Unit::AuraMap const& auras = unitTarget->GetAuras();
Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Aura *aur = itr->second;
if ((1<<aur->GetSpellProto()->Dispel) & dispelMask)
Aura * aura = itr->second;
if ((1<<aura->GetSpellProto()->Dispel) & dispelMask)
{
if(aur->GetSpellProto()->Dispel == DISPEL_MAGIC)
if(aura->GetSpellProto()->Dispel == DISPEL_MAGIC)
{
bool positive = aur->IsPositive() ? (!(aur->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_NEGATIVE)) : false;
bool positive = aura->IsPositive(unitTarget) ? (!(aura->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_NEGATIVE)) : false;
// do not remove positive auras if friendly target
// negative auras if non-friendly target
@@ -3751,10 +3754,10 @@ void Spell::EffectDispel(uint32 i)
continue;
}
bool dispel_charges = aur->GetSpellProto()->AttributesEx7 & SPELL_ATTR_EX7_DISPEL_CHARGES;
bool dispel_charges = aura->GetSpellProto()->AttributesEx7 & SPELL_ATTR_EX7_DISPEL_CHARGES;
for (uint8 i = dispel_charges ? aur->GetAuraCharges() : aur->GetStackAmount(); i; --i)
dispel_list.push_back(aur);
for (uint8 i = dispel_charges ? aura->GetCharges() : aura->GetStackAmount(); i; --i)
dispel_list.push_back(aura);
}
}
@@ -3774,7 +3777,8 @@ void Spell::EffectDispel(uint32 i)
if (GetDispelChance((*itr)->GetCaster(), (*itr)->GetId()))
{
success_list.push_back(std::make_pair((*itr)->GetId(), (*itr)->GetCasterGUID()));
unitTarget->RemoveAurasDueToSpellByDispel(*itr, m_caster);
success_list.push_back((*itr)->GetId());
dispel_list.erase(itr);
}
else
@@ -3807,9 +3811,8 @@ void Spell::EffectDispel(uint32 i)
for (DispelList::iterator itr = success_list.begin(); itr != success_list.end(); ++itr)
{
// Send dispelled spell info
dataSuccess << uint32(itr->first); // Spell Id
dataSuccess << uint32(*itr); // Spell Id
dataSuccess << uint8(0); // 0 - dispelled !=0 cleansed
unitTarget->RemoveAurasDueToSpellByDispel(itr->first, itr->second, m_caster);
}
m_caster->SendMessageToSet(&dataSuccess, true);
@@ -3899,11 +3902,12 @@ void Spell::EffectAddFarsight(uint32 i)
float radius = GetSpellRadiusForFriend(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
int32 duration = GetSpellDuration(m_spellInfo);
DynamicObject* dynObj = new DynamicObject;
if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, 0, m_targets.m_dstPos, duration, radius, true))
if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, m_targets.m_dstPos, radius, true))
{
delete dynObj;
return;
}
dynObj->SetDuration(duration);
dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x80000002);
m_caster->AddDynObject(dynObj);
@@ -4138,6 +4142,7 @@ void Spell::EffectEnchantItemTmp(uint32 i)
{
sLog.outError("Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id);
return;
}
for(int j = BASE_ATTACK; j <= OFF_ATTACK; ++j)
@@ -4461,11 +4466,11 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
if (needCast)
m_caster->CastSpell(unitTarget, 58567, true);
if (Aura* aur = unitTarget->GetAura(58567, m_caster->GetGUID()))
if (Aura * aur = unitTarget->GetAura(58567, m_caster->GetGUID()))
{
// 58388 - Glyph of Devastate dummy aura.
if (int32 num = (needCast ? 0 : 1) + (m_caster->HasAura(58388) ? 1 : 0))
aur->modStackAmount(num);
aur->ModStackAmount(num);
fixed_bonus += (aur->GetStackAmount() - 1) * CalculateDamage(2, unitTarget);
}
}
@@ -4498,10 +4503,10 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// full aura scan
else
{
Unit::AuraMap const& auras = unitTarget->GetAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
Unit::AuraApplicationMap const& auras = unitTarget->GetAppliedAuras();
for (Unit::AuraApplicationMap::const_iterator itr = auras.begin(); itr!=auras.end(); ++itr)
{
if (itr->second->GetSpellProto()->Dispel == DISPEL_POISON)
if (itr->second->GetBase()->GetSpellProto()->Dispel == DISPEL_POISON)
{
found = true;
break;
@@ -4558,7 +4563,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
// Shred, Maul - Rend and Tear
else if (m_spellInfo->SpellFamilyFlags[0] & 0x00008800 && unitTarget->HasAuraState(AURA_STATE_BLEEDING, m_spellInfo, m_caster))
{
if (AuraEffect const* rendAndTear = m_caster->GetDummyAura(SPELLFAMILY_DRUID, 2859, 0))
if (AuraEffect const* rendAndTear = m_caster->GetDummyAuraEffect(SPELLFAMILY_DRUID, 2859, 0))
{
totalDamagePercentMod *= float((rendAndTear->GetAmount() + 100.0f) / 100.0f);
}
@@ -4616,7 +4621,7 @@ void Spell::SpellDamageWeaponDmg(uint32 i)
{
bool consumeDiseases = true;
// Annihilation
if (AuraEffect * aurEff = m_caster->GetDummyAura(SPELLFAMILY_DEATHKNIGHT, 2710, 0))
if (AuraEffect * aurEff = m_caster->GetDummyAuraEffect(SPELLFAMILY_DEATHKNIGHT, 2710, 0))
{
// Do not consume diseases if roll sucesses
if (roll_chance_i(aurEff->GetAmount()))
@@ -4897,17 +4902,17 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Glyph of Starfire
case 54846:
{
if (AuraEffect const * aurEff = unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_DRUID,0x00000002,0,0,m_caster->GetGUID()))
if (AuraEffect const * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_DRUID,0x00000002,0,0,m_caster->GetGUID()))
{
uint32 countMin = aurEff->GetParentAura()->GetAuraMaxDuration();
uint32 countMin = aurEff->GetBase()->GetMaxDuration();
uint32 countMax = 18000;
countMax += m_caster->HasAura(38414) ? 3000 : 0;
countMax += m_caster->HasAura(57865) ? 3000 : 0;
if (countMin < countMax)
{
aurEff->GetParentAura()->SetAuraDuration(uint32(aurEff->GetParentAura()->GetAuraDuration()+3000));
aurEff->GetParentAura()->SetAuraMaxDuration(countMin+3000);
aurEff->GetBase()->SetDuration(uint32(aurEff->GetBase()->GetDuration()+3000));
aurEff->GetBase()->SetMaxDuration(countMin+3000);
}
}
return;
@@ -4915,17 +4920,17 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Glyph of Shred
case 63974:
{
if (AuraEffect const * aurEff = unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_DRUID,0x00800000,0,0,m_caster->GetGUID()))
if (AuraEffect const * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_DRUID,0x00800000,0,0,m_caster->GetGUID()))
{
uint32 countMin = aurEff->GetParentAura()->GetAuraMaxDuration();
uint32 countMin = aurEff->GetBase()->GetMaxDuration();
uint32 countMax = 20000;
countMax += m_caster->HasAura(54818) ? 4000 : 0;
countMax += m_caster->HasAura(60141) ? 4000 : 0;
if (countMin < countMax)
{
aurEff->GetParentAura()->SetAuraDuration(uint32(aurEff->GetParentAura()->GetAuraDuration()+3000));
aurEff->GetParentAura()->SetAuraMaxDuration(countMin+2000);
aurEff->GetBase()->SetDuration(uint32(aurEff->GetBase()->GetDuration()+3000));
aurEff->GetBase()->SetMaxDuration(countMin+2000);
}
}
@@ -4934,16 +4939,16 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Glyph of Backstab
case 63975:
{
if (AuraEffect const * aurEff = unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_ROGUE,0x00100000,0,0,m_caster->GetGUID()))
if (AuraEffect const * aurEff = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE,SPELLFAMILY_ROGUE,0x00100000,0,0,m_caster->GetGUID()))
{
uint32 countMin = aurEff->GetParentAura()->GetAuraMaxDuration();
uint32 countMin = aurEff->GetBase()->GetMaxDuration();
uint32 countMax = 12000;
countMax += m_caster->HasAura(56801) ? 4000 : 0;
if (countMin < countMax)
{
aurEff->GetParentAura()->SetAuraDuration(uint32(aurEff->GetParentAura()->GetAuraDuration()+3000));
aurEff->GetParentAura()->SetAuraMaxDuration(countMin+2000);
aurEff->GetBase()->SetDuration(uint32(aurEff->GetBase()->GetDuration()+3000));
aurEff->GetBase()->SetMaxDuration(countMin+2000);
}
}
@@ -5602,9 +5607,9 @@ void Spell::EffectScriptEffect(uint32 effIndex)
}
Aura * chargesaura = m_caster->GetAura(59907);
if(chargesaura && chargesaura->GetAuraCharges() > 1)
if(chargesaura && chargesaura->GetCharges() > 1)
{
chargesaura->SetAuraCharges(chargesaura->GetAuraCharges() - 1);
chargesaura->SetCharges(chargesaura->GetCharges() - 1);
m_caster->CastSpell(unitTarget, spell_heal, true, NULL, NULL, ((TempSummon*)m_caster)->GetSummonerGUID());
}
else
@@ -5678,7 +5683,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
uint32 rank = 0;
// Improved Healthstone
if (AuraEffect const * aurEff = unitTarget->GetDummyAura(SPELLFAMILY_WARLOCK, 284, 0))
if (AuraEffect const * aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_WARLOCK, 284, 0))
{
if(aurEff->GetId() == 18692)
rank = 1;
@@ -5726,8 +5731,8 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Everlasting Affliction
case 47422:
// Refresh corruption on target
if (AuraEffect * aur = unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, m_caster->GetGUID()))
aur->GetParentAura()->RefreshAura();
if (AuraEffect * aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_WARLOCK, 0x2, 0, 0, m_caster->GetGUID()))
aur->GetBase()->RefreshDuration();
return;
// Demonic Empowerment
case 47193:
@@ -5764,8 +5769,8 @@ void Spell::EffectScriptEffect(uint32 effIndex)
case 63521:
{
// Divine Plea
if(Aura *AuraDivinePlea = m_caster->GetAura(54428))
AuraDivinePlea->RefreshAura();
if(Aura * aura = m_caster->GetAura(54428))
aura->RefreshDuration();
return;
}
}
@@ -5781,8 +5786,8 @@ void Spell::EffectScriptEffect(uint32 effIndex)
if (!unitTarget)
return;
// Refresh Shadow Word: Pain on target
if (AuraEffect * aur = unitTarget->GetAura(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, m_caster->GetGUID()))
aur->GetParentAura()->RefreshAura();
if (AuraEffect * aur = unitTarget->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_PRIEST, 0x8000, 0, 0, m_caster->GetGUID()))
aur->GetBase()->RefreshDuration();
return;
}
default:
@@ -5797,7 +5802,7 @@ void Spell::EffectScriptEffect(uint32 effIndex)
// Invigoration
case 53412:
{
if (AuraEffect * aurEff = unitTarget->GetDummyAura(SPELLFAMILY_HUNTER, 3487, 0))
if (AuraEffect * aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 3487, 0))
{
if (roll_chance_i(aurEff->GetAmount()))
unitTarget->CastSpell(unitTarget, 53398, true);
@@ -5818,51 +5823,51 @@ void Spell::EffectScriptEffect(uint32 effIndex)
{
uint32 spellId = 0;
int32 basePoint = 0;
Unit::AuraMap& Auras = unitTarget->GetAuras();
for (Unit::AuraMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
Unit::AuraApplicationMap& Auras = unitTarget->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator i = Auras.begin(); i != Auras.end(); ++i)
{
Aura *aura = (*i).second;
Aura * aura = (*i).second->GetBase();
if (aura->GetCasterGUID() != m_caster->GetGUID())
continue;
// Search only Serpent Sting, Viper Sting, Scorpid Sting auras
flag96 familyFlag = aura->GetSpellProto()->SpellFamilyFlags;
if (!(familyFlag[1] & 0x00000080 || familyFlag[0] & 0x0000C000))
continue;
if (!aura->GetPartAura(0))
continue;
// Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
if (familyFlag[0] & 0x4000)
if (AuraEffect const * aurEff = aura->GetEffect(0))
{
int32 TickCount = aura->GetPartAura(0)->GetTotalTicks();
spellId = 53353; // 53353 Chimera Shot - Serpent
basePoint = aura->GetPartAura(0)->GetAmount() * TickCount * 40 / 100;
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
else if (familyFlag[1] & 0x00000080)
{
int32 TickCount = aura->GetPartAura(0)->GetTotalTicks();
spellId = 53358; // 53358 Chimera Shot - Viper
// Serpent Sting - Instantly deals 40% of the damage done by your Serpent Sting.
if (familyFlag[0] & 0x4000)
{
int32 TickCount = aurEff->GetTotalTicks();
spellId = 53353; // 53353 Chimera Shot - Serpent
basePoint = aurEff->GetAmount() * TickCount * 40 / 100;
}
// Viper Sting - Instantly restores mana to you equal to 60% of the total amount drained by your Viper Sting.
else if (familyFlag[1] & 0x00000080)
{
int32 TickCount = aura->GetEffect(0)->GetTotalTicks();
spellId = 53358; // 53358 Chimera Shot - Viper
// Amount of one aura tick
basePoint = aura->GetPartAura(0)->GetAmount() * aura->GetTarget()->GetMaxPower(POWER_MANA) / 100 ;
int32 casterBasePoint = aura->GetPartAura(0)->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50 ;
if (basePoint > casterBasePoint)
basePoint = casterBasePoint;
basePoint = basePoint * TickCount * 60 / 100;
}
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
else if (familyFlag[0] & 0x00008000)
spellId = 53359; // 53359 Chimera Shot - Scorpid
// ?? nothing say in spell desc (possibly need addition check)
//if (familyFlag & 0x0000010000000000LL || // dot
// familyFlag & 0x0000100000000000LL) // stun
//{
// spellId = 53366; // 53366 Chimera Shot - Wyvern
//}
// Amount of one aura tick
basePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 100 ;
int32 casterBasePoint = aurEff->GetAmount() * unitTarget->GetMaxPower(POWER_MANA) / 50 ;
if (basePoint > casterBasePoint)
basePoint = casterBasePoint;
basePoint = basePoint * TickCount * 60 / 100;
}
// Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute.
else if (familyFlag[0] & 0x00008000)
spellId = 53359; // 53359 Chimera Shot - Scorpid
// ?? nothing say in spell desc (possibly need addition check)
//if (familyFlag & 0x0000010000000000LL || // dot
// familyFlag & 0x0000100000000000LL) // stun
//{
// spellId = 53366; // 53366 Chimera Shot - Wyvern
//}
// Refresh aura duration
aura->RefreshAura();
// Refresh aura duration
aura->RefreshDuration();
}
break;
}
if (spellId)
@@ -5907,10 +5912,10 @@ void Spell::EffectScriptEffect(uint32 effIndex)
return;
}
// all seals have aura dummy in 2 effect
Unit::AuraMap & sealAuras = m_caster->GetAuras();
for (Unit::AuraMap::iterator iter = sealAuras.begin(); iter != sealAuras.end();)
Unit::AuraApplicationMap & sealAuras = m_caster->GetAppliedAuras();
for (Unit::AuraApplicationMap::iterator iter = sealAuras.begin(); iter != sealAuras.end();)
{
switch (iter->second->GetId())
switch (iter->first)
{
// Heart of the Crusader
case 20335: // Rank 1
@@ -5923,11 +5928,11 @@ void Spell::EffectScriptEffect(uint32 effIndex)
spellId3 = 54499;
break;
}
if (IsSealSpell(iter->second->GetSpellProto()))
Aura * aura = iter->second->GetBase();
if (IsSealSpell(aura->GetSpellProto()))
{
if (AuraEffect * aureff = iter->second->GetPartAura(2))
if (aureff->GetAuraName() == SPELL_AURA_DUMMY)
if (AuraEffect * aureff = aura->GetEffect(2))
if (aureff->GetAuraType() == SPELL_AURA_DUMMY)
{
if (sSpellStore.LookupEntry(aureff->GetAmount()))
spellId2 = aureff->GetAmount();
@@ -6807,18 +6812,19 @@ void Spell::EffectDispelMechanic(uint32 i)
std::queue < std::pair < uint32, uint64 > > dispel_list;
Unit::AuraMap& Auras = unitTarget->GetAuras();
Unit::AuraMap& Auras = unitTarget->GetOwnedAuras();
for (Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end(); iter++)
{
if((GetAllSpellMechanicMask(iter->second->GetSpellProto()) & (1<<(mechanic))) && GetDispelChance(iter->second->GetCaster(), iter->second->GetId()))
{
dispel_list.push(std::make_pair(iter->second->GetId(), iter->second->GetCasterGUID() ) );
}
Aura * aura = iter->second;
if((GetAllSpellMechanicMask(aura->GetSpellProto()) & (1<<(mechanic))) && GetDispelChance(aura->GetCaster(), aura->GetId()))
{
dispel_list.push(std::make_pair(aura->GetId(), aura->GetCasterGUID() ) );
}
}
for (; dispel_list.size(); dispel_list.pop())
{
unitTarget->RemoveAura(dispel_list.front().first, dispel_list.front().second, AURA_REMOVE_BY_ENEMY_SPELL);
unitTarget->RemoveAura(dispel_list.front().first, dispel_list.front().second, 0, AURA_REMOVE_BY_ENEMY_SPELL);
}
}
@@ -7163,15 +7169,15 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
std::list <Aura *> steal_list;
// Create dispel mask by dispel type
uint32 dispelMask = GetDispellMask( DispelType(m_spellInfo->EffectMiscValue[i]) );
Unit::AuraMap const& auras = unitTarget->GetAuras();
Unit::AuraMap const& auras = unitTarget->GetOwnedAuras();
for (Unit::AuraMap::const_iterator itr = auras.begin(); itr != auras.end(); ++itr)
{
Aura *aur = (*itr).second;
if (aur && (1<<aur->GetSpellProto()->Dispel) & dispelMask)
Aura * aura = itr->second;
if ((1<<aura->GetSpellProto()->Dispel) & dispelMask)
{
// Need check for passive? this
if (aur->IsPositive() && !aur->IsPassive() && !(aur->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_NOT_STEALABLE))
steal_list.push_back(aur);
if (aura->IsPositive(unitTarget) && !aura->IsPassive() && !(aura->GetSpellProto()->AttributesEx4 & SPELL_ATTR_EX4_NOT_STEALABLE))
steal_list.push_back(aura);
}
}
// Ok if exist some buffs for dispel try dispel it
@@ -7187,6 +7193,7 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
for (uint32 i=urand(0, list_size-1); i>0; --i)
itr++;
success_list.push_back(*itr);
unitTarget->RemoveAurasDueToSpellBySteal(*itr, m_caster);
steal_list.erase(itr);
}
if (success_list.size())
@@ -7197,11 +7204,10 @@ void Spell::EffectStealBeneficialBuff(uint32 i)
data << uint32(m_spellInfo->Id); // dispel spell id
data << uint8(0); // not used
data << uint32(success_list.size()); // count
for (std::list < Aura * > ::iterator itr = success_list.begin(); itr!=success_list.end(); ++itr)
for (std::list < Aura * >::iterator itr = success_list.begin(); itr!=success_list.end(); ++itr)
{
data << uint32((*itr)->GetId()); // Spell Id
data << uint32((*itr)->GetId()); // Spell Id
data << uint8(0); // 0 - steals !=0 transfers
unitTarget->RemoveAurasDueToSpellBySteal((*itr)->GetId(), (*itr)->GetCasterGUID(), m_caster);
}
m_caster->SendMessageToSet(&data, true);
}
@@ -7443,6 +7449,20 @@ void Spell::EffectActivateSpec(uint32 /*eff_idx*/)
((Player*)unitTarget)->ActivateSpec(damage-1); // damage is 1 or 2, spec is 0 or 1
}
void Spell::EffectPlayerNotification(uint32 /*eff_idx*/)
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
return;
switch(m_spellInfo->Id)
{
case 58730: // Restricted Flight Area
case 58600: // Restricted Flight Area
((Player *)unitTarget)->GetSession()->SendNotification(LANG_ZONE_NOFLYZONE);
break;
}
}
void Spell::EffectCastButtons(uint32 i)
{
if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER)
+2 -2
View File
@@ -420,7 +420,7 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
// non channeled case
// maybe should only remove one buff when there are multiple?
_player->RemoveAurasDueToSpell(spellId, 0, AURA_REMOVE_BY_CANCEL);
_player->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL);
}
void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket)
@@ -458,7 +458,7 @@ void WorldSession::HandlePetCancelAuraOpcode( WorldPacket& recvPacket)
return;
}
pet->RemoveAurasDueToSpell(spellId);
pet->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL);
pet->AddCreatureSpellCooldown(spellId);
}
+82 -105
View File
@@ -319,6 +319,11 @@ bool IsPassiveSpell(uint32 spellId)
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if (!spellInfo)
return false;
return IsPassiveSpell(spellInfo);
}
bool IsPassiveSpell(SpellEntry const * spellInfo)
{
if(spellInfo->Attributes & SPELL_ATTR_PASSIVE)
return true;
return false;
@@ -463,7 +468,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId);
if(!spellInfo)
return SPELL_NORMAL;
return SPELL_SPECIFIC_NORMAL;
switch(spellInfo->SpellFamilyName)
{
@@ -494,16 +499,16 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
}
if(food && drink)
return SPELL_FOOD_AND_DRINK;
return SPELL_SPECIFIC_FOOD_AND_DRINK;
else if(food)
return SPELL_FOOD;
return SPELL_SPECIFIC_FOOD;
else if(drink)
return SPELL_DRINK;
return SPELL_SPECIFIC_DRINK;
}
// Well Fed buffs (must be exclusive with Food / Drink replenishment effects, or else Well Fed will cause them to be removed)
// SpellIcon 2560 is Spell 46687, does not have this flag
else if ((spellInfo->AttributesEx2 & SPELL_ATTR_EX2_FOOD_BUFF) || spellInfo->SpellIconID == 2560)
return SPELL_WELL_FED;
return SPELL_SPECIFIC_WELL_FED;
// this may be a hack
//else if((spellInfo->AttributesEx2 & SPELL_ATTR_EX2_FOOD_BUFF)
// && !spellInfo->Category)
@@ -520,10 +525,10 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
case 8096: // Intellect
case 8115: // Agility
case 8091: // Armor
return SPELL_SCROLL;
return SPELL_SPECIFIC_SCROLL;
case 12880: // Enrage (Enrage)
case 57518: // Enrage (Wrecking Crew)
return SPELL_WARRIOR_ENRAGE;
return SPELL_SPECIFIC_WARRIOR_ENRAGE;
}
}
break;
@@ -532,23 +537,23 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
{
// family flags 18(Molten), 25(Frost/Ice), 28(Mage)
if (spellInfo->SpellFamilyFlags[0] & 0x12040000)
return SPELL_MAGE_ARMOR;
return SPELL_SPECIFIC_MAGE_ARMOR;
// Arcane brillance and Arcane intelect (normal check fails because of flags difference)
if (spellInfo->SpellFamilyFlags[0] & 0x400)
return SPELL_MAGE_ARCANE_BRILLANCE;
return SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE;
if ((spellInfo->SpellFamilyFlags[0] & 0x1000000) && spellInfo->EffectApplyAuraName[0]==SPELL_AURA_MOD_CONFUSE)
return SPELL_MAGE_POLYMORPH;
return SPELL_SPECIFIC_MAGE_POLYMORPH;
break;
}
case SPELLFAMILY_WARRIOR:
{
if (spellInfo->SpellFamilyFlags[1] & 0x000080 || spellInfo->SpellFamilyFlags[0] & 0x10000)
return SPELL_POSITIVE_SHOUT;
return SPELL_SPECIFIC_POSITIVE_SHOUT;
if (spellInfo->Id == 12292) // Death Wish
return SPELL_WARRIOR_ENRAGE;
return SPELL_SPECIFIC_WARRIOR_ENRAGE;
break;
}
@@ -556,15 +561,15 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
{
// only warlock curses have this
if (spellInfo->Dispel == DISPEL_CURSE)
return SPELL_CURSE;
return SPELL_SPECIFIC_CURSE;
// Warlock (Demon Armor | Demon Skin | Fel Armor)
if (spellInfo->SpellFamilyFlags[1] & 0x20000020 || spellInfo->SpellFamilyFlags[2] & 0x00000010)
return SPELL_WARLOCK_ARMOR;
return SPELL_SPECIFIC_WARLOCK_ARMOR;
//seed of corruption and corruption
if (spellInfo->SpellFamilyFlags[1] & 0x10 || spellInfo->SpellFamilyFlags[0] & 0x2)
return SPELL_WARLOCK_CORRUPTION;
return SPELL_SPECIFIC_WARLOCK_CORRUPTION;
break;
}
case SPELLFAMILY_PRIEST:
@@ -573,11 +578,11 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
if ((spellInfo->Attributes & SPELL_ATTR_CASTABLE_WHILE_SITTING) &&
(spellInfo->InterruptFlags & SPELL_INTERRUPT_FLAG_AUTOATTACK) &&
(spellInfo->SpellIconID == 52 || spellInfo->SpellIconID == 79))
return SPELL_WELL_FED;
return SPELL_SPECIFIC_WELL_FED;
// Divine Spirit and Prayer of Spirit
if (spellInfo->SpellFamilyFlags[0] & 0x20)
return SPELL_PRIEST_DIVINE_SPIRIT;
return SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT;
break;
}
@@ -585,39 +590,39 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
{
// only hunter stings have this
if (spellInfo->Dispel == DISPEL_POISON)
return SPELL_STING;
return SPELL_SPECIFIC_STING;
// only hunter aspects have this (but not all aspects in hunter family)
if( spellInfo->SpellFamilyFlags.HasFlag(0x00380000, 0x00440000, 0x00001010))
return SPELL_ASPECT;
return SPELL_SPECIFIC_ASPECT;
break;
}
case SPELLFAMILY_PALADIN:
{
if (IsSealSpell(spellInfo))
return SPELL_SEAL;
return SPELL_SPECIFIC_SEAL;
if (spellInfo->SpellFamilyFlags[0] & 0x11010002)
return SPELL_BLESSING;
return SPELL_SPECIFIC_BLESSING;
if (spellInfo->SpellFamilyFlags[0] & 0x00002190)
return SPELL_HAND;
return SPELL_SPECIFIC_HAND;
// Judgement of Wisdom, Judgement of Light, Judgement of Justice
if (spellInfo->Id == 20184 || spellInfo->Id == 20185 || spellInfo->Id == 20186)
return SPELL_JUDGEMENT;
return SPELL_SPECIFIC_JUDGEMENT;
// only paladin auras have this (for palaldin class family)
if( spellInfo->SpellFamilyFlags[2] & 0x00000020 )
return SPELL_AURA;
return SPELL_SPECIFIC_AURA;
break;
}
case SPELLFAMILY_SHAMAN:
{
if (IsElementalShield(spellInfo))
return SPELL_ELEMENTAL_SHIELD;
return SPELL_SPECIFIC_ELEMENTAL_SHIELD;
break;
}
@@ -628,7 +633,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
case SPELLFAMILY_DEATHKNIGHT:
if (spellInfo->Id == SPELL_ID_BLOOD_PRESENCE || spellInfo->Id == SPELL_ID_FROST_PRESENCE || spellInfo->Id == SPELL_ID_UNHOLY_PRESENCE)
//if (spellInfo->Category == 47)
return SPELL_PRESENCE;
return SPELL_SPECIFIC_PRESENCE;
break;
}
@@ -642,13 +647,13 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
case SPELL_AURA_MOD_POSSESS_PET:
case SPELL_AURA_MOD_POSSESS:
case SPELL_AURA_AOE_CHARM:
return SPELL_CHARM;
return SPELL_SPECIFIC_CHARM;
case SPELL_AURA_TRACK_CREATURES:
case SPELL_AURA_TRACK_RESOURCES:
case SPELL_AURA_TRACK_STEALTHED:
return SPELL_TRACKER;
return SPELL_SPECIFIC_TRACKER;
case SPELL_AURA_PHASE:
return SPELL_PHASE;
return SPELL_SPECIFIC_PHASE;
}
}
}
@@ -656,7 +661,7 @@ SpellSpecific GetSpellSpecific(uint32 spellId)
if(SpellSpecific sp = spellmgr.GetSpellElixirSpecific(spellInfo->Id))
return sp;
return SPELL_NORMAL;
return SPELL_SPECIFIC_NORMAL;
}
// target not allow have more one spell specific from same caster
@@ -664,16 +669,16 @@ bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1,SpellSpecific s
{
switch(spellSpec1)
{
case SPELL_SEAL:
case SPELL_BLESSING:
case SPELL_HAND:
case SPELL_AURA:
case SPELL_STING:
case SPELL_CURSE:
case SPELL_ASPECT:
case SPELL_POSITIVE_SHOUT:
case SPELL_JUDGEMENT:
case SPELL_WARLOCK_CORRUPTION:
case SPELL_SPECIFIC_SEAL:
case SPELL_SPECIFIC_BLESSING:
case SPELL_SPECIFIC_HAND:
case SPELL_SPECIFIC_AURA:
case SPELL_SPECIFIC_STING:
case SPELL_SPECIFIC_CURSE:
case SPELL_SPECIFIC_ASPECT:
case SPELL_SPECIFIC_POSITIVE_SHOUT:
case SPELL_SPECIFIC_JUDGEMENT:
case SPELL_SPECIFIC_WARLOCK_CORRUPTION:
return spellSpec1==spellSpec2;
default:
return false;
@@ -684,40 +689,40 @@ bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1, SpellSpecific
{
switch(spellSpec1)
{
case SPELL_PHASE:
case SPELL_TRACKER:
case SPELL_WARLOCK_ARMOR:
case SPELL_MAGE_ARMOR:
case SPELL_ELEMENTAL_SHIELD:
case SPELL_MAGE_POLYMORPH:
case SPELL_PRESENCE:
case SPELL_WELL_FED:
case SPELL_CHARM:
case SPELL_SCROLL:
case SPELL_WARRIOR_ENRAGE:
case SPELL_MAGE_ARCANE_BRILLANCE:
case SPELL_PRIEST_DIVINE_SPIRIT:
case SPELL_SPECIFIC_PHASE:
case SPELL_SPECIFIC_TRACKER:
case SPELL_SPECIFIC_WARLOCK_ARMOR:
case SPELL_SPECIFIC_MAGE_ARMOR:
case SPELL_SPECIFIC_ELEMENTAL_SHIELD:
case SPELL_SPECIFIC_MAGE_POLYMORPH:
case SPELL_SPECIFIC_PRESENCE:
case SPELL_SPECIFIC_WELL_FED:
case SPELL_SPECIFIC_CHARM:
case SPELL_SPECIFIC_SCROLL:
case SPELL_SPECIFIC_WARRIOR_ENRAGE:
case SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE:
case SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT:
return spellSpec1==spellSpec2;
case SPELL_FOOD:
return spellSpec2==SPELL_FOOD
|| spellSpec2==SPELL_FOOD_AND_DRINK;
case SPELL_DRINK:
return spellSpec2==SPELL_DRINK
|| spellSpec2==SPELL_FOOD_AND_DRINK;
case SPELL_FOOD_AND_DRINK:
return spellSpec2==SPELL_FOOD
|| spellSpec2==SPELL_DRINK
|| spellSpec2==SPELL_FOOD_AND_DRINK;
case SPELL_BATTLE_ELIXIR:
return spellSpec2==SPELL_BATTLE_ELIXIR
|| spellSpec2==SPELL_FLASK_ELIXIR;
case SPELL_GUARDIAN_ELIXIR:
return spellSpec2==SPELL_GUARDIAN_ELIXIR
|| spellSpec2==SPELL_FLASK_ELIXIR;
case SPELL_FLASK_ELIXIR:
return spellSpec2==SPELL_BATTLE_ELIXIR
|| spellSpec2==SPELL_GUARDIAN_ELIXIR
|| spellSpec2==SPELL_FLASK_ELIXIR;
case SPELL_SPECIFIC_FOOD:
return spellSpec2==SPELL_SPECIFIC_FOOD
|| spellSpec2==SPELL_SPECIFIC_FOOD_AND_DRINK;
case SPELL_SPECIFIC_DRINK:
return spellSpec2==SPELL_SPECIFIC_DRINK
|| spellSpec2==SPELL_SPECIFIC_FOOD_AND_DRINK;
case SPELL_SPECIFIC_FOOD_AND_DRINK:
return spellSpec2==SPELL_SPECIFIC_FOOD
|| spellSpec2==SPELL_SPECIFIC_DRINK
|| spellSpec2==SPELL_SPECIFIC_FOOD_AND_DRINK;
case SPELL_SPECIFIC_BATTLE_ELIXIR:
return spellSpec2==SPELL_SPECIFIC_BATTLE_ELIXIR
|| spellSpec2==SPELL_SPECIFIC_FLASK_ELIXIR;
case SPELL_SPECIFIC_GUARDIAN_ELIXIR:
return spellSpec2==SPELL_SPECIFIC_GUARDIAN_ELIXIR
|| spellSpec2==SPELL_SPECIFIC_FLASK_ELIXIR;
case SPELL_SPECIFIC_FLASK_ELIXIR:
return spellSpec2==SPELL_SPECIFIC_BATTLE_ELIXIR
|| spellSpec2==SPELL_SPECIFIC_GUARDIAN_ELIXIR
|| spellSpec2==SPELL_SPECIFIC_FLASK_ELIXIR;
default:
return false;
}
@@ -1036,10 +1041,9 @@ bool IsSingleTargetSpell(SpellEntry const *spellInfo)
if ( spellInfo->AttributesEx5 & SPELL_ATTR_EX5_SINGLE_TARGET_SPELL )
return true;
// TODO - need found Judgements rule
switch(GetSpellSpecific(spellInfo->Id))
{
case SPELL_JUDGEMENT:
case SPELL_SPECIFIC_JUDGEMENT:
return true;
default:
break;
@@ -1061,8 +1065,8 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI
// spell with single target specific types
switch(spec1)
{
case SPELL_JUDGEMENT:
case SPELL_MAGE_POLYMORPH:
case SPELL_SPECIFIC_JUDGEMENT:
case SPELL_SPECIFIC_MAGE_POLYMORPH:
if(GetSpellSpecific(spellInfo2->Id) == spec1)
return true;
break;
@@ -1499,7 +1503,7 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const* spellPr
if (procEvent_procEx & PROC_EX_EX_TRIGGER_ALWAYS)
return true;
// PROC_EX_NOT_ACTIVE_SPELL and PROC_EX_ONLY_ACTIVE_SPELL flags handle: if passed checks before
if ((procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && ((procEvent_procEx & (AURA_SPELL_PROC_EX_MASK | AURA_REMOVE_PROC_EX_MASK)) == 0))
if ((procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && ((procEvent_procEx & (AURA_SPELL_PROC_EX_MASK)) == 0))
return true;
}
// Check Extra Requirement like (hit/crit/miss/resist/parry/dodge/block/immune/reflect/absorb and other)
@@ -2525,17 +2529,6 @@ void SpellMgr::LoadSpellAreas()
continue;
}
switch (spellInfo->EffectApplyAuraName[0])
{
case SPELL_AURA_DUMMY:
case SPELL_AURA_PHASE:
case SPELL_AURA_GHOST:
break;
default:
sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell requirement (%u) without dummy/phase/ghost aura in effect 0", spell,abs(spellArea.auraSpell));
continue;
}
if (abs(spellArea.auraSpell) == spellArea.spellId)
{
sLog.outErrorDb("Spell %u listed in `spell_area` have aura spell (%u) requirement for itself", spell,abs(spellArea.auraSpell));
@@ -3577,21 +3570,6 @@ void SpellMgr::LoadSpellCustomAttr()
for (uint8 j = 0; j < MAX_SPELL_EFFECTS; ++j)
{
switch (spellInfo->EffectApplyAuraName[j])
{
case SPELL_AURA_MOD_ROOT:
mSpellCustomAttr[i] |= SPELL_ATTR_CU_AURA_CC;
mSpellCustomAttr[i] |= SPELL_ATTR_CU_MOVEMENT_IMPAIR;
count++;
break;
case SPELL_AURA_MOD_DECREASE_SPEED:
mSpellCustomAttr[i] |= SPELL_ATTR_CU_MOVEMENT_IMPAIR;
count++;
break;
default:
break;
}
switch (spellInfo->Effect[j])
{
case SPELL_EFFECT_SCHOOL_DAMAGE:
@@ -3645,7 +3623,6 @@ void SpellMgr::LoadSpellCustomAttr()
case SPELL_AURA_MOD_FEAR:
case SPELL_AURA_MOD_STUN:
mSpellCustomAttr[i] |= SPELL_ATTR_CU_AURA_CC;
mSpellCustomAttr[i] &= ~SPELL_ATTR_CU_MOVEMENT_IMPAIR;
count++;
break;
}
+42 -40
View File
@@ -143,36 +143,36 @@ enum SpellFamilyFlag
// Spell clasification
enum SpellSpecific
{
SPELL_NORMAL = 0,
SPELL_SEAL = 1,
SPELL_BLESSING = 2,
SPELL_AURA = 3,
SPELL_STING = 4,
SPELL_CURSE = 5,
SPELL_ASPECT = 6,
SPELL_TRACKER = 7,
SPELL_WARLOCK_ARMOR = 8,
SPELL_MAGE_ARMOR = 9,
SPELL_ELEMENTAL_SHIELD = 10,
SPELL_MAGE_POLYMORPH = 11,
SPELL_POSITIVE_SHOUT = 12,
SPELL_JUDGEMENT = 13,
SPELL_BATTLE_ELIXIR = 14,
SPELL_GUARDIAN_ELIXIR = 15,
SPELL_FLASK_ELIXIR = 16,
SPELL_WARLOCK_CORRUPTION= 17,
SPELL_WELL_FED = 18,
SPELL_FOOD = 19,
SPELL_DRINK = 20,
SPELL_FOOD_AND_DRINK = 21,
SPELL_PRESENCE = 22,
SPELL_CHARM = 23,
SPELL_SCROLL = 24,
SPELL_MAGE_ARCANE_BRILLANCE = 25,
SPELL_WARRIOR_ENRAGE = 26,
SPELL_PRIEST_DIVINE_SPIRIT = 27,
SPELL_HAND = 28,
SPELL_PHASE = 29,
SPELL_SPECIFIC_NORMAL = 0,
SPELL_SPECIFIC_SEAL = 1,
SPELL_SPECIFIC_BLESSING = 2,
SPELL_SPECIFIC_AURA = 3,
SPELL_SPECIFIC_STING = 4,
SPELL_SPECIFIC_CURSE = 5,
SPELL_SPECIFIC_ASPECT = 6,
SPELL_SPECIFIC_TRACKER = 7,
SPELL_SPECIFIC_WARLOCK_ARMOR = 8,
SPELL_SPECIFIC_MAGE_ARMOR = 9,
SPELL_SPECIFIC_ELEMENTAL_SHIELD = 10,
SPELL_SPECIFIC_MAGE_POLYMORPH = 11,
SPELL_SPECIFIC_POSITIVE_SHOUT = 12,
SPELL_SPECIFIC_JUDGEMENT = 13,
SPELL_SPECIFIC_BATTLE_ELIXIR = 14,
SPELL_SPECIFIC_GUARDIAN_ELIXIR = 15,
SPELL_SPECIFIC_FLASK_ELIXIR = 16,
SPELL_SPECIFIC_WARLOCK_CORRUPTION= 17,
SPELL_SPECIFIC_WELL_FED = 18,
SPELL_SPECIFIC_FOOD = 19,
SPELL_SPECIFIC_DRINK = 20,
SPELL_SPECIFIC_FOOD_AND_DRINK = 21,
SPELL_SPECIFIC_PRESENCE = 22,
SPELL_SPECIFIC_CHARM = 23,
SPELL_SPECIFIC_SCROLL = 24,
SPELL_SPECIFIC_MAGE_ARCANE_BRILLANCE = 25,
SPELL_SPECIFIC_WARRIOR_ENRAGE = 26,
SPELL_SPECIFIC_PRIEST_DIVINE_SPIRIT = 27,
SPELL_SPECIFIC_HAND = 28,
SPELL_SPECIFIC_PHASE = 29,
};
#define SPELL_LINKED_MAX_SPELLS 200000
@@ -301,6 +301,7 @@ bool IsHigherHankOfSpell(uint32 spellId_1,uint32 spellId_2);
bool IsSingleFromSpellSpecificPerCaster(SpellSpecific spellSpec1, SpellSpecific spellSpec2);
bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1, SpellSpecific spellSpec2);
bool IsPassiveSpell(uint32 spellId);
bool IsPassiveSpell(SpellEntry const * spellInfo);
bool IsAutocastableSpell(uint32 spellId);
uint32 CalculatePowerCost(SpellEntry const * spellInfo, Unit const * caster, SpellSchoolMask schoolMask);
@@ -404,6 +405,12 @@ inline bool IsAreaAuraEffect(uint32 effect)
return true;
return false;
}
inline bool IsUnitOwnedAuraEffect(uint32 effect)
{
return (IsAreaAuraEffect(effect) || effect == SPELL_EFFECT_APPLY_AURA);
}
inline bool IsDispel(SpellEntry const *spellInfo)
{
//spellsteal is also dispel
@@ -573,8 +580,6 @@ enum ProcFlagsEx
PROC_EX_ABSORB = 0x0000400,
PROC_EX_REFLECT = 0x0000800,
PROC_EX_INTERRUPT = 0x0001000, // Melee hit result can be Interrupt (not used)
PROC_EX_AURA_REMOVE_DESTROY = 0x0002000, // Aura absorb destroy or dispel
PROC_EX_AURA_REMOVE_EXPIRE = 0x0004000, // Aura remove by default and by cancel
PROC_EX_NOT_ACTIVE_SPELL = 0x0008000, // Spell mustn't do damage/heal to proc
PROC_EX_EX_TRIGGER_ALWAYS = 0x0010000, // If set trigger always no matter of hit result
PROC_EX_EX_ONE_TIME_TRIGGER = 0x0020000, // If set trigger always but only one time (not implemented yet)
@@ -587,8 +592,6 @@ enum ProcFlagsEx
PROC_EX_INTERNAL_TRIGGERED = 0x4000000,
PROC_EX_INTERNAL_REQ_FAMILY = 0x8000000
};
#define AURA_REMOVE_PROC_EX_MASK \
(PROC_EX_AURA_REMOVE_DESTROY | PROC_EX_AURA_REMOVE_EXPIRE)
#define AURA_SPELL_PROC_EX_MASK \
(PROC_EX_NORMAL_HIT | PROC_EX_CRITICAL_HIT | PROC_EX_MISS | \
@@ -822,7 +825,6 @@ inline bool IsProfessionSkill(uint32 skill)
#define SPELL_ATTR_CU_LINK_HIT 0x00000800
#define SPELL_ATTR_CU_LINK_AURA 0x00001000
#define SPELL_ATTR_CU_LINK_REMOVE 0x00002000
#define SPELL_ATTR_CU_MOVEMENT_IMPAIR 0x00004000
#define SPELL_ATTR_CU_EXCLUDE_SELF 0x00008000
#define SPELL_ATTR_CU_NEGATIVE_EFF0 0x00010000
#define SPELL_ATTR_CU_NEGATIVE_EFF1 0x00020000
@@ -866,15 +868,15 @@ class SpellMgr
{
uint32 mask = GetSpellElixirMask(spellid);
if((mask & ELIXIR_FLASK_MASK)==ELIXIR_FLASK_MASK)
return SPELL_FLASK_ELIXIR;
return SPELL_SPECIFIC_FLASK_ELIXIR;
else if(mask & ELIXIR_BATTLE_MASK)
return SPELL_BATTLE_ELIXIR;
return SPELL_SPECIFIC_BATTLE_ELIXIR;
else if(mask & ELIXIR_GUARDIAN_MASK)
return SPELL_GUARDIAN_ELIXIR;
return SPELL_SPECIFIC_GUARDIAN_ELIXIR;
else if(mask & ELIXIR_WELL_FED)
return SPELL_WELL_FED;
return SPELL_SPECIFIC_WELL_FED;
else
return SPELL_NORMAL;
return SPELL_SPECIFIC_NORMAL;
}
uint16 GetSpellThreat(uint32 spellid) const
+14 -13
View File
@@ -24,6 +24,7 @@
#include "Creature.h"
#include "SharedDefines.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
/*#######################################
######## ########
@@ -97,9 +98,9 @@ bool Player::UpdateStats(Stats stat)
// Update ratings in exist SPELL_AURA_MOD_RATING_FROM_STAT and only depends from stat
uint32 mask = 0;
AuraEffectList const& modRatingFromStat = GetAurasByType(SPELL_AURA_MOD_RATING_FROM_STAT);
AuraEffectList const& modRatingFromStat = GetAuraEffectsByType(SPELL_AURA_MOD_RATING_FROM_STAT);
for (AuraEffectList::const_iterator i = modRatingFromStat.begin(); i != modRatingFromStat.end(); ++i)
if (Stats((*i)->GetMiscBValue()) == stat)
if (Stats((*i)->GetMiscValueB()) == stat)
mask |= (*i)->GetMiscValue();
if (mask)
{
@@ -188,11 +189,11 @@ void Player::UpdateArmor()
value += GetModifierValue(unitMod, TOTAL_VALUE);
//add dynamic flat mods
AuraEffectList const& mResbyIntellect = GetAurasByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
AuraEffectList const& mResbyIntellect = GetAuraEffectsByType(SPELL_AURA_MOD_RESISTANCE_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mResbyIntellect.begin(); i != mResbyIntellect.end(); ++i)
{
if((*i)->GetMiscValue() & SPELL_SCHOOL_MASK_NORMAL)
value += int32(GetStat(Stats((*i)->GetMiscBValue())) * (*i)->GetAmount() / 100.0f);
value += int32(GetStat(Stats((*i)->GetMiscValueB())) * (*i)->GetAmount() / 100.0f);
}
value *= GetModifierValue(unitMod, TOTAL_PCT);
@@ -315,7 +316,7 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
case FORM_DIREBEAR:
case FORM_MOONKIN:
{
Unit::AuraEffectList const& mDummy = GetAurasByType(SPELL_AURA_DUMMY);
Unit::AuraEffectList const& mDummy = GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
{
// Predatory Strikes (effect 0)
@@ -360,18 +361,18 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
{
if ((getClassMask() & CLASSMASK_WAND_USERS)==0)
{
AuraEffectList const& mRAPbyStat = GetAurasByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT);
AuraEffectList const& mRAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_RANGED_ATTACK_POWER_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mRAPbyStat.begin(); i != mRAPbyStat.end(); ++i)
attPowerMod += int32(GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 100.0f);
}
}
else
{
AuraEffectList const& mAPbyStat = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
AuraEffectList const& mAPbyStat = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_STAT_PERCENT);
for (AuraEffectList::const_iterator i = mAPbyStat.begin(); i != mAPbyStat.end(); ++i)
attPowerMod += int32(GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 100.0f);
AuraEffectList const& mAPbyArmor = GetAurasByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
AuraEffectList const& mAPbyArmor = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACK_POWER_OF_ARMOR);
for (AuraEffectList::const_iterator iter = mAPbyArmor.begin(); iter != mAPbyArmor.end(); ++iter)
// always: ((*i)->GetModifier()->m_miscvalue == 1 == SPELL_SCHOOL_MASK_NORMAL)
attPowerMod += int32(GetArmor() / (*iter)->GetAmount());
@@ -666,7 +667,7 @@ void Player::UpdateExpertise(WeaponAttackType attack)
Item *weapon = GetWeaponForAttack(attack);
AuraEffectList const& expAuras = GetAurasByType(SPELL_AURA_MOD_EXPERTISE);
AuraEffectList const& expAuras = GetAuraEffectsByType(SPELL_AURA_MOD_EXPERTISE);
for (AuraEffectList::const_iterator itr = expAuras.begin(); itr != expAuras.end(); ++itr)
{
// item neutral spell
@@ -711,7 +712,7 @@ void Player::UpdateManaRegen()
float power_regen_mp5 = (GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) + m_baseManaRegen) / 5.0f;
// Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura
AuraEffectList const& regenAura = GetAurasByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT);
AuraEffectList const& regenAura = GetAuraEffectsByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT);
for (AuraEffectList::const_iterator i = regenAura.begin(); i != regenAura.end(); ++i)
{
power_regen_mp5 += GetStat(Stats((*i)->GetMiscValue())) * (*i)->GetAmount() / 500.0f;
@@ -730,7 +731,7 @@ void Player::_ApplyAllStatBonuses()
{
SetCanModifyStats(false);
_ApplyAllAuraMods();
_ApplyAllAuraStatMods();
_ApplyAllItemMods();
SetCanModifyStats(true);
@@ -743,7 +744,7 @@ void Player::_RemoveAllStatBonuses()
SetCanModifyStats(false);
_RemoveAllItemMods();
_RemoveAllAuraMods();
_RemoveAllAuraStatMods();
SetCanModifyStats(true);
@@ -1239,7 +1240,7 @@ void Guardian::UpdateDamagePhysical(WeaponAttackType attType)
}
}
Unit::AuraEffectList const& mDummy = GetAurasByType(SPELL_AURA_MOD_ATTACKSPEED);
Unit::AuraEffectList const& mDummy = GetAuraEffectsByType(SPELL_AURA_MOD_ATTACKSPEED);
for(Unit::AuraEffectList::const_iterator itr = mDummy.begin(); itr != mDummy.end(); ++itr)
{
switch ((*itr)->GetSpellProto()->Id)
+1 -1
View File
@@ -285,7 +285,7 @@ HostilReference* ThreatContainer::selectNextVictim(Creature* pAttacker, HostilRe
assert(target); // if the ref has status online the target must be there !
// some units are prefered in comparison to others
if(!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask()) || target->hasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) )
if(!noPriorityTargetFound && (target->IsImmunedToDamage(pAttacker->GetMeleeDamageSchoolMask()) || target->HasNegativeAuraWithInterruptFlag(AURA_INTERRUPT_FLAG_TAKE_DAMAGE)) )
{
if(iter != lastRef)
{
+1090 -1092
View File
File diff suppressed because it is too large Load Diff
+117 -83
View File
@@ -85,6 +85,7 @@ enum SpellAuraInterruptFlags
AURA_INTERRUPT_FLAG_TELEPORTED = 0x00400000, // 22
AURA_INTERRUPT_FLAG_ENTER_PVP_COMBAT = 0x00800000, // 23 removed by entering pvp combat
AURA_INTERRUPT_FLAG_DIRECT_DAMAGE = 0x01000000, // 24 removed by any direct damage
AURA_INTERRUPT_FLAG_LANDING = 0x02000000, // 25 removed by hitting the ground
AURA_INTERRUPT_FLAG_NOT_VICTIM = (AURA_INTERRUPT_FLAG_HITBYSPELL | AURA_INTERRUPT_FLAG_TAKE_DAMAGE | AURA_INTERRUPT_FLAG_DIRECT_DAMAGE),
};
@@ -317,6 +318,7 @@ struct FactionTemplateEntry;
struct SpellEntry;
struct SpellValue;
class AuraApplication;
class Aura;
class AuraEffect;
class Creature;
@@ -365,11 +367,12 @@ enum DamageTypeToSchool
enum AuraRemoveMode
{
AURA_REMOVE_BY_DEFAULT=0, // scripted remove, remove by stack with aura with different ids and sc aura remove
AURA_REMOVE_BY_STACK, // replace by aura with same id
AURA_REMOVE_NONE = 0,
AURA_REMOVE_BY_DEFAULT = 1, // scripted remove, remove by stack with aura with different ids and sc aura remove
AURA_REMOVE_BY_STACK, // replace by aura with same id
AURA_REMOVE_BY_CANCEL,
AURA_REMOVE_BY_ENEMY_SPELL, // dispel and absorb aura destroy
AURA_REMOVE_BY_EXPIRE, // dispel and absorb aura destroy
AURA_REMOVE_BY_ENEMY_SPELL, // dispel and absorb aura destroy
AURA_REMOVE_BY_EXPIRE, // aura duration has ended
AURA_REMOVE_BY_DEATH
};
@@ -854,10 +857,10 @@ struct SpellNonMeleeDamage{
struct SpellPeriodicAuraLogInfo
{
SpellPeriodicAuraLogInfo(AuraEffect *_auraEff, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier, bool _critical)
SpellPeriodicAuraLogInfo(AuraEffect const *_auraEff, uint32 _damage, uint32 _overDamage, uint32 _absorb, uint32 _resist, float _multiplier, bool _critical)
: auraEff(_auraEff), damage(_damage), overDamage(_overDamage), absorb(_absorb), resist(_resist), multiplier(_multiplier), critical(_critical){}
AuraEffect *auraEff;
AuraEffect const * auraEff;
uint32 damage;
uint32 overDamage; // overkill/overheal
uint32 absorb;
@@ -1081,13 +1084,15 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
typedef std::set<Unit*> ControlList;
typedef std::pair<uint32, uint8> spellEffectPair;
typedef std::multimap<uint32, Aura*> AuraMap;
typedef std::multimap<AuraState, Aura*> AuraStateAurasMap;
typedef std::multimap<uint32, AuraApplication*> AuraApplicationMap;
typedef std::multimap<AuraState, AuraApplication*> AuraStateAurasMap;
typedef std::list<AuraEffect *> AuraEffectList;
typedef std::list<Aura *> AuraList;
typedef std::list<AuraApplication *> AuraApplicationList;
typedef std::list<DiminishingReturn> Diminishing;
typedef std::set<uint32> ComboPointHolderSet;
typedef std::map<uint8, Aura*> VisibleAuraMap;
typedef std::map<uint8, AuraApplication*> VisibleAuraMap;
virtual ~Unit ( );
@@ -1154,7 +1159,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void CombatStopWithPets(bool includingCast = false);
void StopAttackFaction(uint32 faction_id);
Unit* SelectNearbyTarget(float dist = NOMINAL_MELEE_RANGE) const;
bool hasNegativeAuraWithInterruptFlag(uint32 flag);
void SendMeleeAttackStop(Unit* victim);
void SendMeleeAttackStart(Unit* pVictim);
@@ -1396,17 +1400,16 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SendEnergizeSpellLog(Unit *pVictim, uint32 SpellID, uint32 Damage,Powers powertype);
void EnergizeBySpell(Unit *pVictim, uint32 SpellID, uint32 Damage, Powers powertype);
uint32 SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage);
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0, Unit* originalVictim = 0);
void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const * triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(Unit* Victim, SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, AuraEffect const * triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(float x, float y, float z, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect const * triggeredByAura = NULL, uint64 originalCaster = 0, Unit* originalVictim = 0);
void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, AuraEffect const * triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect const * triggeredByAura = NULL, uint64 originalCaster = 0);
void CastCustomSpell(uint32 spellId, CustomSpellValues const &value, Unit* Victim = NULL, bool triggered = true, Item *castItem = NULL, AuraEffect const * triggeredByAura = NULL, uint64 originalCaster = 0);
void CastSpell(GameObject *go, uint32 spellId, bool triggered, Item *castItem = NULL, AuraEffect* triggeredByAura = NULL, uint64 originalCaster = 0);
void AddAura(uint32 spellId, Unit *target);
Aura * AddAura(uint32 spellId, Unit *target);
Aura * AddAura(SpellEntry const *spellInfo, uint8 effMask, Unit *target);
void SetAuraStack(uint32 spellId, Unit *target, uint32 stack);
void HandleAuraEffect(AuraEffect * aureff, bool apply);
Aura *AddAuraEffect(const SpellEntry *spellInfo, uint8 effIndex, WorldObject *source, Unit *caster, int32 *basePoints = NULL);
bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const;
@@ -1526,31 +1529,99 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
Pet* CreateTamedPetFrom(Creature* creatureTarget,uint32 spell_id = 0);
bool AddAura(Aura *aur, bool handleEffects = true);
// aura apply/remove helpers - you should better not use these
void _AddAura(Aura * aura);
AuraApplication * __ApplyAura(Aura * aura);
void __UnapplyAura(AuraApplicationMap::iterator &i);
bool _ApplyAuraEffect(Aura * aura, uint8 effIndex);
void _UnapplyAuraEffect(AuraApplication * aurApp, uint8 effIndex, AuraRemoveMode removeMode);
void _UnapplyAura(AuraApplicationMap::iterator &i, AuraRemoveMode removeMode);
void _UnapplyAura(AuraApplication * aurApp, AuraRemoveMode removeMode);
void _RemoveNoStackAurasDueToAura(Aura * aura);
void _HandleAuraEffect(AuraEffect * aurEff, bool apply);
void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveAura(uint32 spellId, uint64 caster = 0 ,AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
// m_ownedAuras container management
AuraMap & GetOwnedAuras() { return m_ownedAuras; }
AuraMap const& GetOwnedAuras() const { return m_ownedAuras; }
void RemoveOwnedAura(AuraMap::iterator &i, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveOwnedAura(uint32 spellId, uint64 caster, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveOwnedAura(Aura * aura, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
Aura * GetOwnedAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0) const;
// m_appliedAuras container management
AuraApplicationMap & GetAppliedAuras() { return m_appliedAuras; }
AuraApplicationMap const& GetAppliedAuras() const { return m_appliedAuras; }
void RemoveAura(AuraApplicationMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAura(AuraApplication * aurApp, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveAura(Aura * aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = NULL ,AuraRemoveMode removeMode= AURA_REMOVE_BY_DEFAULT);
void RemoveAuraFromStack(uint32 spellId, uint64 caster = NULL ,AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = NULL, uint8 reqEffMask = 0, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
void RemoveAuraFromStack(uint32 spellId, uint64 caster = NULL, AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
inline void RemoveAuraFromStack(AuraMap::iterator &iter,AuraRemoveMode removeMode);
void RemoveAurasDueToSpellByDispel(uint32 spellId, uint64 casterGUID, Unit *dispeller);
void RemoveAurasDueToSpellBySteal(uint32 spellId, uint64 casterGUID, Unit *stealer);
void RemoveAurasDueToSpellByDispel(Aura * aura, Unit *dispeller);
void RemoveAurasDueToSpellBySteal(Aura * aura, Unit *stealer);
void RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId);
void RemoveAurasByType(AuraType auraType, uint64 casterGUID = 0, Aura * except = NULL, bool negative = true, bool positive = true);
void RemoveNotOwnSingleTargetAuras(uint32 newPhase = 0x0);
void RemoveRankAurasDueToSpell(uint32 spellId);
bool RemoveNoStackAurasDueToAura(Aura *Aur);
void RemoveAurasWithInterruptFlags(uint32 flag, uint32 except = NULL);
void RemoveAurasWithFamily(uint32 family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID);
void RemoveMovementImpairingAuras();
void RemoveAurasWithFamily(SpellFamilyNames family, uint32 familyFlag1, uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID);
void RemoveAurasWithMechanic(uint32 mechanic_mask, AuraRemoveMode removemode = AURA_REMOVE_BY_DEFAULT, uint32 except=0);
void RemoveMovementImpairingAuras();
void RemoveAreaAurasDueToLeaveWorld();
void RemoveAllAuras();
void RemoveAllAuras(uint64 casterGUID, Aura * except = NULL, bool negative = true, bool positive = true);
void RemoveArenaAuras(bool onleave = false);
void RemoveAllAurasOnDeath();
void DelayAura(uint32 spellId, uint64 caster, int32 delaytime);
void DelayOwnedAuras(uint32 spellId, uint64 caster, int32 delaytime);
void _RemoveAllAuraStatMods();
void _ApplyAllAuraStatMods();
AuraEffectList const& GetAuraEffectsByType(AuraType type) const { return m_modAuras[type]; }
AuraApplicationList & GetSingleCastAuras() { return m_scAuras; }
AuraApplicationList const& GetSingleCastAuras() const { return m_scAuras; }
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const;
AuraEffect * GetAuraEffectOfRankedSpell(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const;
AuraEffect * GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const; // spell mustn't have familyflags
AuraEffect * GetAuraEffect(AuraType type, SpellFamilyNames family, uint32 familyFlag1 , uint32 familyFlag2, uint32 familyFlag3, uint64 casterGUID =0 );
inline AuraEffect* GetDummyAuraEffect(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const { return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);}
AuraApplication * GetAuraApplication(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const;
Aura * GetAura(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0) const;
AuraApplication * GetAuraApplicationOfRankedSpel(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0, AuraApplication * except = NULL) const;
Aura * GetAuraOfRankedSpell(uint32 spellId, uint64 casterGUID = 0, uint8 reqEffMask = 0) const;
bool HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster = 0) const;
bool HasAura(uint32 spellId, uint64 caster = 0, uint8 reqEffMask = 0) const;
bool HasAuraType(AuraType auraType) const;
bool HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const;
bool HasAuraTypeWithValue(AuraType auratype, uint32 value) const;
bool HasNegativeAuraWithInterruptFlag(uint32 flag);
AuraEffect * IsScriptOverriden(SpellEntry const * spell, int32 script) const;
uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);
uint32 GetDoTsByCaster(uint64 casterGUID) const;
int32 GetTotalAuraModifier(AuraType auratype) const;
float GetTotalAuraMultiplier(AuraType auratype) const;
int32 GetMaxPositiveAuraModifier(AuraType auratype);
int32 GetMaxNegativeAuraModifier(AuraType auratype) const;
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const;
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const;
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
float GetResistanceBuffMods(SpellSchools school, bool positive) const { return GetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school ); }
void SetResistanceBuffMods(SpellSchools school, bool positive, float val) { SetFloatValue(positive ? UNIT_FIELD_RESISTANCEBUFFMODSPOSITIVE+school : UNIT_FIELD_RESISTANCEBUFFMODSNEGATIVE+school,val); }
@@ -1665,8 +1736,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
// function for low level grid visibility checks in player/creature cases
virtual bool IsVisibleInGridForPlayer(Player const* pl) const = 0;
AuraList & GetSingleCastAuras() { return m_scAuras; }
AuraList const& GetSingleCastAuras() const { return m_scAuras; }
SpellImmuneList m_spellImmune[MAX_SPELL_IMMUNITY];
// Threat related methods
@@ -1682,49 +1751,15 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
HostilRefManager& getHostilRefManager() { return m_HostilRefManager; }
VisibleAuraMap const *GetVisibleAuras() { return &m_visibleAuras; }
Aura * GetVisibleAura(uint8 slot)
AuraApplication * GetVisibleAura(uint8 slot)
{
VisibleAuraMap::iterator itr = m_visibleAuras.find(slot);
if(itr != m_visibleAuras.end())
return itr->second;
return 0;
}
void SetVisibleAura(uint8 slot, Aura * aur){ m_visibleAuras[slot]=aur; }
void RemoveVisibleAura(uint8 slot){ m_visibleAuras.erase(slot); }
AuraMap & GetAuras() { return m_Auras; }
AuraMap const& GetAuras() const { return m_Auras; }
AuraEffectList const& GetAurasByType(AuraType type) const { return m_modAuras[type]; }
AuraEffect * GetAuraEffect(uint32 spellId, uint8 effIndex, uint64 casterGUID = 0) const;
Aura * GetAura(uint32 spellId, uint64 casterGUID = 0) const;
AuraEffect * GetAura(AuraType type, uint32 family, uint32 familyFlag1 , uint32 familyFlag2=0, uint32 familyFlag3=0, uint64 casterGUID=0);
AuraEffect * IsScriptOverriden(SpellEntry const * spell, int32 script) const;
bool HasAuraEffect(uint32 spellId, uint8 effIndex, uint64 caster = 0) const;
bool HasAura(uint32 spellId, uint64 caster = 0) const;
bool HasAura(Aura * aur) const;
bool HasAuraType(AuraType auraType) const;
bool HasAuraTypeWithMiscvalue(AuraType auratype, uint32 miscvalue) const;
bool HasAuraTypeWithValue(AuraType auratype, uint32 value) const;
inline AuraEffect* GetDummyAura(SpellFamilyNames name, uint32 iconId, uint8 effIndex) const { return GetAuraEffect(SPELL_AURA_DUMMY, name, iconId, effIndex);}
AuraEffect* GetAuraEffect(AuraType type, SpellFamilyNames name, uint32 iconId, uint8 effIndex) const;
uint32 GetDiseasesByCaster(uint64 casterGUID, bool remove = false);
uint32 GetDoTsByCaster(uint64 casterGUID) const;
int32 GetTotalAuraModifier(AuraType auratype) const;
float GetTotalAuraMultiplier(AuraType auratype) const;
int32 GetMaxPositiveAuraModifier(AuraType auratype);
int32 GetMaxNegativeAuraModifier(AuraType auratype) const;
int32 GetTotalAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
float GetTotalAuraMultiplierByMiscMask(AuraType auratype, uint32 misc_mask) const;
int32 GetMaxPositiveAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
int32 GetMaxNegativeAuraModifierByMiscMask(AuraType auratype, uint32 misc_mask) const;
int32 GetTotalAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
float GetTotalAuraMultiplierByMiscValue(AuraType auratype, int32 misc_value) const;
int32 GetMaxPositiveAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
int32 GetMaxNegativeAuraModifierByMiscValue(AuraType auratype, int32 misc_value) const;
void SetVisibleAura(uint8 slot, AuraApplication * aur){ m_visibleAuras[slot]=aur; UpdateAuraForGroup(slot);}
void RemoveVisibleAura(uint8 slot){ m_visibleAuras.erase(slot); UpdateAuraForGroup(slot);}
uint32 GetInterruptMask() const { return m_interruptMask; }
void AddInterruptMask(uint32 mask) { m_interruptMask |= mask; }
@@ -1797,9 +1832,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void SetHover(bool on);
bool isHover() const { return HasAuraType(SPELL_AURA_HOVER); }
void _RemoveAllAuraMods();
void _ApplyAllAuraMods();
int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 basePoints, Unit const* target);
int32 CalcSpellDuration(SpellEntry const* spellProto);
int32 ModSpellDuration(SpellEntry const* spellProto, Unit const* target, int32 duration, bool positive);
@@ -1931,7 +1963,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
Transport * m_transport;
void _UpdateSpells(uint32 time);
void _DeleteAuras();
void _DeleteRemovedAuras();
void _UpdateAutoRepeatSpell();
@@ -1946,9 +1978,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
DeathState m_deathState;
AuraMap m_Auras;
AuraMap::iterator m_AurasUpdateIterator;
uint32 m_removedAurasCount;
int32 m_procDeep;
typedef std::list<uint64> DynObjectGUIDs;
@@ -1959,11 +1988,16 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool m_isSorted;
uint32 m_transform;
AuraEffectList m_modAuras[TOTAL_AURAS];
AuraList m_scAuras; // casted singlecast auras
AuraList m_interruptableAuras;
AuraMap m_ownedAuras;
AuraApplicationMap m_appliedAuras;
AuraList m_removedAuras;
AuraStateAurasMap m_auraStateAuras; // Used for improve performance of aura state checks on aura apply/remove
AuraMap::iterator m_auraUpdateIterator;
uint32 m_removedAurasCount;
AuraEffectList m_modAuras[TOTAL_AURAS];
AuraApplicationList m_scAuras; // casted singlecast auras
AuraApplicationList m_interruptableAuras; // auras which have interrupt mask applied on unit
AuraStateAurasMap m_auraStateAuras; // Used for improve performance of aura state checks on aura apply/remove
uint32 m_interruptMask;
float m_auraModifiersGroup[UNIT_MOD_END][MODIFIER_TYPE_END];
@@ -1992,7 +2026,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
uint32 m_unitTypeMask;
private:
bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura* aura, SpellEntry const * procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent );
bool IsTriggeredAtSpellProcEvent(Unit *pVictim, Aura * aura, SpellEntry const * procSpell, uint32 procFlag, uint32 procExtra, WeaponAttackType attType, bool isVictim, bool active, SpellProcEventEntry const *& spellProcEvent );
bool HandleDummyAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleHasteAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggeredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
bool HandleSpellCritChanceAuraProc( Unit *pVictim, uint32 damage, AuraEffect* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);
+3 -2
View File
@@ -22,6 +22,7 @@
#include "Player.h"
#include "Creature.h"
#include "SpellAuras.h"
#include "SpellAuraEffects.h"
#include "SpellMgr.h"
#include "CreatureAIImpl.h"
@@ -370,9 +371,9 @@ void SimpleCharmedAI::UpdateAI(const uint32 /*diff*/)
//kill self if charm aura has infinite duration
if(charmer->IsInEvadeMode())
{
Unit::AuraEffectList const& auras = me->GetAurasByType(SPELL_AURA_MOD_CHARM);
Unit::AuraEffectList const& auras = me->GetAuraEffectsByType(SPELL_AURA_MOD_CHARM);
for (Unit::AuraEffectList::const_iterator iter = auras.begin(); iter != auras.end(); ++iter)
if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetParentAura()->IsPermanent())
if((*iter)->GetCasterGUID() == charmer->GetGUID() && (*iter)->GetBase()->IsPermanent())
{
charmer->Kill(me);
return;
+8 -8
View File
@@ -386,21 +386,21 @@ class ByteBuffer
void appendPackGUID(uint64 guid)
{
if (_storage.size() < _wpos + sizeof(guid) + 1)
_storage.resize(_wpos + sizeof(guid) + 1);
size_t mask_position = wpos();
*this << uint8(0);
for (uint8 i = 0; i < 8; ++i)
uint8 packGUID[8+1];
packGUID[0] = 0;
size_t size = 1;
for(uint8 i = 0;guid != 0;++i)
{
if(guid & 0xFF)
{
_storage[mask_position] |= uint8(1 << i);
*this << uint8(guid & 0xFF);
packGUID[0] |= uint8(1 << i);
packGUID[size] = uint8(guid & 0xFF);
++size;
}
guid >>= 8;
}
append(packGUID, size);
}
void put(size_t pos, const uint8 *src, size_t cnt)
+172 -164
View File
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="9.00"
Version="9,00"
Name="game"
ProjectGUID="{1DC6C4DA-A028-41F3-877D-D5400C594F88}"
RootNamespace="game"
@@ -101,167 +101,6 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
IntermediateDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP /Zm200"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\shared\vmap;..\..\dep\ACE_wrappers"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="1"
RuntimeTypeInfo="true"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="pchdef.h"
PrecompiledHeaderFile=".\game__$(PlatformName)_$(ConfigurationName)\game.pch"
AssemblerListingLocation=".\game__$(PlatformName)_$(ConfigurationName)\"
ObjectFile=".\game__$(PlatformName)_$(ConfigurationName)\"
ProgramDataBaseFileName=".\game__$(PlatformName)_$(ConfigurationName)\"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
ForcedIncludeFiles="pchdef.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;_SECURE_SCL=0"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\game__$(PlatformName)_$(ConfigurationName)\game.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug_NoPCH|Win32"
OutputDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
IntermediateDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\shared\vmap;..\..\dep\ACE_wrappers"
PreprocessorDefinitions="WIN32;_DEBUG;MANGOS_DEBUG;_LIB;"
StringPooling="false"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\game__$(PlatformName)_$(ConfigurationName)\game.pch"
AssemblerListingLocation=".\game__$(PlatformName)_$(ConfigurationName)\"
ObjectFile=".\game__$(PlatformName)_$(ConfigurationName)\"
ProgramDataBaseFileName=".\game__$(PlatformName)_$(ConfigurationName)\"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\game__$(PlatformName)_$(ConfigurationName)\game.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug|x64"
OutputDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
@@ -346,6 +185,87 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
IntermediateDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP /Zm200"
InlineFunctionExpansion="1"
AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\shared\vmap;..\..\dep\ACE_wrappers"
PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_SECURE_SCL=0"
StringPooling="true"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
EnableEnhancedInstructionSet="1"
RuntimeTypeInfo="true"
UsePrecompiledHeader="2"
PrecompiledHeaderThrough="pchdef.h"
PrecompiledHeaderFile=".\game__$(PlatformName)_$(ConfigurationName)\game.pch"
AssemblerListingLocation=".\game__$(PlatformName)_$(ConfigurationName)\"
ObjectFile=".\game__$(PlatformName)_$(ConfigurationName)\"
ProgramDataBaseFileName=".\game__$(PlatformName)_$(ConfigurationName)\"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
ForcedIncludeFiles="pchdef.h"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG;_SECURE_SCL=0"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\game__$(PlatformName)_$(ConfigurationName)\game.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|x64"
OutputDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
@@ -429,6 +349,86 @@
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug_NoPCH|Win32"
OutputDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
IntermediateDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
ConfigurationType="4"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="false"
CharacterSet="2"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
AdditionalOptions="/MP"
Optimization="0"
AdditionalIncludeDirectories="..\..\dep\include;..\..\src\framework;..\..\src\shared;..\..\src\shared\vmap;..\..\dep\ACE_wrappers"
PreprocessorDefinitions="WIN32;_DEBUG;MANGOS_DEBUG;_LIB;"
StringPooling="false"
MinimalRebuild="false"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
EnableFunctionLevelLinking="true"
RuntimeTypeInfo="true"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\game__$(PlatformName)_$(ConfigurationName)\game.pch"
AssemblerListingLocation=".\game__$(PlatformName)_$(ConfigurationName)\"
ObjectFile=".\game__$(PlatformName)_$(ConfigurationName)\"
ProgramDataBaseFileName=".\game__$(PlatformName)_$(ConfigurationName)\"
WarningLevel="3"
SuppressStartupBanner="true"
Detect64BitPortabilityProblems="false"
DebugInformationFormat="3"
CallingConvention="0"
CompileAs="0"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLibrarianTool"
OutputFile=".\game__$(PlatformName)_$(ConfigurationName)\game.lib"
SuppressStartupBanner="true"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Debug_NoPCH|x64"
OutputDirectory=".\game__$(PlatformName)_$(ConfigurationName)"
@@ -950,6 +950,14 @@
RelativePath="..\..\src\game\SpellAuraDefines.h"
>
</File>
<File
RelativePath="..\..\src\game\SpellAuraEffects.cpp"
>
</File>
<File
RelativePath="..\..\src\game\SpellAuraEffects.h"
>
</File>
<File
RelativePath="..\..\src\game\SpellAuras.cpp"
>
@@ -1748,7 +1756,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Release|Win32"
Name="Debug|x64"
>
<Tool
Name="VCCLCompilerTool"
@@ -1757,7 +1765,7 @@
/>
</FileConfiguration>
<FileConfiguration
Name="Debug|x64"
Name="Release|Win32"
>
<Tool
Name="VCCLCompilerTool"