Jump to content

[Need Help] Mirror Image


Guest Thyros

Recommended Posts

Hello Community, i have ported the mirror image code from infinitycore to mangos, works not right, can anyone test this please, and me help to complete this?

So the mage mirror images

only irritating but brilliant

the mirror must makes 3 duplicates of the Player, taht works not right, and i need help to fix this spell.

here from Infinitycore: http://bitbucket.org/kane/infinitycore/changeset/ce5fde00e028/

and here from Trinitycore2: http://dev.trinitycore.org/trinitycore2/changeset/aaf54c52f352/

Original Author is QAston and Drahy.

commit 17dd1b73d9d89d4c87263edf6c3d941507b3a71d
Author: Thyros <Thyros@.(none)>
Date:   Fri Jul 24 18:24:01 2009 +0200

   - Mirror Image.

diff --git a/sql/uecore-fixes/Revision 213/213_mirror_image.sql b/sql/uecore-fixes/Revision 213/213_mirror_image.sql
new file mode 100644
index 0000000..07baab9
--- /dev/null
+++ b/sql/uecore-fixes/Revision 213/213_mirror_image.sql    
@@ -0,0 +1,5 @@
+DELETE FROM `spell_script_target` WHERE `entry` IN (58836);
+INSERT INTO `spell_script_target` VALUES
(58836, 1, 31216);
+
+UPDATE `creature_template` SET `ScriptName`='npc_mirror_image' WHERE `entry`=31216;
+UPDATE `creature_template` SET `spell1`=59638, `spell2` = 59637 WHERE `entry`=31216
diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
index 6309378..31bd98d 100644
--- a/src/game/Opcodes.cpp
+++ b/src/game/Opcodes.cpp
@@ -1051,7 +1051,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
    /*0x3FE*/ { "MSG_GUILD_BANK_MONEY_WITHDRAWN",               STATUS_LOGGEDIN, &WorldSession::HandleGuildBankMoneyWithdrawn   },
    /*0x3FF*/ { "MSG_GUILD_EVENT_LOG_QUERY",                    STATUS_LOGGEDIN, &WorldSession::HandleGuildEventLogQueryOpcode  },
    /*0x400*/ { "CMSG_MAELSTROM_RENAME_GUILD",                  STATUS_NEVER,    &WorldSession::Handle_NULL                     },
