Merge branch 'master' of git://github.com/TrinityCore/TrinityCore

This commit is contained in:
kaelima
2011-09-05 14:54:41 +02:00
6 changed files with 94 additions and 102 deletions
+1 -5
View File
@@ -12093,11 +12093,7 @@ Item* Player::EquipItem(uint16 pos, Item *pItem, bool update)
if (pProto && isInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0) if (pProto && isInCombat() && (pProto->Class == ITEM_CLASS_WEAPON || pProto->InventoryType == INVTYPE_RELIC) && m_weaponChangeTimer == 0)
{ {
uint32 cooldownSpell = 6119; uint32 cooldownSpell = getClass() == CLASS_ROGUE ? 6123 : 6119;
if (getClass() == CLASS_ROGUE)
cooldownSpell = 6123;
SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell); SpellInfo const* spellProto = sSpellMgr->GetSpellInfo(cooldownSpell);
if (!spellProto) if (!spellProto)
+20 -21
View File
@@ -791,7 +791,7 @@ uint32 Unit::DealDamage(Unit* victim, uint32 damage, CleanDamage const* cleanDam
victim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, spellProto ? spellProto->Id : 0); victim->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_DIRECT_DAMAGE, spellProto ? spellProto->Id : 0);
if (victim->GetTypeId() != TYPEID_PLAYER) if (victim->GetTypeId() != TYPEID_PLAYER)
victim->AddThreat(this, (float)damage, damageSchoolMask, spellProto); victim->AddThreat(this, float(damage), damageSchoolMask, spellProto);
else // victim is a player else // victim is a player
{ {
// random durability for items (HIT TAKEN) // random durability for items (HIT TAKEN)
@@ -897,7 +897,7 @@ void Unit::CastSpell(Unit* victim, SpellInfo const *spellInfo, bool triggered, I
CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster); CastSpell(victim, spellInfo, triggered ? TRIGGERED_FULL_MASK : TRIGGERED_NONE, castItem, triggeredByAura, originalCaster);
} }
void Unit::CastSpell(Unit* Victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) void Unit::CastSpell(Unit* victim, SpellInfo const* spellInfo, TriggerCastFlags triggerFlags, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{ {
if (!spellInfo) if (!spellInfo)
{ {
@@ -910,7 +910,7 @@ void Unit::CastSpell(Unit* Victim, SpellInfo const* spellInfo, TriggerCastFlags
originalCaster=owner->GetGUID(); originalCaster=owner->GetGUID();
SpellCastTargets targets; SpellCastTargets targets;
targets.SetUnitTarget(Victim); targets.SetUnitTarget(victim);
if (castItem) if (castItem)
sLog->outStaticDebug("WORLD: cast Item spellId - %i", spellInfo->Id); sLog->outStaticDebug("WORLD: cast Item spellId - %i", spellInfo->Id);
@@ -943,7 +943,7 @@ void Unit::CastCustomSpell(uint32 spellId, SpellValueMod mod, int32 value, Unit*
CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster); CastCustomSpell(spellId, values, target, triggered, castItem, triggeredByAura, originalCaster);
} }
void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* Victim, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster) void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit* victim, bool triggered, Item* castItem, AuraEffect const* triggeredByAura, uint64 originalCaster)
{ {
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
if (!spellInfo) if (!spellInfo)
@@ -953,7 +953,7 @@ void Unit::CastCustomSpell(uint32 spellId, CustomSpellValues const& value, Unit*
} }
SpellCastTargets targets; SpellCastTargets targets;
targets.SetUnitTarget(Victim); targets.SetUnitTarget(victim);
if (!originalCaster && triggeredByAura) if (!originalCaster && triggeredByAura)
originalCaster = triggeredByAura->GetCasterGUID(); originalCaster = triggeredByAura->GetCasterGUID();
@@ -2303,7 +2303,7 @@ int32 Unit::GetMechanicResistChance(const SpellInfo *spell)
int32 resist_mech = 0; int32 resist_mech = 0;
for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff) for (uint8 eff = 0; eff < MAX_SPELL_EFFECTS; ++eff)
{ {
if (spell->Effects[eff].Effect == 0) if (!spell->Effects[eff].IsEffect())
break; break;
int32 effect_mech = spell->GetEffectMechanic(eff); int32 effect_mech = spell->GetEffectMechanic(eff);
if (effect_mech) if (effect_mech)
@@ -5741,20 +5741,17 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
{ {
switch (dummySpell->Id) switch (dummySpell->Id)
{ {
case 11119: basepoints0 = int32(0.08f * damage); break; case 11119: basepoints0 = int32(0.04f * damage); break;
case 11120: basepoints0 = int32(0.16f * damage); break; case 11120: basepoints0 = int32(0.08f * damage); break;
case 12846: basepoints0 = int32(0.24f * damage); break; case 12846: basepoints0 = int32(0.12f * damage); break;
case 12847: basepoints0 = int32(0.32f * damage); break; case 12847: basepoints0 = int32(0.16f * damage); break;
case 12848: basepoints0 = int32(0.40f * damage); break; case 12848: basepoints0 = int32(0.20f * damage); break;
default: default:
sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id); sLog->outError("Unit::HandleDummyAuraProc: non handled spell id: %u (IG)", dummySpell->Id);
return false; return false;
} }
// 2 damage tick
basepoints0 /= 2;
triggered_spell_id = 12654; triggered_spell_id = 12654;
// Add remaining ticks to damage done
basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE); basepoints0 += victim->GetRemainingPeriodicAmount(GetGUID(), triggered_spell_id, SPELL_AURA_PERIODIC_DAMAGE);
break; break;
} }
@@ -6592,19 +6589,18 @@ bool Unit::HandleDummyAuraProc(Unit* victim, uint32 damage, AuraEffect* triggere
switch (dummySpell->Id) switch (dummySpell->Id)
{ {
case 34477: // Misdirection
{
triggered_spell_id = 35079; // 4 sec buff on self
target = this;
return true;
}
case 57870: // Glyph of Mend Pet case 57870: // Glyph of Mend Pet
{ {
victim->CastSpell(victim, 57894, true, NULL, NULL, GetGUID()); victim->CastSpell(victim, 57894, true, NULL, NULL, GetGUID());
return true; return true;
} }
} }
// Misdirection
if (dummySpell->Id == 34477)
{
triggered_spell_id = 35079; // 4 sec buff on self
target = this;
break;
}
break; break;
} }
case SPELLFAMILY_PALADIN: case SPELLFAMILY_PALADIN:
@@ -8137,7 +8133,10 @@ bool Unit::HandleAuraProc(Unit* victim, uint32 damage, Aura* triggeredByAura, Sp
CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true); CastCustomSpell(this, 70845, &basepoints0, NULL, NULL, true);
break; break;
} }
default:
break;
} }
break;
} }
} }
return false; return false;
@@ -267,44 +267,44 @@ MessageDistDeliverer::Visit(PlayerMapType &m)
} }
} }
void void MessageDistDeliverer::Visit(CreatureMapType &m)
MessageDistDeliverer::Visit(CreatureMapType &m)
{ {
for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter) for (CreatureMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{ {
if (!iter->getSource()->InSamePhase(i_phaseMask)) Creature* target = iter->getSource();
if (!target->InSamePhase(i_phaseMask))
continue; continue;
if (iter->getSource()->GetExactDist2dSq(i_source) > i_distSq) if (target->GetExactDist2dSq(i_source) > i_distSq)
continue; continue;
// Send packet to all who are sharing the creature's vision // Send packet to all who are sharing the creature's vision
if (!iter->getSource()->GetSharedVisionList().empty()) if (!target->GetSharedVisionList().empty())
{ {
SharedVisionList::const_iterator i = iter->getSource()->GetSharedVisionList().begin(); SharedVisionList::const_iterator i = target->GetSharedVisionList().begin();
for (; i != iter->getSource()->GetSharedVisionList().end(); ++i) for (; i != target->GetSharedVisionList().end(); ++i)
if ((*i)->m_seer == iter->getSource()) if ((*i)->m_seer == target)
SendPacket(*i); SendPacket(*i);
} }
} }
} }
void void MessageDistDeliverer::Visit(DynamicObjectMapType &m)
MessageDistDeliverer::Visit(DynamicObjectMapType &m)
{ {
for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter) for (DynamicObjectMapType::iterator iter = m.begin(); iter != m.end(); ++iter)
{ {
if (!iter->getSource()->InSamePhase(i_phaseMask)) DynamicObject *target = iter->getSource();
if (!target->InSamePhase(i_phaseMask))
continue; continue;
if (iter->getSource()->GetExactDist2dSq(i_source) > i_distSq) if (target->GetExactDist2dSq(i_source) > i_distSq)
continue; continue;
if (IS_PLAYER_GUID(iter->getSource()->GetCasterGUID())) if (IS_PLAYER_GUID(target->GetCasterGUID()))
{ {
// Send packet back to the caster if the caster has vision of dynamic object // Send packet back to the caster if the caster has vision of dynamic object
Player* caster = (Player*)iter->getSource()->GetCaster(); Player* caster = (Player*)target->GetCaster();
if (caster && caster->m_seer == iter->getSource()) if (caster && caster->m_seer == target)
SendPacket(caster); SendPacket(caster);
} }
} }
@@ -1241,7 +1241,7 @@ enum Mechanics
(1<<MECHANIC_TURN)|(1<<MECHANIC_HORROR)|(1<<MECHANIC_DAZE)| \ (1<<MECHANIC_TURN)|(1<<MECHANIC_HORROR)|(1<<MECHANIC_DAZE)| \
(1<<MECHANIC_SAPPED)) (1<<MECHANIC_SAPPED))
// Spell dispell type // Spell dispel type
enum DispelType enum DispelType
{ {
DISPEL_NONE = 0, DISPEL_NONE = 0,
+13 -16
View File
@@ -949,10 +949,8 @@ void Spell::prepareDataForTriggerSystem(AuraEffect const* /*triggeredByAura*/)
} }
// Totem casts require spellfamilymask defined in spell_proc_event to proc // Totem casts require spellfamilymask defined in spell_proc_event to proc
if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isTotem() && m_caster->IsControlledByPlayer()) if (m_originalCaster && m_caster != m_originalCaster && m_caster->GetTypeId() == TYPEID_UNIT && m_caster->ToCreature()->isTotem() && m_caster->IsControlledByPlayer())
{
m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY; m_procEx |= PROC_EX_INTERNAL_REQ_FAMILY;
} }
}
void Spell::CleanupTargetList() void Spell::CleanupTargetList()
{ {
@@ -4289,10 +4287,11 @@ void Spell::TakePower()
if (m_CastItem || m_triggeredByAuraSpell) if (m_CastItem || m_triggeredByAuraSpell)
return; return;
Powers powerType = Powers(m_spellInfo->PowerType);
bool hit = true; bool hit = true;
if (m_caster->GetTypeId() == TYPEID_PLAYER) if (m_caster->GetTypeId() == TYPEID_PLAYER)
{ {
if (m_spellInfo->PowerType == POWER_RAGE || m_spellInfo->PowerType == POWER_ENERGY || m_spellInfo->PowerType == POWER_RUNE) if (powerType == POWER_RAGE || powerType == POWER_ENERGY || powerType == POWER_RUNE)
if (uint64 targetGUID = m_targets.GetUnitTargetGUID()) if (uint64 targetGUID = m_targets.GetUnitTargetGUID())
for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit) for (std::list<TargetInfo>::iterator ihit= m_UniqueTargetInfo.begin(); ihit != m_UniqueTargetInfo.end(); ++ihit)
if (ihit->targetGUID == targetGUID) if (ihit->targetGUID == targetGUID)
@@ -4309,8 +4308,6 @@ void Spell::TakePower()
} }
} }
Powers powerType = Powers(m_spellInfo->PowerType);
if (powerType == POWER_RUNE) if (powerType == POWER_RUNE)
{ {
TakeRunePower(hit); TakeRunePower(hit);
@@ -4321,15 +4318,15 @@ void Spell::TakePower()
return; return;
// health as power used // health as power used
if (m_spellInfo->PowerType == POWER_HEALTH) if (powerType == POWER_HEALTH)
{ {
m_caster->ModifyHealth(-(int32)m_powerCost); m_caster->ModifyHealth(-(int32)m_powerCost);
return; return;
} }
if (m_spellInfo->PowerType >= MAX_POWERS) if (powerType >= MAX_POWERS)
{ {
sLog->outError("Spell::TakePower: Unknown power type '%d'", m_spellInfo->PowerType); sLog->outError("Spell::TakePower: Unknown power type '%d'", powerType);
return; return;
} }
@@ -4489,11 +4486,15 @@ void Spell::TakeReagents()
if (m_caster->GetTypeId() != TYPEID_PLAYER) if (m_caster->GetTypeId() != TYPEID_PLAYER)
return; return;
ItemTemplate const* castItemTemplate = m_CastItem
? m_CastItem->GetTemplate()
: NULL;
// do not take reagents for these item casts // do not take reagents for these item casts
if (m_CastItem && m_CastItem->GetTemplate()->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST) if (castItemTemplate && castItemTemplate->Flags & ITEM_PROTO_FLAG_TRIGGERED_CAST)
return; return;
Player* p_caster = (Player*)m_caster; Player* p_caster = m_caster->ToPlayer();
if (p_caster->CanNoReagentCast(m_spellInfo)) if (p_caster->CanNoReagentCast(m_spellInfo))
return; return;
@@ -4506,16 +4507,13 @@ void Spell::TakeReagents()
uint32 itemcount = m_spellInfo->ReagentCount[x]; uint32 itemcount = m_spellInfo->ReagentCount[x];
// if CastItem is also spell reagent // if CastItem is also spell reagent
if (m_CastItem) if (castItemTemplate && castItemTemplate->ItemId == itemid)
{
ItemTemplate const *proto = m_CastItem->GetTemplate();
if (proto && proto->ItemId == itemid)
{ {
for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s) for (int s = 0; s < MAX_ITEM_PROTO_SPELLS; ++s)
{ {
// CastItem will be used up and does not count as reagent // CastItem will be used up and does not count as reagent
int32 charges = m_CastItem->GetSpellCharges(s); int32 charges = m_CastItem->GetSpellCharges(s);
if (proto->Spells[s].SpellCharges < 0 && abs(charges) < 2) if (castItemTemplate->Spells[s].SpellCharges < 0 && abs(charges) < 2)
{ {
++itemcount; ++itemcount;
break; break;
@@ -4524,7 +4522,6 @@ void Spell::TakeReagents()
m_CastItem = NULL; m_CastItem = NULL;
} }
}
// if GetItemTarget is also spell reagent // if GetItemTarget is also spell reagent
if (m_targets.GetItemTargetEntry() == itemid) if (m_targets.GetItemTargetEntry() == itemid)