EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Development (https://www.eqemulator.org/forums/forumdisplay.php?f=590)
-   -   /melody (https://www.eqemulator.org/forums/showthread.php?t=26728)

Derision 11-09-2008 06:26 AM

/melody
 
I was looking at a packet collect from Live using /melody this morning, and the key reasons it doesn't work in EQEmu are:

1. The client wants an OP_MemoriseSpell sent to it before OP_Action/OP_Damage. This is what triggers it to 'cast' the next song.

2. The client sends a zero length OP_ManaChange packet between each song, which the server currently responds to with an OP_Interrupt spell.

The following 'hack' enables /melody

Code:

Index: mob.h
===================================================================
--- mob.h      (revision 188)
+++ mob.h      (working copy)
@@ -1158,6 +1158,7 @@
        bool    m_hasRune;
        bool    m_hasSpellRune;
        bool    m_hasDeathSaveChance;
+      void    StopSong();

 private:
        void    _StopSong();            //this is not what you think it is
Index: client_packet.cpp
===================================================================
--- client_packet.cpp  (revision 188)
+++ client_packet.cpp  (working copy)
@@ -3052,7 +3052,8 @@
        if(app->size == 0) {
                // i think thats the sign to stop the songs
                if(IsBardSong(casting_spell_id))
-                      InterruptSpell(SONG_ENDS, 0x121);
+                      //InterruptSpell(SONG_ENDS, 0x121);
+                      StopSong();
                else
                        InterruptSpell(INTERRUPT_SPELL, 0x121);

Index: spells.cpp
===================================================================
--- spells.cpp  (revision 188)
+++ spells.cpp  (working copy)
@@ -1628,7 +1628,10 @@
                        CastToClient()->GetPTimers().Start((pTimerItemStart + itm->GetItem()->RecastType), itm->GetItem()->RecastDelay);
                }
        }
-
+
+      if(IsClient() && IsBardSong(spell_id))
+              this->CastToClient()->MemorizeSpell(slot, spell_id,memSpellSpellbar);
+
        if(IsNPC())
                CastToNPC()->AI_Event_SpellCastFinished(true, slot);

@@ -1660,7 +1663,9 @@
                mlog(SPELLS__BARDS, "Bard Song Pulse %d: Supposidly cast from an item. Killing song.", spell_id);
                return(false);
        }
-
+      if(IsClient())
+              this->CastToClient()->MemorizeSpell(slot, spell_id,memSpellSpellbar);
+
        //determine the type of spell target we have
        Mob *ae_center = NULL;
        CastAction_type CastAction;
@@ -4246,6 +4251,15 @@
        bardsong_timer.Disable();
 }

+void Mob::StopSong() {
+
+      ZeroCastingVars();
+      bardsong = 0;
+      bardsong_target_id = 0;
+      bardsong_slot = 0;
+      bardsong_timer.Disable();
+}
+

I say 'hack' because I'm not in my comfort zone in the spell code and I suspect my 'StopSong' may not be the correct way to handle things. I'm working on other stuff at the moment, so if someone else wants to pick this up and refine it, feel free :)

Richardo 11-10-2008 08:52 AM

Good work. :)

trevius 11-10-2008 10:19 AM

Tried this code on my server and am getting reports of bards causing zone crashes. Just FYI. I didn't have time to actually try it myself.

Derision 11-10-2008 10:32 AM

I did say it was a 'hack' :) Was mainly to point out the key points required to get /melody to work, not as a ready-to-go fix.


All times are GMT -4. The time now is 07:13 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.