aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorclick <none@none>2010-12-25 04:03:04 +0100
committerclick <none@none>2010-12-25 04:03:04 +0100
commit088ed9404b14c264ef1e5a06a094ade3f8350292 (patch)
tree236d1dda91b47c038241f8dadc9ea98890759de4 /src
parentd587948a0fc607ddb68403d6617fc498b14cef66 (diff)
Core/Entities: Fix a minor disrepancy in the handling of weapon specializations introduced in revision a83f26ef71 - patch by Dr.Tenma
Fixes issue 5059. Fixes issue 5265. --HG-- branch : trunk
Diffstat (limited to 'src')
-rwxr-xr-xsrc/server/game/Entities/Player/Player.cpp8
-rwxr-xr-xsrc/server/game/Entities/Player/Player.h2
-rwxr-xr-xsrc/server/game/Entities/Unit/Unit.cpp61
-rwxr-xr-xsrc/server/game/Miscellaneous/SharedDefines.h2
-rwxr-xr-xsrc/server/game/Spells/Spell.cpp2
5 files changed, 50 insertions, 25 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 4404ea15bc2..ae1f8dcde09 100755
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -21681,7 +21681,7 @@ OutdoorPvP * Player::GetOutdoorPvP() const
return sOutdoorPvPMgr->GetOutdoorPvPToZoneId(GetZoneId());
}
-bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem)
+bool Player::HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item const* ignoreItem)
{
if (spellInfo->EquippedItemClass < 0)
return true;
@@ -21719,7 +21719,7 @@ bool Player::HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item cons
break;
}
default:
- sLog->outError("HasItemFitToSpellReqirements: Not handled spell requirement for item class %u",spellInfo->EquippedItemClass);
+ sLog->outError("HasItemFitToSpellRequirements: Not handled spell requirement for item class %u",spellInfo->EquippedItemClass);
break;
}
@@ -21759,7 +21759,7 @@ void Player::RemoveItemDependentAurasAndCasts(Item * pItem)
}
// skip if not item dependent or have alternative item
- if (HasItemFitToSpellReqirements(spellInfo,pItem))
+ if (HasItemFitToSpellRequirements(spellInfo,pItem))
{
++itr;
continue;
@@ -21772,7 +21772,7 @@ void Player::RemoveItemDependentAurasAndCasts(Item * pItem)
// currently casted spells can be dependent from item
for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i)))
- if (spell->getState() != SPELL_STATE_DELAYED && !HasItemFitToSpellReqirements(spell->m_spellInfo,pItem))
+ if (spell->getState() != SPELL_STATE_DELAYED && !HasItemFitToSpellRequirements(spell->m_spellInfo,pItem))
InterruptSpell(CurrentSpellTypes(i));
}
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index 5cec55fcfe5..aa1d92e4184 100755
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1155,7 +1155,7 @@ class Player : public Unit, public GridObject<Player>
uint8 GetBankBagSlotCount() const { return GetByteValue(PLAYER_BYTES_2, 2); }
void SetBankBagSlotCount(uint8 count) { SetByteValue(PLAYER_BYTES_2, 2, count); }
bool HasItemCount(uint32 item, uint32 count, bool inBankAlso = false) const;
- bool HasItemFitToSpellReqirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
+ bool HasItemFitToSpellRequirements(SpellEntry const* spellInfo, Item const* ignoreItem = NULL);
bool CanNoReagentCast(SpellEntry const* spellInfo) const;
bool HasItemOrGemWithIdEquipped(uint32 item, uint32 count, uint8 except_slot = NULL_SLOT) const;
bool HasItemOrGemWithLimitCategoryEquipped(uint32 limitCategory, uint32 count, uint8 except_slot = NULL_SLOT) const;
diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
index 63aaa6b0669..a862b0f03f0 100755
--- a/src/server/game/Entities/Unit/Unit.cpp
+++ b/src/server/game/Entities/Unit/Unit.cpp
@@ -10327,9 +10327,18 @@ uint32 Unit::SpellDamageBonus(Unit *pVictim, SpellEntry const *spellProto, uint3
AuraEffectList const &mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
- if (((*i)->GetSpellProto()->EquippedItemClass == -1) ||
- (((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass) &&
- ((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask)))
+ if ((*i)->GetSpellProto()->EquippedItemClass == -1)
+ {
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ }
+ else if (!((*i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
+ {
+ if ((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass)
+ if (((*i)->GetSpellProto()->EquippedItemSubClassMask == 0) ||
+ ((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ }
+ else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellProto()))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
@@ -11620,27 +11629,43 @@ void Unit::MeleeDamageBonus(Unit *pVictim, uint32 *pdamage, WeaponAttackType att
for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
if (spellProto)
{
- if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
- if (((*i)->GetSpellProto()->EquippedItemClass == -1) ||
- ((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass) &&
- ((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
- AddPctN(DoneTotalMod, (*i)->GetAmount());
+ AuraEffectList const &mModDamagePercentDone = GetAuraEffectsByType(SPELL_AURA_MOD_DAMAGE_PERCENT_DONE);
+ for (AuraEffectList::const_iterator i = mModDamagePercentDone.begin(); i != mModDamagePercentDone.end(); ++i)
+ if ((*i)->GetMiscValue() & GetSpellSchoolMask(spellProto))
+ if ((*i)->GetSpellProto()->EquippedItemClass == -1)
+ {
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ }
+ else if (!((*i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
+ {
+ if ((*i)->GetSpellProto()->EquippedItemClass & spellProto->EquippedItemClass)
+ if (((*i)->GetSpellProto()->EquippedItemSubClassMask == 0) ||
+ ((*i)->GetSpellProto()->EquippedItemSubClassMask & spellProto->EquippedItemSubClassMask))
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ }
+ else if (ToPlayer() && ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellProto()))
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
}
else if (ToPlayer())
{
- EquipmentSlots slot;
-
- switch (attType)
+ if (!((*i)->GetSpellProto()->AttributesEx5 & SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK))
{
- case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
- case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
- case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
- default: return;
- }
+ EquipmentSlots slot;
- Item * item = ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
+ switch (attType)
+ {
+ case BASE_ATTACK: slot = EQUIPMENT_SLOT_MAINHAND; break;
+ case OFF_ATTACK: slot = EQUIPMENT_SLOT_OFFHAND; break;
+ case RANGED_ATTACK: slot = EQUIPMENT_SLOT_RANGED; break;
+ default: return;
+ }
+
+ Item * item = ToPlayer()->GetItemByPos(INVENTORY_SLOT_BAG_0, slot);
- if (item && !item->IsBroken() && item->IsFitToSpellRequirements((*i)->GetSpellProto()))
+ if (item && !item->IsBroken() && item->IsFitToSpellRequirements((*i)->GetSpellProto()))
+ AddPctN(DoneTotalMod, (*i)->GetAmount());
+ }
+ else if (ToPlayer()->HasItemFitToSpellRequirements((*i)->GetSpellProto()))
AddPctN(DoneTotalMod, (*i)->GetAmount());
}
diff --git a/src/server/game/Miscellaneous/SharedDefines.h b/src/server/game/Miscellaneous/SharedDefines.h
index 2cfd5a919ab..8fead151c83 100755
--- a/src/server/game/Miscellaneous/SharedDefines.h
+++ b/src/server/game/Miscellaneous/SharedDefines.h
@@ -459,7 +459,7 @@ enum SpellAttr5
SPELL_ATTR5_UNK13 = 0x00002000, // 13
SPELL_ATTR5_UNK14 = 0x00004000, // 14
SPELL_ATTR5_UNK15 = 0x00008000, // 15
- SPELL_ATTR5_UNK16 = 0x00010000, // 16
+ SPELL_ATTR5_SPECIAL_ITEM_CLASS_CHECK = 0x00010000, // 16 this allows spells with EquippedItemClass to affect spells from other items if the required item is equipped
SPELL_ATTR5_USABLE_WHILE_FEARED = 0x00020000, // 17 usable while feared
SPELL_ATTR5_USABLE_WHILE_CONFUSED = 0x00040000, // 18 usable while confused
SPELL_ATTR5_UNK19 = 0x00080000, // 19
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
index 235b052c0b7..9e5cef5b740 100755
--- a/src/server/game/Spells/Spell.cpp
+++ b/src/server/game/Spells/Spell.cpp
@@ -6029,7 +6029,7 @@ SpellCastResult Spell::CheckItems()
// if not item target then required item must be equipped
else
{
- if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellReqirements(m_spellInfo))
+ if (m_caster->GetTypeId() == TYPEID_PLAYER && !m_caster->ToPlayer()->HasItemFitToSpellRequirements(m_spellInfo))
return SPELL_FAILED_EQUIPPED_ITEM_CLASS;
}