-    /*0x401*/ { "CMSG_GET_MIRRORIMAGE_DATA",                    STATUS_NEVER,    &WorldSession::Handle_NULL                     },
+    /*0x401*/ { "CMSG_GET_MIRRORIMAGE_DATA",                    STATUS_NEVER,    &WorldSession::HandleMirrrorImageDataRequest   },
    /*0x402*/ { "SMSG_MIRRORIMAGE_DATA",                        STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
    /*0x403*/ { "SMSG_FORCE_DISPLAY_UPDATE",                    STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
    /*0x404*/ { "SMSG_SPELL_CHANCE_RESIST_PUSHBACK",            STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index 1641796..05f9158 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -289,7 +289,7 @@ enum AuraType
    SPELL_AURA_COMPREHEND_LANGUAGE = 244,
    SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS = 245,
    SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL = 246,
-    SPELL_AURA_247 = 247,
+    SPELL_AURA_CLONE_CASTER = 247,
    SPELL_AURA_MOD_COMBAT_RESULT_CHANCE = 248,
    SPELL_AURA_CONVERT_RUNE = 249,
    SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250,
@@ -321,7 +321,7 @@ enum AuraType
    SPELL_AURA_276 = 276,                                   // Only "Test Mod Damage % Mechanic" spell, possible mod damage done
    SPELL_AURA_MOD_MAX_AFFECTED_TARGETS = 277,
    SPELL_AURA_MOD_DISARM_RANGED = 278,
-    SPELL_AURA_279 = 279,
+    SPELL_AURA_INITIALIZE_IMAGES = 279,
    SPELL_AURA_MOD_ARMOR_PENETRATION_PCT = 280,
    SPELL_AURA_MOD_HONOR_GAIN = 281,
    SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 50ffcf9..77bb76b 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -299,7 +299,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleComprehendLanguage,                        //244 Comprehend language
    &Aura::HandleNULL,                                      //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS
    &Aura::HandleNoImmediateEffect,                         //246 SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL
-    &Aura::HandleNULL,                                      //247 target to become a clone of the caster
+    &Aura::HandleAuraCloneCaster,                           //247 SPELL_AURA_CLONE_CASTER
    &Aura::HandleNoImmediateEffect,                         //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE         implemented in Unit::RollMeleeOutcomeAgainst
    &Aura::HandleAuraConvertRune,                           //249 SPELL_AURA_CONVERT_RUNE
    &Aura::HandleAuraModIncreaseHealth,                     //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
@@ -331,7 +331,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleNULL,                                      //276 mod damage % mechanic?
    &Aura::HandleNoImmediateEffect,                         //277 SPELL_AURA_MOD_MAX_AFFECTED_TARGETS Use SpellClassMask for spell select
    &Aura::HandleNULL,                                      //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon
-    &Aura::HandleNULL,                                      //279 visual effects? 58836 and 57507
+    &Aura::HandleAuraInitializeImages,                      //279 SPELL_AURA_INITIALIZE_IMAGES
    &Aura::HandleModArmorPenetrationPct,                    //280 SPELL_AURA_MOD_ARMOR_PENETRATION_PCT
    &Aura::HandleNULL,                                      //281 SPELL_AURA_MOD_HONOR_GAIN
    &Aura::HandleAuraIncreaseBaseHealthPercent,             //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
@@ -7999,3 +7999,42 @@ bool Aura::IsCritFromAbilityAura(Unit* caster, uint32& damage)
    }
    return false;
}
+
+void Aura::HandleAuraInitializeImages(bool Apply, bool Real)
+{
+    if (!Real || !Apply)
+        return;
+
+    Unit* caster = GetCaster();
+    if (!caster)
+        return;
+
+    // Set item visual
+    if (caster->GetTypeId()== TYPEID_PLAYER)
+    {
+        if (Item const* item = ((Player *)caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
+            m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, item->GetProto()->ItemId);
+        if (Item const* item = ((Player *)caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
+            m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, item->GetProto()->ItemId);
+    }
+    else
+    {
+        m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
+        m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
+        m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
+    }
+}
+
+void Aura::HandleAuraCloneCaster(bool Apply, bool Real)
+{
+    if (!Real || !Apply)
+        return;
+
+    Unit * caster = GetCaster();
+    if (!caster)
+        return;
+
+    // Set item visual
+    m_target->SetDisplayId(caster->GetDisplayId());
+    m_target->SetUInt32Value(UNIT_FIELD_FLAGS_2, 2064);
+}
\\ No newline at end of file
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 061373f..6382570 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -57,18 +57,9 @@ class MANGOS_DLL_SPEC Aura

    public:
        //aura handlers
-        void HandleNULL(bool, bool)
-        {
-            // NOT IMPLEMENTED
-        }
-        void HandleUnused(bool, bool)
-        {
-            // NOT USED BY ANY SPELL OR USELESS
-        }
-        void HandleNoImmediateEffect(bool, bool)
-        {
-            // aura not have immediate effect at add/remove and handled by ID in other code place
-        }
+        void HandleNULL(bool, bool) { /* Not implemented. */ }
+        void HandleUnused(bool, bool) { /* Not used or useless. */ }
+        void HandleNoImmediateEffect(bool, bool) { /* Aura does not have immediate effect at add/remove and handled by ID in other place. */ }
        void HandleBindSight(bool Apply, bool Real);
        void HandleModPossess(bool Apply, bool Real);
        void HandlePeriodicDamage(bool Apply, bool Real);
@@ -213,6 +204,8 @@ class MANGOS_DLL_SPEC Aura
        void HandleNoReagentUseAura(bool Apply, bool Real);
        void HandlePhase(bool Apply, bool Real);
        void HandleAllowOnlyAbility(bool Apply, bool Real);
+        void HandleAuraInitializeImages(bool Apply, bool Real);
+        void HandleAuraCloneCaster(bool Apply, bool Real);

        virtual ~Aura();

diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 82c6123..7e7167e 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -612,3 +612,82 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
        }
    }
}
+
+void WorldSession::HandleMirrrorImageDataRequest( WorldPacket & recv_data )
+{
+    sLog.outDebug("WORLD: CMSG_GET_MIRRORIMAGE_DATA");
+    CHECK_PACKET_SIZE(recv_data, 8);
+    uint64 guid;
+    recv_data >> guid;
+
+    // Get unit for which data is needed by client
+    Unit *unit = ObjectAccessor::GetObjectInWorld(guid, (Unit*)NULL);
+    if (!unit)
+        return;
+
+    // Get creator of the unit
+    Unit *creator = ObjectAccessor::GetObjectInWorld(unit->GetCreatorGUID(), (Unit*)NULL);
+    if (!creator)
+        return;
+
+    WorldPacket data(SMSG_MIRRORIMAGE_DATA, 68);
+    data << (uint64)guid;
+    data << (uint32)creator->GetDisplayId();
+    if (creator->GetTypeId() == TYPEID_PLAYER)
+    {
+        Player* pCreator = (Player *)creator;
+        data << (uint8)pCreator->getRace();                         // race
+        data << (uint8)pCreator->getGender();                       // gender
+        data << (uint8)pCreator->getClass();                        // class
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 0);     // skin
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 1);     // face
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 2);     // hair
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 3);     // haircolor
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES_2, 0);   // facialhair
+
+        data << (uint32)0;                                          // unknown
+
+        static const EquipmentSlots ItemSlots[] = 
+        {
+            EQUIPMENT_SLOT_HEAD,
+            EQUIPMENT_SLOT_SHOULDERS,
+            EQUIPMENT_SLOT_BODY,
+            EQUIPMENT_SLOT_CHEST,
+            EQUIPMENT_SLOT_WAIST,
+            EQUIPMENT_SLOT_LEGS,
+            EQUIPMENT_SLOT_FEET,
+            EQUIPMENT_SLOT_WRISTS,
+            EQUIPMENT_SLOT_HANDS,
+            EQUIPMENT_SLOT_BACK,
+            EQUIPMENT_SLOT_TABARD,
+            EQUIPMENT_SLOT_END
+        };
+
+        // Display items in visible slots
+        for (EquipmentSlots const* itr = &ItemSlots[0]; *itr != EQUIPMENT_SLOT_END; ++itr)
+            if (Item const* item =  pCreator->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
+                data << (uint32)item->GetProto()->DisplayInfoID;    // display id
+            else
+                data << (uint32)0;                                  // no item found, so no id
+    }
+    else
+    {
+        // Skip player data for creatures
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+    }
+
+    SendPacket( &data );
+}
\\ No newline at end of file
diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
index 69bcb1d..052eaf2 100644
--- a/src/game/WorldSession.h
+++ b/src/game/WorldSession.h
@@ -713,6 +713,7 @@ class MANGOS_DLL_SPEC WorldSession
        void HandleCalendarGetNumPending(WorldPacket& recv_data);

        void HandleSpellClick(WorldPacket& recv_data);
