diff --git a/src/game/Player.cpp b/src/game/Player.cpp index bcb00b475..275f8a4bc 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -3577,12 +3577,14 @@ void Player::removeSpell(uint32 spell_id, bool disabled, bool learn_low_rank, bo } } - if (m_canTitanGrip) + if (CanTitanGrip()) { SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id); if (IsSpellHaveEffect(spellInfo, SPELL_EFFECT_TITAN_GRIP)) { - m_canTitanGrip = false; + SetCanTitanGrip(false); + // Remove Titan's Grip damage penalty now + RemoveAurasDueToSpell(49152); if(sWorld.getConfig(CONFIG_BOOL_OFFHAND_CHECK_AT_TALENTS_RESET)) AutoUnequipOffhandIfNeed(); } @@ -11047,6 +11049,9 @@ Item* Player::EquipItem( uint16 pos, Item *pItem, bool update ) return pItem2; } + // Apply Titan's Grip damage penalty if necessary + if ((slot == EQUIPMENT_SLOT_MAINHAND || slot == EQUIPMENT_SLOT_OFFHAND) && CanTitanGrip() && HasTwoHandWeaponInOneHand() && !HasAura(49152)) + CastSpell(this, 49152, true); // only for full equip instead adding to stack GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry()); @@ -11070,6 +11075,9 @@ void Player::QuickEquipItem( uint16 pos, Item *pItem) pItem->AddToWorld(); pItem->SendCreateUpdateToPlayer( this ); } + // Apply Titan's Grip damage penalty if necessary + if ((slot == EQUIPMENT_SLOT_MAINHAND || slot == EQUIPMENT_SLOT_OFFHAND) && CanTitanGrip() && HasTwoHandWeaponInOneHand() && !HasAura(49152)) + CastSpell(this, 49152, true); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_ITEM, pItem->GetEntry()); GetAchievementMgr().UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_EQUIP_EPIC_ITEM, slot+1); @@ -11179,7 +11187,12 @@ void Player::RemoveItem( uint8 bag, uint8 slot, bool update ) SetUInt64Value(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), 0); if ( slot < EQUIPMENT_SLOT_END ) + { SetVisibleItemSlot(slot, NULL); + // Remove Titan's Grip damage penalty if necessary + if ((slot == EQUIPMENT_SLOT_MAINHAND || slot == EQUIPMENT_SLOT_OFFHAND) && CanTitanGrip() && !HasTwoHandWeaponInOneHand()) + RemoveAurasDueToSpell(49152); + } } else { diff --git a/src/game/Player.h b/src/game/Player.h index ef51208d5..57d2e7614 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -1329,6 +1329,12 @@ class MANGOS_DLL_SPEC Player : public Unit Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); return mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON && !CanTitanGrip(); } + bool HasTwoHandWeaponInOneHand() const + { + Item* offItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + Item* mainItem = GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); + return offItem && ((mainItem && mainItem->GetProto()->InventoryType == INVTYPE_2HWEAPON) || offItem->GetProto()->InventoryType == INVTYPE_2HWEAPON); + } void SendNewItem( Item *item, uint32 count, bool received, bool created, bool broadcast = false ); bool BuyItemFromVendorSlot(uint64 vendorguid, uint32 vendorslot, uint32 item, uint8 count, uint8 bag, uint8 slot); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 68850d1e1..a9fb37d7c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -7825,10 +7825,18 @@ void Spell::EffectActivateRune(SpellEffectIndex eff_idx) } } -void Spell::EffectTitanGrip(SpellEffectIndex /*eff_idx*/) +void Spell::EffectTitanGrip(SpellEffectIndex eff_idx) { + // Make sure "Titan's Grip" (49152) penalty spell does not silently change + if (m_spellInfo->EffectMiscValue[eff_idx] != 49152) + sLog.outError("Spell::EffectTitanGrip: Spell %u has unexpected EffectMiscValue '%u'", m_spellInfo->Id, m_spellInfo->EffectMiscValue[eff_idx]); if (unitTarget && unitTarget->GetTypeId() == TYPEID_PLAYER) - ((Player*)unitTarget)->SetCanTitanGrip(true); + { + Player *plr = (Player*)m_caster; + plr->SetCanTitanGrip(true); + if (plr->HasTwoHandWeaponInOneHand() && !plr->HasAura(49152)) + plr->CastSpell(plr, 49152, true); + } } void Spell::EffectRenamePet(SpellEffectIndex /*eff_idx*/) diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 137354158..bbf0094fe 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10247" + #define REVISION_NR "10248" #endif // __REVISION_NR_H__