rendered paste bodyIndex: game/Player.cpp
===================================================================
--- game/Player.cpp (revision 5308)
+++ game/Player.cpp (working copy)
@@ -6031,7 +6031,7 @@
_ApplyAmmoBonuses();
if(apply)
- CastItemEquipSpell(item);
+ CastItemEquipSpell(item, false);
else
for (int i = 0; i < 5; i++)
if(proto->Spells[i].SpellId)
@@ -6386,7 +6386,7 @@
}
}
-void Player::CastItemEquipSpell(Item *item)
+void Player::CastItemEquipSpell(Item *item, bool Shapeshift)
{
if(!item) return;
@@ -6406,6 +6406,15 @@
if(spellData.SpellTrigger != ITEM_SPELLTRIGGER_ON_EQUIP)
continue;
+ // check if it is valid spell
+ SpellEntry const* spellproto = sSpellStore.LookupEntry(spellData.SpellId);
+ if(!spellproto)
+ continue;
+
+ // Shapeshift apply only spells with stance/form requirement
+ if (Shapeshift && !spellproto->Stances)
+ continue;
+
DEBUG_LOG("WORLD: cast Item spellId - %i", spellData.SpellId);
CastSpell(this,spellData.SpellId,true,item);
@@ -6579,7 +6588,7 @@
if(proto->ItemSet)
AddItemsSetItem(this,m_items[i]);
- CastItemEquipSpell(m_items[i]);
+ CastItemEquipSpell(m_items[i], false);
ApplyEnchantment(m_items[i], true);
}
@@ -15205,7 +15214,26 @@
break;
}
}
+ // apply auras in this form
+ for (int i = 0; i < INVENTORY_SLOT_BAG_END; i++)
+ if(m_items[i])
+ CastItemEquipSpell(m_items[i], true);
+ for(size_t x = 0; x < ItemSetEff.size(); x++)
+ {
+ if(ItemSetEff[x])
+ {
+ for ( uint32 y=0; y<8;++y)
+ {
+ if ( ItemSetEff[x]->spells[y] )
+ {
+ if(ItemSetEff[x]->spells[y] && ItemSetEff[x]->spells[y]->Stances)
+ CastSpell(this,ItemSetEff[x]->spells[y]->Id,true);
+ }
+ }
+ }
+ }
+
UpdateAttackPowerAndDamage();
UpdateAttackPowerAndDamage(true);
}
Index: game/Player.h
===================================================================
--- game/Player.h (revision 5308)
+++ game/Player.h (working copy)
@@ -1636,7 +1636,7 @@
void CorrectMetaGemEnchants(uint8 slot, bool apply);
void InitDataForForm();
- void CastItemEquipSpell(Item *item);
+ void CastItemEquipSpell(Item *item, bool Shapeshift);
void CastItemCombatSpell(Item *item,Unit* Target, WeaponAttackType attType);
void SendInitWorldStates();
Index: game/Spell.cpp
===================================================================
--- game/Spell.cpp (revision 5308)
+++ game/Spell.cpp (working copy)
@@ -2561,6 +2561,12 @@
return SPELL_FAILED_NOT_READY;
}
+ // Cannot be used in this stance/form
+ if (m_caster->GetTypeId()==TYPEID_PLAYER && m_spellInfo->Stances)
+ {
+ if (!(m_spellInfo->Stances & (1<<(((Player*)m_caster)->m_form-1))))
+ return SPELL_FAILED_DONT_REPORT;
+ }
// cancel autorepeat spells if cast start when moving
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
if( m_caster->GetTypeId()==TYPEID_PLAYER && ((Player*)m_caster)->isMoving() )