+        void HandleMirrrorImageDataRequest(WorldPacket & recv_data);
        void HandleAlterAppearance(WorldPacket& recv_data);
        void HandleRemoveGlyph(WorldPacket& recv_data);
        void HandleCharCustomize(WorldPacket& recv_data);

SD2:

i'm not sure of is needed this code.

Index: scripts/npc/npcs_special.cpp
===================================================================
--- scripts/npc/npcs_special.cpp    (revision 1262)
+++ scripts/npc/npcs_special.cpp    (working copy)
@@ -1288,7 +1288,33 @@
    }
    return true;
}
+/* Need more Review!
+struct MANGOS_DLL_DECL npc_mirror_image : public ScriptedAI
+{
+    npc_mirror_image(Creature* pCreature) : ScriptedAI(pCreature) {}
+    Unit * owner;
+    void Reset()
+    {
+        if (m_creature->isSummon())
+            owner = ((Summon*)m_creature)->GetOwner();
+        if (!owner)
+            return;
+        m_creature->SetDisplayId(owner->GetDisplayId());
+        owner->SetLevel(owner->getLevel());
+        // Inherit Master's Threat List (not yet implemented)
+        owner->CastSpell((Unit*)NULL, 58838, true);
+        // here mirror image casts on summoner spell (not present in client dbc) 49866
+        // here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?)
+        // Clone Me!
+        owner->CastSpell(m_creature, 45204, false);
+    }
+};

+CreatureAI* GetAI_npc_mirror_image(Creature* pCreature)
+{
+    return new npc_mirror_image(pCreature);
+}
+*/
void AddSC_npcs_special()
{
    Script *newscript;
@@ -1354,4 +1380,9 @@
    newscript->pGossipHello = &GossipHello_npc_sayge;
    newscript->pGossipSelect = &GossipSelect_npc_sayge;
    newscript->RegisterSelf();
+
+    /*newscript = new Script;
+    newscript->Name = "npc_mirror_image";
+    newscript->GetAI = &GetAI_npc_mirror_image;
+    newscript->RegisterSelf();*/
}

