View Single Post
  #1  
Old 05-23-2009, 10:04 AM
Derision
Developer
 
Join Date: Feb 2004
Location: UK
Posts: 1,540
Default Combat Ability hot buttons / reuse timers.

My DSL is down so I probably won't be able to commit anything to the SVN from my Linux server for a few days, hence me posting this code here.

I was asked yesterday if I could look into making the hot buttons for Combat Abilities (Alt-C) remain down until their reuse timer is up.

This seems to work well, but I could do with someone more familiar with disciplines and their shared reuse timers testing it out.
Code:
Index: utils/patch_SoF.conf
===================================================================
--- utils/patch_SoF.conf        (revision 554)
+++ utils/patch_SoF.conf        (working copy)
@@ -278,6 +278,7 @@
 OP_Charm=0x2F32                                #
 OP_Stun=0x55BF                         #
 OP_DisciplineUpdate=0x0000             #
+OP_DisciplineTimer=0x53c5              #
 OP_FindPersonRequest=0x07F0            #
 OP_FindPersonReply=0x7770              #
 OP_Sound=0x2B02                                #
Index: utils/patch_Titanium.conf
===================================================================
--- utils/patch_Titanium.conf   (revision 554)
+++ utils/patch_Titanium.conf   (working copy)
@@ -387,6 +387,7 @@
 OP_ZoneComplete=0x0000
 OP_ItemLinkText=0x0000
 OP_DisciplineUpdate=0x7180
+OP_DisciplineTimer=0x53df
 OP_LocInfo=0x0000
 OP_FindPersonRequest=0x3c41                    # ShowEQ 10/27/05
 OP_FindPersonReply=0x5711                      # ShowEQ 10/27/05
Index: utils/patch_6.2.conf
===================================================================
--- utils/patch_6.2.conf        (revision 554)
+++ utils/patch_6.2.conf        (working copy)
@@ -384,6 +384,7 @@
 OP_ItemLinkText=0x0000
 OP_ClearObject=0x8258
 OP_DisciplineUpdate=0x7180
+OP_DisciplineTimer=0x53df
 OP_LocInfo=0x0000
 OP_FindPersonRequest=0x3c41            # ShowEQ 06/29/05
 OP_FindPersonReply=0x5711
Index: common/emu_oplist.h
===================================================================
--- common/emu_oplist.h (revision 554)
+++ common/emu_oplist.h (working copy)
@@ -433,4 +433,5 @@
 N(OP_PVPLeaderBoardReply),
 N(OP_PVPLeaderBoardDetailsRequest),
 N(OP_PVPLeaderBoardDetailsReply),
+N(OP_DisciplineTimer),

Index: common/eq_packet_structs.h
===================================================================
--- common/eq_packet_structs.h  (revision 554)
+++ common/eq_packet_structs.h  (working copy)
@@ -631,6 +631,7 @@


 static const uint32 MAX_PP_DISCIPLINES = 100;
+static const uint32 MAX_DISCIPLINE_TIMERS = 20;

 struct Disciplines_Struct {
        uint32 values[MAX_PP_DISCIPLINES];
@@ -3865,6 +3866,13 @@
 /*168*/
 };

+struct DisciplineTimer_Struct
+{
+/*00*/ uint32  TimerID;
+/*04*/ uint32  Duration;
+/*08*/ uint32  Unknown08;
+};
+
 //old structures live here:
 #include "eq_old_structs.h"

Index: zone/client_packet.cpp
===================================================================
--- zone/client_packet.cpp      (revision 554)
+++ zone/client_packet.cpp      (working copy)
@@ -7572,6 +7572,8 @@

        TotalKarma = database.GetKarma(AccountID());

+       SendDisciplineTimers();
+
 #ifdef EMBPERL
        ((PerlembParser *)parse)->Event(EVENT_ENTERZONE, 0, "", (NPC*)NULL, this);
 #endif
Index: zone/client.cpp
===================================================================
--- zone/client.cpp     (revision 554)
+++ zone/client.cpp     (working copy)
@@ -3961,3 +3961,24 @@
        QueuePacket(outapp);
        safe_delete(outapp);
 }
+
+void Client::SendDisciplineTimers()
+{
+
+       EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct));
+       DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer;
+
+       for(int i = 0; i < MAX_DISCIPLINE_TIMERS; ++i)
+       {
+               int32 RemainingTime = p_timers.GetRemainingTime(pTimerDisciplineReuseStart + i);
+
+               if(RemainingTime > 0)
+               {
+                       dts->TimerID = i;
+                       dts->Duration = RemainingTime;
+                       QueuePacket(outapp);
+               }
+       }
+
+       safe_delete(outapp);
+}
Index: zone/client.h
===================================================================
--- zone/client.h       (revision 554)
+++ zone/client.h       (working copy)
@@ -809,6 +809,7 @@
        void IncrementAggroCount();
        void DecrementAggroCount();
        void SendPVPStats();
+       void SendDisciplineTimers();

 protected:
        friend class Mob;
Index: zone/effects.cpp
===================================================================
--- zone/effects.cpp    (revision 553)
+++ zone/effects.cpp    (working copy)
@@ -676,6 +676,15 @@
        if(spell.recast_time > 0)
        {
                p_timers.Start(DiscTimer, spell.recast_time / 1000);
+               if(spells[spell_id].EndurTimerIndex < MAX_DISCIPLINE_TIMERS)
+               {
+                       EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct));
+                       DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer;
+                       dts->TimerID = spells[spell_id].EndurTimerIndex;
+                       dts->Duration = spell.recast_time / 1000;
+                       QueuePacket(outapp);
+                       safe_delete(outapp);
+               }
        }
        return(true);
 }
Reply With Quote