Merge remote branch 'origin/master' into 330

This commit is contained in:
tomrus88 2009-12-21 17:06:32 +03:00
commit d69abfcae1
15 changed files with 98 additions and 167 deletions

View file

@ -34,6 +34,16 @@ struct SpellEntry;
#define TIME_INTERVAL_LOOK 5000
#define VISIBILITY_RANGE 10000
enum CastFlags
{
CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time)
CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
CAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
};
class MANGOS_DLL_SPEC CreatureAI
{
public:

View file

@ -137,16 +137,6 @@ enum Target
TARGET_T_END
};
enum CastFlags
{
CAST_INTURRUPT_PREVIOUS = 0x01, //Interrupt any spell casting
CAST_TRIGGERED = 0x02, //Triggered (this makes spell cost zero mana and have no cast time)
CAST_FORCE_CAST = 0x04, //Forces cast even if creature is out of mana or out of range
CAST_NO_MELEE_IF_OOM = 0x08, //Prevents creature from entering melee if out of mana or out of range
CAST_FORCE_TARGET_SELF = 0x10, //Forces the target to cast this spell on itself
CAST_AURA_NOT_PRESENT = 0x20, //Only casts the spell if the target does not have an aura from the spell
};
enum EventFlags
{
EFLAG_REPEATABLE = 0x01, //Event repeats

View file

@ -1429,6 +1429,10 @@ struct SpellEntry
// helpers
int32 CalculateSimpleValue(uint8 eff) const { return EffectBasePoints[eff]+int32(EffectBaseDice[eff]); }
uint32 const* GetEffectSpellClassMask(uint8 effect) const
{
return EffectSpellClassMaskA + effect * 3;
}
private:
// prevent creating custom entries (copy data from original in fact)

View file

@ -274,6 +274,33 @@ std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi)
return ss;
}
SpellModifier::SpellModifier( SpellModOp _op, SpellModType _type, int32 _value, SpellEntry const* spellEntry, uint8 eff, int16 _charges /*= 0*/ ) : op(_op), type(_type), charges(_charges), value(_value), spellId(spellEntry->Id), lastAffected(NULL)
{
uint32 const* ptr = spellEntry->GetEffectSpellClassMask(eff);
mask = uint64(ptr[0]) | (uint64(ptr[1]) << 32);
mask2= ptr[2];
}
SpellModifier::SpellModifier( SpellModOp _op, SpellModType _type, int32 _value, Aura const* aura, int16 _charges /*= 0*/ ) : op(_op), type(_type), charges(_charges), value(_value), spellId(aura->GetId()), lastAffected(NULL)
{
uint32 const* ptr = aura->getAuraSpellClassMask();
mask = uint64(ptr[0]) | (uint64(ptr[1]) << 32);
mask2= ptr[2];
}
bool SpellModifier::isAffectedOnSpell( SpellEntry const *spell ) const
{
SpellEntry const *affect_spell = sSpellStore.LookupEntry(spellId);
// False if affect_spell == NULL or spellFamily not equal
if (!affect_spell || affect_spell->SpellFamilyName != spell->SpellFamilyName)
return false;
if (mask & spell->SpellFamilyFlags)
return true;
if (mask2 & spell->SpellFamilyFlags2)
return true;
return false;
}
//== Player ====================================================
UpdateMask Player::updateVisualBits;
@ -17168,7 +17195,7 @@ bool Player::IsAffectedBySpellmod(SpellEntry const *spellInfo, SpellModifier *mo
return false;
}
return sSpellMgr.IsAffectedByMod(spellInfo, mod);
return mod->isAffectedOnSpell(spellInfo);
}
void Player::AddSpellMod(SpellModifier* mod, bool apply)
@ -17178,9 +17205,9 @@ void Player::AddSpellMod(SpellModifier* mod, bool apply)
for(int eff=0;eff<96;++eff)
{
uint64 _mask = 0;
uint64 _mask2= 0;
uint32 _mask2= 0;
if (eff<64) _mask = uint64(1) << (eff- 0);
else _mask2= uint64(1) << (eff-64);
else _mask2= uint32(1) << (eff-64);
if ( mod->mask & _mask || mod->mask2 & _mask2)
{
int32 val = 0;
@ -21287,3 +21314,4 @@ void Player::SetHomebindToCurrentPos()
CharacterDatabase.PExecute("UPDATE character_homebind SET map = '%u', zone = '%u', position_x = '%f', position_y = '%f', position_z = '%f' WHERE guid = '%u'",
m_homebindMapId, m_homebindZoneId, m_homebindX, m_homebindY, m_homebindZ, GetGUIDLow());
}

View file

@ -97,12 +97,23 @@ struct PlayerSpell
struct SpellModifier
{
SpellModifier() : charges(0), lastAffected(NULL) {}
SpellModifier(SpellModOp _op, SpellModType _type, int32 _value, uint32 _spellId, uint64 _mask, uint32 _mask2 = 0, int16 _charges = 0)
: op(_op), type(_type), charges(_charges), value(_value), mask(_mask), mask2(_mask2), spellId(_spellId), lastAffected(NULL)
{}
SpellModifier(SpellModOp _op, SpellModType _type, int32 _value, SpellEntry const* spellEntry, uint8 eff, int16 _charges = 0);
SpellModifier(SpellModOp _op, SpellModType _type, int32 _value, Aura const* aura, int16 _charges = 0);
bool isAffectedOnSpell(SpellEntry const *spell) const;
SpellModOp op : 8;
SpellModType type : 8;
int16 charges : 16;
int32 value;
uint64 mask;
uint64 mask2;
uint32 mask2;
uint32 spellId;
Spell const* lastAffected;
};

View file

@ -5772,7 +5772,10 @@ void Spell::UpdatePointers()
bool Spell::IsAffectedByAura(Aura *aura) const
{
return sSpellMgr.IsAffectedByMod(m_spellInfo, aura->getAuraSpellMod());
if(SpellModifier* mod = aura->getAuraSpellMod())
return mod->isAffectedOnSpell(m_spellInfo);
else
return false;
}
bool Spell::CheckTargetCreatureType(Unit* target) const

View file

@ -1405,30 +1405,14 @@ void Aura::HandleAddModifier(bool apply, bool Real)
break;
}
SpellModifier *mod = new SpellModifier;
mod->op = SpellModOp(m_modifier.m_miscvalue);
mod->value = m_modifier.m_amount;
mod->type = SpellModType(m_modifier.m_auraname); // SpellModType value == spell aura types
mod->spellId = GetId();
uint32 const *ptr;
switch (m_effIndex)
{
case 0: ptr = &m_spellProto->EffectSpellClassMaskA[0]; break;
case 1: ptr = &m_spellProto->EffectSpellClassMaskB[0]; break;
case 2: ptr = &m_spellProto->EffectSpellClassMaskC[0]; break;
default:
return;
}
mod->mask = (uint64)ptr[0] | (uint64)ptr[1]<<32;
mod->mask2= (uint64)ptr[2];
m_spellmod = new SpellModifier(
SpellModOp(m_modifier.m_miscvalue),
SpellModType(m_modifier.m_auraname), // SpellModType value == spell aura types
m_modifier.m_amount,
this,
// prevent expire spell mods with (charges > 0 && m_stackAmount > 1)
// all this spell expected expire not at use but at spell proc event check
mod->charges = m_spellProto->StackAmount > 1 ? 0 : m_procCharges;
m_spellmod = mod;
m_spellProto->StackAmount > 1 ? 0 : m_procCharges);
}
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
@ -1464,18 +1448,10 @@ void Aura::HandleAddTargetTrigger(bool apply, bool /*Real*/)
SpellModifier *mod = new SpellModifier;
mod->spellId = GetId();
uint32 const *ptr;
switch (m_effIndex)
{
case 0: ptr = &m_spellProto->EffectSpellClassMaskA[0]; break;
case 1: ptr = &m_spellProto->EffectSpellClassMaskB[0]; break;
case 2: ptr = &m_spellProto->EffectSpellClassMaskC[0]; break;
default:
return;
}
uint32 const *ptr = m_spellProto->GetEffectSpellClassMask(m_effIndex);
mod->mask = (uint64)ptr[0] | (uint64)ptr[1]<<32;
mod->mask2= (uint64)ptr[2];
mod->mask2= ptr[2];
m_spellmod = mod;
}
else
@ -2621,14 +2597,8 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
if(apply)
{
// Reduce backfire damage (dot damage) from Shadow Word: Death
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_DOT;
mod->value = m_modifier.m_amount;
mod->type = SPELLMOD_PCT;
mod->spellId = GetId();
mod->mask = UI64LIT(0x0000200000000000);
mod->mask2= UI64LIT(0x0);
m_spellmod = mod;
// aura have wrong effectclassmask, so use hardcoded value
m_spellmod = new SpellModifier(SPELLMOD_DOT,SPELLMOD_PCT,m_modifier.m_amount,GetId(),UI64LIT(0x0000200000000000));
}
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
return;
@ -2646,17 +2616,8 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
return;
if(apply)
{
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_DOT;
mod->value = m_modifier.m_amount/7;
mod->type = SPELLMOD_FLAT;
mod->spellId = GetId();
mod->mask = UI64LIT(0x001000000000);
mod->mask2= UI64LIT(0x0);
m_spellmod = mod;
}
// dummy not have proper effectclassmask
m_spellmod = new SpellModifier(SPELLMOD_DOT,SPELLMOD_FLAT,m_modifier.m_amount/7,GetId(),UI64LIT(0x001000000000));
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
return;
@ -2780,39 +2741,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
}
break;
case SPELLFAMILY_SHAMAN:
{
// Improved Weapon Totems
if( GetSpellProto()->SpellIconID == 57 && m_target->GetTypeId()==TYPEID_PLAYER )
{
if(apply)
{
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_EFFECT1;
mod->value = m_modifier.m_amount;
mod->type = SPELLMOD_PCT;
mod->spellId = GetId();
switch (m_effIndex)
{
case 0:
// Windfury Totem
mod->mask = UI64LIT(0x00200000000);
mod->mask2= UI64LIT(0x0);
break;
case 1:
// Flametongue Totem
mod->mask = UI64LIT(0x00400000000);
mod->mask2= UI64LIT(0x0);
break;
}
m_spellmod = mod;
}
((Player*)m_target)->AddSpellMod(m_spellmod, apply);
return;
}
break;
}
}
// pet auras
@ -3089,27 +3018,30 @@ void Aura::HandleAuraModShapeshift(bool apply, bool Real)
case FORM_DIREBEAR:
{
// get furor proc chance
uint32 FurorChance = 0;
int32 furorChance = 0;
Unit::AuraList const& mDummy = m_target->GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator i = mDummy.begin(); i != mDummy.end(); ++i)
{
if ((*i)->GetSpellProto()->SpellIconID == 238)
{
FurorChance = (*i)->GetModifier()->m_amount;
furorChance = (*i)->GetModifier()->m_amount;
break;
}
}
if(!furorChance)
break;
if (m_modifier.m_miscvalue == FORM_CAT)
{
m_target->SetPower(POWER_ENERGY, 0);
if(urand(1,100) <= FurorChance)
m_target->CastSpell(m_target, 17099, true, NULL, this);
// Furor chance is now amount of energy for cat form
m_target->CastCustomSpell(m_target, 17099, &furorChance, NULL, NULL, this);
}
else
{
m_target->SetPower(POWER_RAGE, 0);
if(urand(1,100) <= FurorChance)
if(urand(1,100) <= furorChance)
m_target->CastSpell(m_target, 17057, true, NULL, this);
}
break;