Thanks in Advance.

Link to comment
Share on other sites

  • 2 weeks later...
Hello Community, i have ported the mirror image code from infinitycore to mangos, works not right, can anyone test this please, and me help to complete this?

So the mage mirror images

only irritating but brilliant

the mirror must makes 3 duplicates of the Player, taht works not right, and i need help to fix this spell.

here from Infinitycore: http://bitbucket.org/kane/infinitycore/changeset/ce5fde00e028/

and here from Trinitycore2: http://dev.trinitycore.org/trinitycore2/changeset/aaf54c52f352/

Original Author is QAston and Drahy.

commit 17dd1b73d9d89d4c87263edf6c3d941507b3a71d
Author: Thyros <Thyros@.(none)>
Date:   Fri Jul 24 18:24:01 2009 +0200

   - Mirror Image.

diff --git a/sql/uecore-fixes/Revision 213/213_mirror_image.sql b/sql/uecore-fixes/Revision 213/213_mirror_image.sql
new file mode 100644
index 0000000..07baab9
--- /dev/null
+++ b/sql/uecore-fixes/Revision 213/213_mirror_image.sql    
@@ -0,0 +1,5 @@
+DELETE FROM `spell_script_target` WHERE `entry` IN (58836);
+INSERT INTO `spell_script_target` VALUES
(58836, 1, 31216);
+
+UPDATE `creature_template` SET `ScriptName`='npc_mirror_image' WHERE `entry`=31216;
+UPDATE `creature_template` SET `spell1`=59638, `spell2` = 59637 WHERE `entry`=31216
diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
index 6309378..31bd98d 100644
--- a/src/game/Opcodes.cpp
+++ b/src/game/Opcodes.cpp
@@ -1051,7 +1051,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
    /*0x3FE*/ { "MSG_GUILD_BANK_MONEY_WITHDRAWN",               STATUS_LOGGEDIN, &WorldSession::HandleGuildBankMoneyWithdrawn   },
    /*0x3FF*/ { "MSG_GUILD_EVENT_LOG_QUERY",                    STATUS_LOGGEDIN, &WorldSession::HandleGuildEventLogQueryOpcode  },
    /*0x400*/ { "CMSG_MAELSTROM_RENAME_GUILD",                  STATUS_NEVER,    &WorldSession::Handle_NULL                     },
