Backed out changeset 835660b317dc

--HG--
branch : trunk
This commit is contained in:
KingPin
2008-11-17 22:07:21 -06:00
parent 474dc08c46
commit f3c48aa831
8 changed files with 16160 additions and 16179 deletions
+5 -13
View File
@@ -286,11 +286,6 @@ bool Pet::LoadPetFromDB( Unit* owner, uint32 petentry, uint32 petnumber, bool cu
m_charmInfo->GetActionBarEntry(index)->Type = atol((*iter).c_str());
++iter;
m_charmInfo->GetActionBarEntry(index)->SpellOrAction = atol((*iter).c_str());
// patch for old data where some spells have ACT_DECIDE but should have ACT_CAST
// so overwrite old state
SpellEntry const *spellInfo = sSpellStore.LookupEntry(m_charmInfo->GetActionBarEntry(index)->SpellOrAction);
if (spellInfo && spellInfo->AttributesEx & SPELL_ATTR_EX_PET_NOT_AUTOCAST)
m_charmInfo->GetActionBarEntry(index)->Type = ACT_CAST;
}
//init teach spells
@@ -1291,7 +1286,7 @@ void Pet::_LoadSpells()
{
Field *fields = result->Fetch();
addSpell(fields[0].GetUInt16(), (ActiveStates)fields[2].GetUInt16(), PETSPELL_UNCHANGED, fields[1].GetUInt16());
addSpell(fields[0].GetUInt16(), fields[2].GetUInt16(), PETSPELL_UNCHANGED, fields[1].GetUInt16());
}
while( result->NextRow() );
@@ -1422,7 +1417,7 @@ void Pet::_SaveAuras()
}
}
bool Pet::addSpell(uint16 spell_id, ActiveStates active, PetSpellState state, uint16 slot_id, PetSpellType type)
bool Pet::addSpell(uint16 spell_id, uint16 active, PetSpellState state, uint16 slot_id, PetSpellType type)
{
SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
if (!spellInfo)
@@ -1438,9 +1433,6 @@ bool Pet::addSpell(uint16 spell_id, ActiveStates active, PetSpellState state, ui
return false;
}
// same spells don't have autocast option
if (spellInfo->AttributesEx & SPELL_ATTR_EX_PET_NOT_AUTOCAST)
active = ACT_CAST;
PetSpellMap::iterator itr = m_spells.find(spell_id);
if (itr != m_spells.end())
@@ -1516,7 +1508,7 @@ bool Pet::addSpell(uint16 spell_id, ActiveStates active, PetSpellState state, ui
if (IsPassiveSpell(spell_id))
CastSpell(this, spell_id, true);
else if(state == PETSPELL_NEW)
m_charmInfo->AddSpellToAB(oldspell_id, spell_id, active);
m_charmInfo->AddSpellToAB(oldspell_id, spell_id);
if(newspell->active == ACT_ENABLED)
ToggleAutocast(spell_id, true);
@@ -1666,10 +1658,10 @@ void Pet::ToggleAutocast(uint32 spellid, bool apply)
if(IsPassiveSpell(spellid))
return;
/*if(const SpellEntry *tempSpell = GetSpellStore()->LookupEntry(spellid))
if(const SpellEntry *tempSpell = GetSpellStore()->LookupEntry(spellid))
if(tempSpell->EffectImplicitTargetA[0] != TARGET_ALL_AROUND_CASTER
&& tempSpell->EffectImplicitTargetA[0] != TARGET_CHAIN_DAMAGE)
return; */
return;
PetSpellMap::const_iterator itr = m_spells.find((uint16)spellid);
+1 -1
View File
@@ -212,7 +212,7 @@ class Pet : public Creature
void _LoadSpells();
void _SaveSpells();
bool addSpell(uint16 spell_id, ActiveStates active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, uint16 slot_id=0xffff, PetSpellType type = PETSPELL_NORMAL);
bool addSpell(uint16 spell_id,uint16 active = ACT_DECIDE, PetSpellState state = PETSPELL_NEW, uint16 slot_id=0xffff, PetSpellType type = PETSPELL_NORMAL);
bool learnSpell(uint16 spell_id);
void removeSpell(uint16 spell_id);
bool _removeSpell(uint16 spell_id);
+1 -1
View File
@@ -248,7 +248,7 @@ enum ItemQualities
#define SPELL_ATTR_EX_UNK14 0x00004000 // 14
#define SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY 0x00008000 // 15 remove auras on immunity
#define SPELL_ATTR_EX_UNAFFECTED_BY_SCHOOL_IMMUNE 0x00010000 // 16 unaffected by school immunity
#define SPELL_ATTR_EX_PET_NOT_AUTOCAST 0x00020000 // 17
#define SPELL_ATTR_EX_UNK17 0x00020000 // 17
#define SPELL_ATTR_EX_UNK18 0x00040000 // 18
#define SPELL_ATTR_EX_UNK19 0x00080000 // 19
#define SPELL_ATTR_EX_REQ_COMBO_POINTS1 0x00100000 // 20 Req combo points on target
+13 -56
View File
@@ -98,7 +98,7 @@ bool IsPassiveSpell(uint32 spellId)
return false;
return (spellInfo->Attributes & SPELL_ATTR_PASSIVE) != 0;
}
/*not used for now so commented out
bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2)
{
SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
@@ -107,12 +107,13 @@ bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_
if(spellInfo_1->Id == spellId_2) return false;
if (spellInfo_1->Effect[effIndex_1] != spellInfo_2->Effect[effIndex_2] ||
spellInfo_1->EffectItemType[effIndex_1] != spellInfo_2->EffectItemType[effIndex_2] ||
spellInfo_1->EffectMiscValue[effIndex_1] != spellInfo_2->EffectMiscValue[effIndex_2] ||
spellInfo_1->EffectApplyAuraName[effIndex_1] != spellInfo_2->EffectApplyAuraName[effIndex_2])
return false;
return true;
}*/
}
int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2)
{
@@ -243,24 +244,14 @@ bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1,uint32 spellSpec2)
case SPELL_STING:
case SPELL_CURSE:
case SPELL_ASPECT:
case SPELL_POSITIVE_SHOUT:
case SPELL_JUDGEMENT:
case SPELL_WARLOCK_CORRUPTION:
return spellSpec1==spellSpec2;
default:
return false;
}
}
bool IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1,uint32 spellSpec2)
{
switch(spellSpec1)
{
case SPELL_TRACKER:
case SPELL_WARLOCK_ARMOR:
case SPELL_MAGE_ARMOR:
case SPELL_ELEMENTAL_SHIELD:
case SPELL_MAGE_POLYMORPH:
case SPELL_POSITIVE_SHOUT:
case SPELL_JUDGEMENT:
case SPELL_WARLOCK_CORRUPTION:
return spellSpec1==spellSpec2;
case SPELL_BATTLE_ELIXIR:
return spellSpec2==SPELL_BATTLE_ELIXIR
@@ -1039,21 +1030,17 @@ bool SpellMgr::canStackSpellRanks(SpellEntry const *spellInfo)
return true;
}
bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool isFromTheSameCaster ) const
bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) const
{
if(spellId_1 == spellId_2) // auras due to the same spell
return false;
SpellEntry const *spellInfo_1 = sSpellStore.LookupEntry(spellId_1);
SpellEntry const *spellInfo_2 = sSpellStore.LookupEntry(spellId_2);
if(!spellInfo_1 || !spellInfo_2)
return false;
SpellSpecific spellId_spec_1 = GetSpellSpecific(spellId_1);
SpellSpecific spellId_spec_2 = GetSpellSpecific(spellId_2);
if (spellId_spec_1 && spellId_spec_2)
if (IsSingleFromSpellSpecificPerTarget(spellId_spec_1,spellId_spec_2)
|| (IsSingleFromSpellSpecificPerCaster(spellId_spec_1,spellId_spec_2) && isFromTheSameCaster))
return true;
if(spellInfo_1->SpellFamilyName != spellInfo_2->SpellFamilyName)
return false;
@@ -1063,44 +1050,14 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool
|| spellInfo_1->SpellIconID != spellInfo_2->SpellIconID)
return false;
}
//if both elixirs are not battle/guardian/potions/flasks then always stack
else if ((spellInfo_1->SpellFamilyName == SPELLFAMILY_POTION)
&&(spellId_spec_1 || spellId_spec_2))
return false;
else if (spellInfo_1->SpellFamilyFlags != spellInfo_2->SpellFamilyFlags)
return false;
for(uint32 i = 0; i < 3; ++i)
{
if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i])
if(spellInfo_1->Effect[i] != spellInfo_2->Effect[i]
|| spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i])
return false;
if (spellInfo_1->EffectApplyAuraName[i] || spellInfo_2->EffectApplyAuraName[i])
{
if(spellInfo_1->EffectApplyAuraName[i] != spellInfo_2->EffectApplyAuraName[i]
|| spellInfo_1->EffectMiscValue[i] != spellInfo_2->EffectMiscValue[i])
// need itemtype check? need to find an example
return false;
else if (!isFromTheSameCaster)
switch(spellInfo_1->EffectApplyAuraName[i])
{
//spells with these auras from different casters will stack
case SPELL_AURA_PERIODIC_DAMAGE:
case SPELL_AURA_PERIODIC_HEAL:
case SPELL_AURA_PERIODIC_TRIGGER_SPELL:
case SPELL_AURA_PERIODIC_ENERGIZE:
case SPELL_AURA_PERIODIC_MANA_LEECH:
case SPELL_AURA_PERIODIC_LEECH:
//exception for shaman positive totems with these auras
if ((spellInfo_1->SpellFamilyName != SPELLFAMILY_SHAMAN)
||(spellInfo_1->Effect[i]!=SPELL_AURA_MOD_INCREASE_ENERGY))
return false;
default:
break;
}
}
}
return true;
}
+2 -3
View File
@@ -284,7 +284,7 @@ inline bool IsSpellHaveEffect(SpellEntry const *spellInfo, SpellEffects effect)
return false;
}
//bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);
bool IsNoStackAuraDueToAura(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);
inline bool IsSealSpell(SpellEntry const *spellInfo)
{
@@ -301,7 +301,6 @@ inline bool IsElementalShield(SpellEntry const *spellInfo)
int32 CompareAuraRanks(uint32 spellId_1, uint32 effIndex_1, uint32 spellId_2, uint32 effIndex_2);
bool IsSingleFromSpellSpecificPerCaster(uint32 spellSpec1,uint32 spellSpec2);
bool IsSingleFromSpellSpecificPerTarget(uint32 spellSpec1,uint32 spellSpec2);
bool IsPassiveSpell(uint32 spellId);
inline bool IsDeathPersistentSpell(SpellEntry const *spellInfo)
@@ -769,7 +768,7 @@ class SpellMgr
bool IsRankSpellDueToSpell(SpellEntry const *spellInfo_1,uint32 spellId_2) const;
static bool canStackSpellRanks(SpellEntry const *spellInfo);
bool IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool isFromTheSameCaster ) const;
bool IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2) const;
SpellEntry const* SelectAuraRankForPlayerLevel(SpellEntry const* spellInfo, uint32 playerLevel) const;
+42 -9
View File
@@ -3897,18 +3897,18 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
if(!is_triggered_by_spell)
{
bool isFromSameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID();
if( spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId, isFromSameCaster) )
SpellSpecific i_spellId_spec = GetSpellSpecific(i_spellId);
bool is_sspc = IsSingleFromSpellSpecificPerCaster(spellId_spec,i_spellId_spec);
if( is_sspc && Aur->GetCasterGUID() == (*i).second->GetCasterGUID() )
{
//some spells should be not removed by lower rank of them
if (!isFromSameCaster
&&(spellProto->Effect[effIndex]==SPELL_AURA_MOD_INCREASE_ENERGY)
&&(spellProto->DurationIndex==21)
&&(spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId))
&&(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0))
// cannot remove higher rank
if (spellmgr.IsRankSpellDueToSpell(spellProto, i_spellId))
if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0)
return false;
//Its a parent aura (create this aura in ApplyModifier)
// Its a parent aura (create this aura in ApplyModifier)
if ((*i).second->IsInUse())
{
sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex());
@@ -3921,6 +3921,39 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
else
next = m_Auras.begin();
}
else if( !is_sspc && spellmgr.IsNoStackSpellDueToSpell(spellId, i_spellId) )
{
// Its a parent aura (create this aura in ApplyModifier)
if ((*i).second->IsInUse())
{
sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex());
continue;
}
RemoveAurasDueToSpell(i_spellId);
if( m_Auras.empty() )
break;
else
next = m_Auras.begin();
}
// Potions stack aura by aura (elixirs/flask already checked)
else if( spellProto->SpellFamilyName == SPELLFAMILY_POTION && i_spellProto->SpellFamilyName == SPELLFAMILY_POTION )
{
if (IsNoStackAuraDueToAura(spellId, effIndex, i_spellId, i_effIndex))
{
if(CompareAuraRanks(spellId, effIndex, i_spellId, i_effIndex) < 0)
return false; // cannot remove higher rank
// Its a parent aura (create this aura in ApplyModifier)
if ((*i).second->IsInUse())
{
sLog.outError("Aura (Spell %u Effect %u) is in process but attempt removed at aura (Spell %u Effect %u) adding, need add stack rule for Unit::RemoveNoStackAurasDueToAura", i->second->GetId(), i->second->GetEffIndex(),Aur->GetId(), Aur->GetEffIndex());
continue;
}
RemoveAura(i);
next = i;
}
}
}
}
return true;