View file

@ -339,7 +339,7 @@ class MANGOS_DLL_SPEC Aura
void TriggerSpell();
void TriggerSpellWithValue();
uint32 const *getAuraSpellClassMask() const { return m_spellProto->EffectSpellClassMaskA + m_effIndex * 3; }
uint32 const *getAuraSpellClassMask() const { return m_spellProto->GetEffectSpellClassMask(m_effIndex); }
bool isAffectedOnSpell(SpellEntry const *spell) const;
protected:
Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);

View file

@ -668,22 +668,6 @@ void Spell::EffectSchoolDMG(uint32 effect_idx)
if(stacks)
damage += damage * stacks * 10 /100;
}
// Avenger's Shield ($m1+0.07*$SPH+0.07*$AP) - ranged sdb for future
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000000000004000))
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
damage += int32(ap * 0.07f) + int32(holy * 7 / 100);
}
// Hammer of Wrath ($m1+0.15*$SPH+0.15*$AP) - ranged type sdb future fix
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0000008000000000))
{
float ap = m_caster->GetTotalAttackPowerValue(BASE_ATTACK);
int32 holy = m_caster->SpellBaseDamageBonus(GetSpellSchoolMask(m_spellInfo)) +
m_caster->SpellBaseDamageBonusForVictim(GetSpellSchoolMask(m_spellInfo), unitTarget);
damage += int32(ap * 0.15f) + int32(holy * 15 / 100);
}
// Hammer of the Righteous
else if (m_spellInfo->SpellFamilyFlags & UI64LIT(0x0004000000000000))
{

View file

@ -338,6 +338,7 @@ bool IsSingleFromSpellSpecificPerTargetPerCaster(SpellSpecific spellSpec1,SpellS
case SPELL_AURA:
case SPELL_STING:
case SPELL_CURSE:
case SPELL_ASPECT:
case SPELL_POSITIVE_SHOUT:
case SPELL_JUDGEMENT:
case SPELL_HAND:
@ -355,6 +356,7 @@ bool IsSingleFromSpellSpecificSpellRanksPerTarget(SpellSpecific spellSpec1,Spell
case SPELL_BLESSING:
case SPELL_AURA:
case SPELL_CURSE:
case SPELL_ASPECT:
case SPELL_HAND:
return spellSpec1==spellSpec2;
default:
@ -368,7 +370,6 @@ bool IsSingleFromSpellSpecificPerTarget(SpellSpecific spellSpec1,SpellSpecific s
switch(spellSpec1)
{
case SPELL_SEAL:
case SPELL_ASPECT:
case SPELL_TRACKER:
case SPELL_WARLOCK_ARMOR:
case SPELL_MAGE_ARMOR:
@ -428,10 +429,9 @@ bool IsPositiveTarget(uint32 targetA, uint32 targetB)
bool IsExplicitPositiveTarget(uint32 targetA)
{
// positive targets
// positive targets that in target selection code expect target in m_targers, so not that auto-select target by spell data by m_caster and etc
switch(targetA)
{
case TARGET_SELF:
case TARGET_SINGLE_FRIEND:
case TARGET_SINGLE_PARTY:
case TARGET_CHAIN_HEAL:
@ -447,7 +447,7 @@ bool IsExplicitPositiveTarget(uint32 targetA)
bool IsExplicitNegativeTarget(uint32 targetA)
{
// non-positive targets
// non-positive targets that in target selection code expect target in m_targers, so not that auto-select target by spell data by m_caster and etc
switch(targetA)
{
case TARGET_CHAIN_DAMAGE:
@ -862,25 +862,6 @@ void SpellMgr::LoadSpellTargetPositions()
sLog.outString( ">> Loaded %u spell teleport coordinates", count );
}
bool SpellMgr::IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const
{
// false for spellInfo == NULL
if (!spellInfo || !mod)
return false;
SpellEntry const *affect_spell = sSpellStore.LookupEntry(mod->spellId);
// False if affect_spell == NULL or spellFamily not equal
if (!affect_spell || affect_spell->SpellFamilyName != spellInfo->SpellFamilyName)
return false;
// true
if (mod->mask & spellInfo->SpellFamilyFlags ||
mod->mask2 & spellInfo->SpellFamilyFlags2)
return true;
return false;
}
struct DoSpellProcEvent
{
DoSpellProcEvent(SpellProcEventEntry const& _spe) : spe(_spe) {}

View file

@ -732,8 +732,6 @@ class SpellMgr
// Accessors (const or static functions)
public:
bool IsAffectedByMod(SpellEntry const *spellInfo, SpellModifier *mod) const;
SpellElixirMap const& GetSpellElixirMap() const { return mSpellElixirs; }
uint32 GetSpellElixirMask(uint32 spellid) const

View file

@ -512,6 +512,7 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
setCurrentVictim(NULL);
setDirty(true);
}
iOwner->SendThreatRemove(hostileReference);
iThreatContainer.remove(hostileReference);
iUpdateNeed = true;
iThreatOfflineContainer.addReference(hostileReference);
@ -531,9 +532,9 @@ void ThreatManager::processThreatEvent(ThreatRefStatusChangeEvent* threatRefStat
setCurrentVictim(NULL);
setDirty(true);
}
iOwner->SendThreatRemove(hostileReference);
if(hostileReference->isOnline())
{
iOwner->SendThreatRemove(hostileReference);
iThreatContainer.remove(hostileReference);
iUpdateNeed = true;
}

View file

@ -197,7 +197,7 @@ void Unit::Update( uint32 p_time )
m_Events.Update( p_time );
_UpdateSpells( p_time );
CleanupDeletedAuars();
CleanupDeletedAuras();
if (m_lastManaUseTimer)
{
@ -6548,13 +6548,8 @@ bool Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura* triggeredByAu
}
// No thread generated mod
// TODO: exist special flag in spell attributes for this, need found and use!
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_THREAT;
mod->value = -100;
mod->type = SPELLMOD_PCT;
mod->spellId = dummySpell->Id;
mod->mask = UI64LIT(0x0000000000000003);
mod->mask2= UI64LIT(0x0);
SpellModifier *mod = new SpellModifier(SPELLMOD_THREAT,SPELLMOD_PCT,-100,triggeredByAura);
((Player*)this)->AddSpellMod(mod, true);
// Remove cooldown (Chain Lightning - have Category Recovery time)
@ -11422,7 +11417,7 @@ void Unit::RemoveFromWorld()
RemoveGuardians();
RemoveAllGameObjects();
RemoveAllDynObjects();
CleanupDeletedAuars();
CleanupDeletedAuras();
}
Object::RemoveFromWorld();
@ -12809,13 +12804,7 @@ bool Unit::HandleMendingAuraProc( Aura* triggeredByAura )
if(Player* target = ((Player*)this)->GetNextRandomRaidMember(radius))
{
// aura will applied from caster, but spell casted from current aura holder
SpellModifier *mod = new SpellModifier;
mod->op = SPELLMOD_CHARGES;
mod->value = jumps-5; // negative
mod->type = SPELLMOD_FLAT;
mod->spellId = spellProto->Id;
mod->mask = spellProto->SpellFamilyFlags;
mod->mask2 = spellProto->SpellFamilyFlags2;
SpellModifier *mod = new SpellModifier(SPELLMOD_CHARGES,SPELLMOD_FLAT,jumps-5,spellProto->Id,spellProto->SpellFamilyFlags,spellProto->SpellFamilyFlags2);
// remove before apply next (locked against deleted)
triggeredByAura->SetInUse(true);
@ -13067,7 +13056,7 @@ void Unit::StopAttackFaction(uint32 faction_id)
guardian->StopAttackFaction(faction_id);
}
void Unit::CleanupDeletedAuars()
void Unit::CleanupDeletedAuras()
{
// really delete auras "deleted" while processing its ApplyModify code
for(AuraList::const_iterator itr = m_deletedAuras.begin(); itr != m_deletedAuras.end(); ++itr)

View file

@ -1624,7 +1624,7 @@ class MANGOS_DLL_SPEC Unit : public WorldObject
uint32 m_lastManaUseTimer;
private:
void CleanupDeletedAuars();
void CleanupDeletedAuras();
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, Aura* triggredByAura, SpellEntry const *procSpell, uint32 procFlag, uint32 procEx, uint32 cooldown);

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9035"
#define REVISION_NR "9044"
#endif // __REVISION_NR_H__