-    /*0x401*/ { "CMSG_GET_MIRRORIMAGE_DATA",                    STATUS_NEVER,    &WorldSession::Handle_NULL                     },
+    /*0x401*/ { "CMSG_GET_MIRRORIMAGE_DATA",                    STATUS_NEVER,    &WorldSession::HandleMirrrorImageDataRequest   },
    /*0x402*/ { "SMSG_MIRRORIMAGE_DATA",                        STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
    /*0x403*/ { "SMSG_FORCE_DISPLAY_UPDATE",                    STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
    /*0x404*/ { "SMSG_SPELL_CHANCE_RESIST_PUSHBACK",            STATUS_NEVER,    &WorldSession::Handle_ServerSide               },
diff --git a/src/game/SpellAuraDefines.h b/src/game/SpellAuraDefines.h
index 1641796..05f9158 100644
--- a/src/game/SpellAuraDefines.h
+++ b/src/game/SpellAuraDefines.h
@@ -289,7 +289,7 @@ enum AuraType
    SPELL_AURA_COMPREHEND_LANGUAGE = 244,
    SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS = 245,
    SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL = 246,
-    SPELL_AURA_247 = 247,
+    SPELL_AURA_CLONE_CASTER = 247,
    SPELL_AURA_MOD_COMBAT_RESULT_CHANCE = 248,
    SPELL_AURA_CONVERT_RUNE = 249,
    SPELL_AURA_MOD_INCREASE_HEALTH_2 = 250,
@@ -321,7 +321,7 @@ enum AuraType
    SPELL_AURA_276 = 276,                                   // Only "Test Mod Damage % Mechanic" spell, possible mod damage done
    SPELL_AURA_MOD_MAX_AFFECTED_TARGETS = 277,
    SPELL_AURA_MOD_DISARM_RANGED = 278,
-    SPELL_AURA_279 = 279,
+    SPELL_AURA_INITIALIZE_IMAGES = 279,
    SPELL_AURA_MOD_ARMOR_PENETRATION_PCT = 280,
    SPELL_AURA_MOD_HONOR_GAIN = 281,
    SPELL_AURA_MOD_BASE_HEALTH_PCT = 282,
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 50ffcf9..77bb76b 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -299,7 +299,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleComprehendLanguage,                        //244 Comprehend language
    &Aura::HandleNULL,                                      //245 SPELL_AURA_MOD_DURATION_OF_MAGIC_EFFECTS
    &Aura::HandleNoImmediateEffect,                         //246 SPELL_AURA_MOD_DURATION_OF_EFFECTS_BY_DISPEL
-    &Aura::HandleNULL,                                      //247 target to become a clone of the caster
+    &Aura::HandleAuraCloneCaster,                           //247 SPELL_AURA_CLONE_CASTER
    &Aura::HandleNoImmediateEffect,                         //248 SPELL_AURA_MOD_COMBAT_RESULT_CHANCE         implemented in Unit::RollMeleeOutcomeAgainst
    &Aura::HandleAuraConvertRune,                           //249 SPELL_AURA_CONVERT_RUNE
    &Aura::HandleAuraModIncreaseHealth,                     //250 SPELL_AURA_MOD_INCREASE_HEALTH_2
@@ -331,7 +331,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
    &Aura::HandleNULL,                                      //276 mod damage % mechanic?
    &Aura::HandleNoImmediateEffect,                         //277 SPELL_AURA_MOD_MAX_AFFECTED_TARGETS Use SpellClassMask for spell select
    &Aura::HandleNULL,                                      //278 SPELL_AURA_MOD_DISARM_RANGED disarm ranged weapon
-    &Aura::HandleNULL,                                      //279 visual effects? 58836 and 57507
+    &Aura::HandleAuraInitializeImages,                      //279 SPELL_AURA_INITIALIZE_IMAGES
    &Aura::HandleModArmorPenetrationPct,                    //280 SPELL_AURA_MOD_ARMOR_PENETRATION_PCT
    &Aura::HandleNULL,                                      //281 SPELL_AURA_MOD_HONOR_GAIN
    &Aura::HandleAuraIncreaseBaseHealthPercent,             //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
@@ -7999,3 +7999,42 @@ bool Aura::IsCritFromAbilityAura(Unit* caster, uint32& damage)
    }
    return false;
}
+
+void Aura::HandleAuraInitializeImages(bool Apply, bool Real)
+{
+    if (!Real || !Apply)
+        return;
+
+    Unit* caster = GetCaster();
+    if (!caster)
+        return;
+
+    // Set item visual
+    if (caster->GetTypeId()== TYPEID_PLAYER)
+    {
+        if (Item const* item = ((Player *)caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND))
+            m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, item->GetProto()->ItemId);
+        if (Item const* item = ((Player *)caster)->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND))
+            m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, item->GetProto()->ItemId);
+    }
+    else
+    {
+        m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID));
+        m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 1));
+        m_target->SetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2, caster->GetUInt32Value(UNIT_VIRTUAL_ITEM_SLOT_ID + 2));
+    }
+}
+
+void Aura::HandleAuraCloneCaster(bool Apply, bool Real)
+{
+    if (!Real || !Apply)
+        return;
+
+    Unit * caster = GetCaster();
+    if (!caster)
+        return;
+
+    // Set item visual
+    m_target->SetDisplayId(caster->GetDisplayId());
+    m_target->SetUInt32Value(UNIT_FIELD_FLAGS_2, 2064);
+}
\\ No newline at end of file
diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h
index 061373f..6382570 100644
--- a/src/game/SpellAuras.h
+++ b/src/game/SpellAuras.h
@@ -57,18 +57,9 @@ class MANGOS_DLL_SPEC Aura

    public:
        //aura handlers
