Apply procPatch

This commit is contained in:
DiSlord 2008-11-26 22:23:10 +03:00
parent bdf7fb8394
commit 4a07c0c6c2
9 changed files with 2298 additions and 421 deletions

View file

@ -530,6 +530,17 @@ bool IsSingleTargetSpells(SpellEntry const *spellInfo1, SpellEntry const *spellI
return false;
}
bool IsAuraAddedBySpell(uint32 auraType, uint32 spellId)
{
SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId);
if (!spellproto) return false;
for (int i = 0; i < 3; i++)
if (spellproto->EffectApplyAuraName[i] == auraType)
return true;
return false;
}
uint8 GetErrorAtShapeshiftedCast (SpellEntry const *spellInfo, uint32 form)
{
// talents that learn spells can have stance requirements that need ignore
@ -806,8 +817,8 @@ void SpellMgr::LoadSpellProcEvents()
uint32 count = 0;
// 0 1 2 3 4 5 6 7 8
QueryResult *result = WorldDatabase.Query("SELECT entry, SchoolMask, Category, SkillID, SpellFamilyName, SpellFamilyMask, procFlags, ppmRate, cooldown FROM spell_proc_event");
// 0 1 2 3 4 5 6 7 8
QueryResult *result = WorldDatabase.Query("SELECT entry, SchoolMask, SpellFamilyName, SpellFamilyMask, procFlags, procEx, ppmRate, CustomChance, Cooldown FROM spell_proc_event");
if( !result )
{
@ -821,7 +832,7 @@ void SpellMgr::LoadSpellProcEvents()
}
barGoLink bar( result->GetRowCount() );
uint32 customProc = 0;
do
{
Field *fields = result->Fetch();
@ -830,7 +841,8 @@ void SpellMgr::LoadSpellProcEvents()
uint16 entry = fields[0].GetUInt16();
if (!sSpellStore.LookupEntry(entry))
const SpellEntry *spell = sSpellStore.LookupEntry(entry);
if (!spell)
{
sLog.outErrorDb("Spell %u listed in `spell_proc_event` does not exist", entry);
continue;
@ -839,23 +851,35 @@ void SpellMgr::LoadSpellProcEvents()
SpellProcEventEntry spe;
spe.schoolMask = fields[1].GetUInt32();
spe.category = fields[2].GetUInt32();
spe.skillId = fields[3].GetUInt32();
spe.spellFamilyName = fields[4].GetUInt32();
spe.spellFamilyMask = fields[5].GetUInt64();
spe.procFlags = fields[6].GetUInt32();
spe.ppmRate = fields[7].GetFloat();
spe.spellFamilyName = fields[2].GetUInt32();
spe.spellFamilyMask = fields[3].GetUInt64();
spe.procFlags = fields[4].GetUInt32();
spe.procEx = fields[5].GetUInt32();
spe.ppmRate = fields[6].GetFloat();
spe.customChance = fields[7].GetFloat();
spe.cooldown = fields[8].GetUInt32();
mSpellProcEventMap[entry] = spe;
if (spell->procFlags==0)
{
if (spe.procFlags == 0)
{
sLog.outErrorDb("Spell %u listed in `spell_proc_event` probally not triggered spell", entry);
continue;
}
customProc++;
}
++count;
} while( result->NextRow() );
delete result;
sLog.outString();
sLog.outString( ">> Loaded %u spell proc event conditions", count );
if (customProc)
sLog.outString( ">> Loaded %u custom spell proc event conditions +%u custom", count, customProc );
else
sLog.outString( ">> Loaded %u spell proc event conditions", count );
/*
// Commented for now, as it still produces many errors (still quite many spells miss spell_proc_event)
@ -887,6 +911,7 @@ void SpellMgr::LoadSpellProcEvents()
*/
}
/*
bool SpellMgr::IsSpellProcEventCanTriggeredBy( SpellProcEventEntry const * spellProcEvent, SpellEntry const * procSpell, uint32 procFlags )
{
if((procFlags & spellProcEvent->procFlags) == 0)
@ -925,6 +950,73 @@ bool SpellMgr::IsSpellProcEventCanTriggeredBy( SpellProcEventEntry const * spell
return true;
}
*/
bool SpellMgr::IsSpellProcEventCanTriggeredBy(SpellProcEventEntry const * spellProcEvent, uint32 EventProcFlag, SpellEntry const * procSpell, uint32 procFlags, uint32 procExtra, bool active)
{
// No extra req need
uint32 procEvent_procEx = PROC_EX_NONE;
// check prockFlags for condition
if((procFlags & EventProcFlag) == 0)
return false;
// Always trigger for this
if (EventProcFlag & (PROC_FLAG_KILLED | PROC_FLAG_KILL_AND_GET_XP))
return true;
if (spellProcEvent) // Exist event data
{
// Store extra req
procEvent_procEx = spellProcEvent->procEx;
// For melee triggers
if (procSpell == NULL)
{
// Check (if set) for school (melee attack have Normal school)
if(spellProcEvent->schoolMask && (spellProcEvent->schoolMask & SPELL_SCHOOL_MASK_NORMAL) == 0)
return false;
}
else // For spells need check school/spell family/family mask
{
// Check (if set) for school
if(spellProcEvent->schoolMask && (spellProcEvent->schoolMask & procSpell->SchoolMask) == 0)
return false;
// Check (if set) for spellFamilyName
if(spellProcEvent->spellFamilyName && (spellProcEvent->spellFamilyName != procSpell->SpellFamilyName))
return false;
// spellFamilyName is Ok need check for spellFamilyMask if present
if(spellProcEvent->spellFamilyMask)
{
if ((spellProcEvent->spellFamilyMask & procSpell->SpellFamilyFlags) == 0)
return false;
active = true; // Spell added manualy -> so its active spell
}
}
}
// Check for extra req (if none) and hit/crit
if (procEvent_procEx == PROC_EX_NONE)
{
// No extra req, so can trigger only for active (damage/healing present) and hit/crit
if((procExtra & (PROC_EX_NORMAL_HIT|PROC_EX_CRITICAL_HIT)) && active)
return true;
}
else // Passive spells hits here only if resist/reflect/immune/evade
{
// Exist req for PROC_EX_EX_TRIGGER_ALWAYS
if (procEvent_procEx & PROC_EX_EX_TRIGGER_ALWAYS)
return true;
// Passive spells can`t trigger if need hit
if ((procEvent_procEx & PROC_EX_NORMAL_HIT) && !active)
return false;
// Check Extra Requirement like (hit/crit/miss/resist/parry/dodge/block/immune/reflect/absorb and other)
if (procEvent_procEx & procExtra)
return true;
}
return false;
}
void SpellMgr::LoadSpellElixirs()
{