From 5b85aa6550992963384f23c353a260b376253287 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Wed, 19 Nov 2014 00:39:42 -0500 Subject: [PATCH 1/3] Fix to allow discipline reuse timers to be set on client correclty and therefore have the client return the time remaining instead of the server. Hopefully may resolve some bugs reselated to discipline use. --- zone/client.h | 1 + zone/effects.cpp | 27 +++++++++++++++++---------- zone/spells.cpp | 4 ++++ 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/zone/client.h b/zone/client.h index fd797c1b7..de6d187b7 100644 --- a/zone/client.h +++ b/zone/client.h @@ -875,6 +875,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); bool TrainDiscipline(uint32 itemid); void SendDisciplineUpdate(); bool UseDiscipline(uint32 spell_id, uint32 target); + void SendDisciplineTimer(uint32 timer_id, uint32 duration, uint16 spell_id = SPELL_UNKNOWN); bool CheckTitle(int titleset); void EnableTitle(int titleset); diff --git a/zone/effects.cpp b/zone/effects.cpp index 7506f99cf..118acb4a3 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -696,16 +696,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return true; } - CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); - 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 = reduced_recast; - QueuePacket(outapp); - safe_delete(outapp); - } + SendDisciplineTimer(spells[spell_id].EndurTimerIndex, reduced_recast); } else { @@ -714,6 +705,22 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return(true); } +void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration, uint16 spell_id) +{ + if (!timer_id && IsValidSpell(spell_id)) + timer_id = spells[spell_id].EndurTimerIndex; + + if(duration > 0 && timer_id && (timer_id < MAX_DISCIPLINE_TIMERS)) + { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); + DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; + dts->TimerID = timer_id; + dts->Duration = duration; + QueuePacket(outapp); + safe_delete(outapp); + } +} + void EntityList::AETaunt(Client* taunter, float range) { if (range == 0) diff --git a/zone/spells.cpp b/zone/spells.cpp index 315fe8712..05000dc51 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2256,6 +2256,10 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } } + //Disc Timer needs to be sent before and after the spell packet. + if (IsClient() && spells[spell_id].IsDisciplineBuff && spells[spell_id].EndurTimerIndex) + CastToClient()->SendDisciplineTimer(casting_spell_timer, casting_spell_timer_duration); + if(IsNPC()) CastToNPC()->AI_Event_SpellCastFinished(true, slot); From 2330285b04fd80625b7593018dbdf3a2b37613e1 Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 20 Nov 2014 05:05:15 -0500 Subject: [PATCH 2/3] revert --- zone/client.h | 1 - zone/effects.cpp | 27 ++++++++++----------------- zone/spells.cpp | 4 ---- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/zone/client.h b/zone/client.h index de6d187b7..fd797c1b7 100644 --- a/zone/client.h +++ b/zone/client.h @@ -875,7 +875,6 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); bool TrainDiscipline(uint32 itemid); void SendDisciplineUpdate(); bool UseDiscipline(uint32 spell_id, uint32 target); - void SendDisciplineTimer(uint32 timer_id, uint32 duration, uint16 spell_id = SPELL_UNKNOWN); bool CheckTitle(int titleset); void EnableTitle(int titleset); diff --git a/zone/effects.cpp b/zone/effects.cpp index 118acb4a3..7506f99cf 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -696,7 +696,16 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return true; } - SendDisciplineTimer(spells[spell_id].EndurTimerIndex, reduced_recast); + CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); + 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 = reduced_recast; + QueuePacket(outapp); + safe_delete(outapp); + } } else { @@ -705,22 +714,6 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return(true); } -void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration, uint16 spell_id) -{ - if (!timer_id && IsValidSpell(spell_id)) - timer_id = spells[spell_id].EndurTimerIndex; - - if(duration > 0 && timer_id && (timer_id < MAX_DISCIPLINE_TIMERS)) - { - EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); - DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; - dts->TimerID = timer_id; - dts->Duration = duration; - QueuePacket(outapp); - safe_delete(outapp); - } -} - void EntityList::AETaunt(Client* taunter, float range) { if (range == 0) diff --git a/zone/spells.cpp b/zone/spells.cpp index 05000dc51..315fe8712 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -2256,10 +2256,6 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 } } - //Disc Timer needs to be sent before and after the spell packet. - if (IsClient() && spells[spell_id].IsDisciplineBuff && spells[spell_id].EndurTimerIndex) - CastToClient()->SendDisciplineTimer(casting_spell_timer, casting_spell_timer_duration); - if(IsNPC()) CastToNPC()->AI_Event_SpellCastFinished(true, slot); From f1701aae9fe0781dcc246f11292764e8ed9c786c Mon Sep 17 00:00:00 2001 From: KayenEQ Date: Thu, 20 Nov 2014 05:53:59 -0500 Subject: [PATCH 3/3] Fix to remove double CastSpell calls from use disc function. --- zone/client.h | 1 + zone/effects.cpp | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/zone/client.h b/zone/client.h index 4ffe6d57d..ad30e0e6f 100644 --- a/zone/client.h +++ b/zone/client.h @@ -874,6 +874,7 @@ void SetConsumption(int32 in_hunger, int32 in_thirst); void DropInst(const ItemInst* inst); bool TrainDiscipline(uint32 itemid); void SendDisciplineUpdate(); + void SendDisciplineTimer(uint32 timer_id, uint32 duration); bool UseDiscipline(uint32 spell_id, uint32 target); bool CheckTitle(int titleset); diff --git a/zone/effects.cpp b/zone/effects.cpp index 7506f99cf..0bface8b7 100644 --- a/zone/effects.cpp +++ b/zone/effects.cpp @@ -696,16 +696,7 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return true; } - CastSpell(spell_id, target, DISCIPLINE_SPELL_SLOT, -1, -1, 0, -1, (uint32)DiscTimer, reduced_recast); - 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 = reduced_recast; - QueuePacket(outapp); - safe_delete(outapp); - } + SendDisciplineTimer(spells[spell_id].EndurTimerIndex, reduced_recast); } else { @@ -714,6 +705,19 @@ bool Client::UseDiscipline(uint32 spell_id, uint32 target) { return(true); } +void Client::SendDisciplineTimer(uint32 timer_id, uint32 duration) +{ + if (timer_id < MAX_DISCIPLINE_TIMERS) + { + EQApplicationPacket *outapp = new EQApplicationPacket(OP_DisciplineTimer, sizeof(DisciplineTimer_Struct)); + DisciplineTimer_Struct *dts = (DisciplineTimer_Struct *)outapp->pBuffer; + dts->TimerID = timer_id; + dts->Duration = duration; + QueuePacket(outapp); + safe_delete(outapp); + } +} + void EntityList::AETaunt(Client* taunter, float range) { if (range == 0)