Jump to content

[patch] EffectSummonChangeItem


Recommended Posts

Posted

EffectSummonChangeItem doesn't work.

Try it with

http://www.wowhead.com/?item=18609 <-> http://www.wowhead.com/?item=18608

or

http://de.wowhead.com/?item=17074 <-> http://de.wowhead.com/?item=17223

With this patch it works for all 5 items (incl http://www.wowhead.com/?item=30540) that uses this ability.

diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
index 4969f4d..ace5542 100644
--- a/src/game/SpellEffects.cpp
+++ b/src/game/SpellEffects.cpp
@@ -3093,11 +3102,12 @@ void Spell::EffectSummonChangeItem(uint32 i)
    else if( player->IsEquipmentPos ( pos ) )
    {
        uint16 dest;
+        player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true);
        uint8 msg = player->CanEquipItem( m_CastItem->GetSlot(), dest, pNewItem, true );
-        if( msg == EQUIP_ERR_OK )
+        if (( msg == EQUIP_ERR_OK ) ||
+            ( msg == EQUIP_ERR_CANT_DO_RIGHT_NOW ))
        {
-            player->DestroyItem(m_CastItem->GetBagSlot(), m_CastItem->GetSlot(),true);
-
+            if ( msg == EQUIP_ERR_CANT_DO_RIGHT_NOW ) dest = EQUIPMENT_SLOT_MAINHAND;
            // prevent crash at access and unexpected charges counting with item update queue corrupt
            if(m_CastItem==m_targets.getItemTarget())
                m_targets.setItemTarget(NULL);

The problem is that directly after DestroyItem(...) the function CanEquipItem(...) returns EQUIP_ERR_CANT_DO_RIGHT_NOW.

I know that using const EQUIPMENT_SLOT_MAINHAND isn't perfect but it works.

Perhaps someone can write a better version.

  • 3 weeks later...
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use