*Correct implementation and use of dbc data for aura SPELL_AURA_CONVERT_RUNE(249)

*Fix Blood of the North, Reaping - original patch by thenecromancer
*Fix Death Rune Mastery.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-08-05 02:36:26 +02:00
parent 172a6f1279
commit 50ce9f8cfa
8 changed files with 178 additions and 15 deletions
+9 -1
View File
@@ -1507,7 +1507,15 @@ INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `Spell
( 56636, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Taste for Blood (Rank 1)
( 56637, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Taste for Blood (Rank 2)
( 56638, 0x00, 4, 0x00000020, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 6), -- Taste for Blood (Rank 3)
( 56375, 0x00, 3, 0x01000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 0); -- Glyphs of Polymorph
( 56375, 0x00, 3, 0x01000000, 0x00000000, 0x00000000, 0x00010000, 0x00000000, 0, 0, 0), -- Glyphs of Polymorph
( 54639, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 54638, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 54637, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 61433, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 61434, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 49467, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Death Rune Mastery
( 50033, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Death Rune Mastery
( 50034, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Death Rune Mastery
-- --------
-- ENCHANT PROC
+10
View File
@@ -0,0 +1,10 @@
DELETE FROM `spell_proc_event` WHERE `entry` IN(54639, 54638, 54637, 61433, 61434, 49467, 50033, 50034);
INSERT INTO `spell_proc_event` (`entry`, `SchoolMask`, `SpellFamilyName`, `SpellFamilyMask0`, `SpellFamilyMask1`, `SpellFamilyMask2`, `procFlags`, `procEx`, `ppmRate`, `CustomChance`, `Cooldown`) VALUES
( 54639, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 54638, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 54637, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 61433, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 61434, 0x00, 15, 0x00400000, 0x00010000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Blood of the north
( 49467, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Death Rune Mastery
( 50033, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0), -- Death Rune Mastery
( 50034, 0x00, 15, 0x00000010, 0x00020000, 0x00000000, 0x00000000, 0x00000000, 0, 0, 0); -- Death Rune Mastery
+1
View File
@@ -20474,6 +20474,7 @@ void Player::InitRunes()
m_runes = new Runes;
m_runes->runeState = 0;
m_runes->lastUsedRune = RUNE_BLOOD;
for(uint32 i = 0; i < MAX_RUNES; ++i)
{
+3
View File
@@ -294,6 +294,7 @@ struct Runes
{
RuneInfo runes[MAX_RUNES];
uint8 runeState; // mask of available runes
RuneType lastUsedRune;
void SetRuneState(uint8 index, bool set = true)
{
@@ -2133,6 +2134,8 @@ class TRINITY_DLL_SPEC Player : public Unit
uint8 GetBaseRune(uint8 index) const { return m_runes->runes[index].BaseRune; }
uint8 GetCurrentRune(uint8 index) const { return m_runes->runes[index].CurrentRune; }
uint8 GetRuneCooldown(uint8 index) const { return m_runes->runes[index].Cooldown; }
RuneType GetLastUsedRune() { return m_runes->lastUsedRune; }
void SetLastUsedRune(RuneType type) { m_runes->lastUsedRune = type; }
void SetBaseRune(uint8 index, uint8 baseRune) { m_runes->runes[index].BaseRune = baseRune; }
void SetCurrentRune(uint8 index, uint8 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); }
+45
View File
@@ -4128,6 +4128,7 @@ void Spell::TakeRunePower()
if((plr->GetRuneCooldown(i) == 0) && (runeCost[rune] > 0))
{
plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec
plr->SetLastUsedRune(RuneType(rune));
runeCost[rune]--;
}
}
@@ -4142,8 +4143,52 @@ void Spell::TakeRunePower()
if((plr->GetRuneCooldown(i) == 0) && (rune == RUNE_DEATH))
{
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)
{
if ((*itr)->GetSpellProto()->SpellIconID != 2622)
continue;
}
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;
}
}
if(runeCost[RUNE_DEATH] == 0)
break;
}
+52 -12
View File
@@ -4817,6 +4817,12 @@ void AuraEffect::HandleAuraPeriodicDummy(bool apply, bool Real, bool changeAmoun
m_amount += int32(caster->GetTotalAttackPowerValue(RANGED_ATTACK) * 14 / 100);
break;
}
case SPELLFAMILY_DEATHKNIGHT:
{
if (spell->SpellIconID == 3041 || spell->SpellIconID == 22 || spell->SpellIconID == 2622)
m_amount = 0;
break;
}
}
m_isPeriodic = apply;
@@ -7225,9 +7231,6 @@ void AuraEffect::PeriodicDummyTick()
// Being pursuaded by Gargoyle - AI related?
// if (spell->SpellFamilyFlags[1] & 0x00000080)
// break;
// Death Rune Mastery
// if (spell->SpellFamilyFlags & 0x0000000000004000LL)
// return;
// Bladed Armor
if (spell->SpellIconID == 2653)
{
@@ -7237,12 +7240,43 @@ void AuraEffect::PeriodicDummyTick()
m_target->CastCustomSpell(m_target, 61217, &apBonus, &apBonus, 0, true, 0, this);
return;
}
// Reaping
// if (spell->SpellIconID == 22)
// return;
// Blood of the North
// if (spell->SpellIconID == 30412)
// return;
// Reaping
// Death Rune Mastery
if (spell->SpellIconID == 3041 || spell->SpellIconID == 22 || spell->SpellIconID == 2622)
{
if (m_target->GetTypeId() != TYPEID_PLAYER)
return;
// Aura not used - prevent removing death runes from other effects
if (!GetAmount())
return;
if(((Player*)m_target)->getClass() != CLASS_DEATH_KNIGHT)
return;
// Remove death rune added on proc
for (uint8 i=0;i<MAX_RUNES && m_amount;++i)
{
if (m_spellProto->SpellIconID == 2622)
{
if (((Player*)m_target)->GetCurrentRune(i) != RUNE_DEATH ||
((Player*)m_target)->GetBaseRune(i) == RUNE_BLOOD )
continue;
}
else
{
if (((Player*)m_target)->GetCurrentRune(i) != RUNE_DEATH ||
((Player*)m_target)->GetBaseRune(i) != RUNE_BLOOD )
continue;
}
if (!(m_amount & (1<<i)))
continue;
((Player*)m_target)->ConvertRune(i,((Player*)m_target)->GetBaseRune(i));
}
m_amount = 0;
return;
}
break;
}
default:
@@ -7363,26 +7397,32 @@ void AuraEffect::HandleAuraConvertRune(bool apply, bool Real, bool /*changeAmoun
if(plr->getClass() != CLASS_DEATH_KNIGHT)
return;
// how to determine what rune need to be converted?
for(uint32 i = 0; i < MAX_RUNES; ++i)
uint32 runes = 0;
// convert number of runes specified in aura amount of rune type in miscvalue to runetype in miscvalueb
for(uint32 i = 0; i < MAX_RUNES && m_amount; ++i)
{
if(apply)
{
if (GetMiscValue() != plr->GetCurrentRune(i))
continue;
if(!plr->GetRuneCooldown(i))
{
plr->ConvertRune(i, GetSpellProto()->EffectMiscValueB[m_effIndex]);
break;
runes |= 1<<i;
--m_amount;
}
}
else
{
if(plr->GetCurrentRune(i) == GetSpellProto()->EffectMiscValueB[m_effIndex])
{
if (m_amount & (1<<i))
plr->ConvertRune(i, plr->GetBaseRune(i));
break;
}
}
}
if (apply)
m_amount = runes;
}
// Control Auras
+2
View File
@@ -350,6 +350,8 @@ class TRINITY_DLL_SPEC AuraEffect
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; }
+55 -1
View File
@@ -7164,12 +7164,66 @@ bool Unit::HandleAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAura, S
{
case SPELLFAMILY_DEATHKNIGHT:
{
// Blood of the North
// Reaping
// Death Rune Mastery
if (dummySpell->SpellIconID == 3041 || dummySpell->SpellIconID == 22 || dummySpell->SpellIconID == 2622)
{
*handled = true;
// Convert recently used Blood Rune to Death Rune
if (GetTypeId() == TYPEID_PLAYER)
{
if(((Player*)this)->getClass() != CLASS_DEATH_KNIGHT)
return false;
RuneType rune = ((Player*)this)->GetLastUsedRune();
// can't proc from death rune use
if (rune == RUNE_DEATH)
return false;
AuraEffect * aurEff = triggeredByAura->GetPartAura(0);
if (!aurEff)
return false;
// Reset amplitude - set death rune remove timer to 30s
aurEff->ResetPeriodicTimer();
uint32 runesLeft;
if (dummySpell->SpellIconID == 2622)
runesLeft = 2;
else
runesLeft = 1;
for (uint8 i=0;i<MAX_RUNES && runesLeft;++i)
{
if (dummySpell->SpellIconID == 2622)
{
if (((Player*)this)->GetCurrentRune(i) == RUNE_DEATH ||
((Player*)this)->GetBaseRune(i) == RUNE_BLOOD )
continue;
}
else
{
if (((Player*)this)->GetCurrentRune(i) == RUNE_DEATH ||
((Player*)this)->GetBaseRune(i) != RUNE_BLOOD )
continue;
}
if (GetRuneCooldown(i) != RUNE_COOLDOWN)
continue;
--runesLeft;
// Mark aura as used
aurEff->SetAmount(aurEff->GetAmount() | (1<<i));
((Player*)this)->ConvertRune(i,RUNE_DEATH);
}
return true;
}
return false;
}
switch(dummySpell->Id)
{
// Hungering Cold aura drop
case 51209:
*handled = true;
// Drop only in disease case
// Drop only in not disease case
if (procSpell && procSpell->Dispel == DISPEL_DISEASE)
return false;
return true;