-        void HandleNULL(bool, bool)
-        {
-            // NOT IMPLEMENTED
-        }
-        void HandleUnused(bool, bool)
-        {
-            // NOT USED BY ANY SPELL OR USELESS
-        }
-        void HandleNoImmediateEffect(bool, bool)
-        {
-            // aura not have immediate effect at add/remove and handled by ID in other code place
-        }
+        void HandleNULL(bool, bool) { /* Not implemented. */ }
+        void HandleUnused(bool, bool) { /* Not used or useless. */ }
+        void HandleNoImmediateEffect(bool, bool) { /* Aura does not have immediate effect at add/remove and handled by ID in other place. */ }
        void HandleBindSight(bool Apply, bool Real);
        void HandleModPossess(bool Apply, bool Real);
        void HandlePeriodicDamage(bool Apply, bool Real);
@@ -213,6 +204,8 @@ class MANGOS_DLL_SPEC Aura
        void HandleNoReagentUseAura(bool Apply, bool Real);
        void HandlePhase(bool Apply, bool Real);
        void HandleAllowOnlyAbility(bool Apply, bool Real);
+        void HandleAuraInitializeImages(bool Apply, bool Real);
+        void HandleAuraCloneCaster(bool Apply, bool Real);

        virtual ~Aura();

diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 82c6123..7e7167e 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -612,3 +612,82 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
        }
    }
}
+
+void WorldSession::HandleMirrrorImageDataRequest( WorldPacket & recv_data )
+{
+    sLog.outDebug("WORLD: CMSG_GET_MIRRORIMAGE_DATA");
+    CHECK_PACKET_SIZE(recv_data, 8);
+    uint64 guid;
+    recv_data >> guid;
+
+    // Get unit for which data is needed by client
+    Unit *unit = ObjectAccessor::GetObjectInWorld(guid, (Unit*)NULL);
+    if (!unit)
+        return;
+
+    // Get creator of the unit
+    Unit *creator = ObjectAccessor::GetObjectInWorld(unit->GetCreatorGUID(), (Unit*)NULL);
+    if (!creator)
+        return;
+
+    WorldPacket data(SMSG_MIRRORIMAGE_DATA, 68);
+    data << (uint64)guid;
+    data << (uint32)creator->GetDisplayId();
+    if (creator->GetTypeId() == TYPEID_PLAYER)
+    {
+        Player* pCreator = (Player *)creator;
+        data << (uint8)pCreator->getRace();                         // race
+        data << (uint8)pCreator->getGender();                       // gender
+        data << (uint8)pCreator->getClass();                        // class
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 0);     // skin
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 1);     // face
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 2);     // hair
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES, 3);     // haircolor
+        data << (uint8)pCreator->GetByteValue(PLAYER_BYTES_2, 0);   // facialhair
+
+        data << (uint32)0;                                          // unknown
+
+        static const EquipmentSlots ItemSlots[] = 
+        {
+            EQUIPMENT_SLOT_HEAD,
+            EQUIPMENT_SLOT_SHOULDERS,
+            EQUIPMENT_SLOT_BODY,
+            EQUIPMENT_SLOT_CHEST,
+            EQUIPMENT_SLOT_WAIST,
+            EQUIPMENT_SLOT_LEGS,
+            EQUIPMENT_SLOT_FEET,
+            EQUIPMENT_SLOT_WRISTS,
+            EQUIPMENT_SLOT_HANDS,
+            EQUIPMENT_SLOT_BACK,
+            EQUIPMENT_SLOT_TABARD,
+            EQUIPMENT_SLOT_END
+        };
+
+        // Display items in visible slots
+        for (EquipmentSlots const* itr = &ItemSlots[0]; *itr != EQUIPMENT_SLOT_END; ++itr)
+            if (Item const* item =  pCreator->GetItemByPos(INVENTORY_SLOT_BAG_0, *itr))
+                data << (uint32)item->GetProto()->DisplayInfoID;    // display id
+            else
+                data << (uint32)0;                                  // no item found, so no id
+    }
+    else
+    {
+        // Skip player data for creatures
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+        data << (uint32)0;
+    }
+
+    SendPacket( &data );
+}
\\ No newline at end of file
diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
index 69bcb1d..052eaf2 100644
--- a/src/game/WorldSession.h
+++ b/src/game/WorldSession.h
@@ -713,6 +713,7 @@ class MANGOS_DLL_SPEC WorldSession
        void HandleCalendarGetNumPending(WorldPacket& recv_data);

        void HandleSpellClick(WorldPacket& recv_data);
+        void HandleMirrrorImageDataRequest(WorldPacket & recv_data);
        void HandleAlterAppearance(WorldPacket& recv_data);
        void HandleRemoveGlyph(WorldPacket& recv_data);
        void HandleCharCustomize(WorldPacket& recv_data);

SD2:

i'm not sure of is needed this code.

Index: scripts/npc/npcs_special.cpp
===================================================================
--- scripts/npc/npcs_special.cpp    (revision 1262)
+++ scripts/npc/npcs_special.cpp    (working copy)
@@ -1288,7 +1288,33 @@
    }
    return true;
}
+/* Need more Review!
+struct MANGOS_DLL_DECL npc_mirror_image : public ScriptedAI
+{
+    npc_mirror_image(Creature* pCreature) : ScriptedAI(pCreature) {}
+    Unit * owner;
+    void Reset()
+    {
+        if (m_creature->isSummon())
+            owner = ((Summon*)m_creature)->GetOwner();
+        if (!owner)
+            return;
+        m_creature->SetDisplayId(owner->GetDisplayId());
+        owner->SetLevel(owner->getLevel());
+        // Inherit Master's Threat List (not yet implemented)
+        owner->CastSpell((Unit*)NULL, 58838, true);
+        // here mirror image casts on summoner spell (not present in client dbc) 49866
+        // here should be auras (not present in client dbc): 35657, 35658, 35659, 35660 selfcasted by mirror images (stats related?)
+        // Clone Me!
+        owner->CastSpell(m_creature, 45204, false);
+    }
+};

+CreatureAI* GetAI_npc_mirror_image(Creature* pCreature)
+{
+    return new npc_mirror_image(pCreature);
+}
+*/
void AddSC_npcs_special()
{
    Script *newscript;
@@ -1354,4 +1380,9 @@
    newscript->pGossipHello = &GossipHello_npc_sayge;
    newscript->pGossipSelect = &GossipSelect_npc_sayge;
    newscript->RegisterSelf();
+
+    /*newscript = new Script;
+    newscript->Name = "npc_mirror_image";
+    newscript->GetAI = &GetAI_npc_mirror_image;
+    newscript->RegisterSelf();*/
}

Thanks in Advance.

Spell clone not work.. :(

Link to comment
Share on other sites

  • 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