AA redux'd timers
The clients weren't being told about the redux in the reuse time, this should fix it. I tried to go about it not editing Spell functions, but that wasn't working. Some of the math seems backwards, at least by what we call things. (if anyone wants to do something that resets the AA, SendAATimer(ability, 0, reusetimer) resets it)
EDIT: I'm going to change this, found a way to make it more live like, just need to confirm it works.
Code:
Index: EQEmuServer/zone/AA.cpp
===================================================================
--- EQEmuServer/zone/AA.cpp (revision 2476)
+++ EQEmuServer/zone/AA.cpp (working copy)
@@ -290,8 +290,8 @@
p_timers.Start(pTimerHarmTouch, HarmTouchReuseTime);
}
- if(!CastSpell(caa->spell_id, target_id, 10, -1, -1, 0, -1, AATimerID + pTimerAAStart, timer_base, 1))
- return;
+ if(!CastSpell(caa->spell_id, target_id, 10, -1, -1, 0, -1, AATimerID + pTimerAAStart, timer_base, caa->reuse_time, 1))
+ return;
}
else
{
Index: EQEmuServer/zone/mob.h
===================================================================
--- EQEmuServer/zone/mob.h (revision 2476)
+++ EQEmuServer/zone/mob.h (working copy)
@@ -880,8 +880,8 @@
//TODO: put these ridiculous options in a damned struct or something
- virtual bool CastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 type = 0, int16 *resist_adjust = NULL);
- virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 type = 0, int16 resist_adjust = 0);
+ virtual bool CastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 norm_timer_duration = 0, uint32 type = 0, int16 *resist_adjust = NULL);
+ virtual bool DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot = 10, int32 casttime = -1, int32 mana_cost = -1, uint32* oSpellWillFinish = 0, uint32 item_slot = 0xFFFFFFFF, uint32 timer = 0xFFFFFFFF, uint32 timer_duration = 0, uint32 norm_timer_duration = 0, uint32 type = 0, int16 resist_adjust = 0);
void CastedSpellFinished(uint16 spell_id, uint32 target_id, uint16 slot, uint16 mana_used, uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0);
bool SpellFinished(uint16 spell_id, Mob *target, uint16 slot = 10, uint16 mana_used = 0, uint32 inventory_slot = 0xFFFFFFFF, int16 resist_adjust = 0, bool isproc = false);
virtual bool SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect = false, bool use_resist_adjust = false, int16 resist_adjust = 0, bool isproc = false);
@@ -1427,6 +1427,7 @@
uint32 casting_spell_inventory_slot;
uint32 casting_spell_timer;
uint32 casting_spell_timer_duration;
+ uint32 casting_spell_norm_timer_duration;
uint32 casting_spell_type;
int16 casting_spell_resist_adjust;
uint16 bardsong;
===================================================================
--- EQEmuServer/zone/spells.cpp (revision 2476)
+++ EQEmuServer/zone/spells.cpp (working copy)
@@ -170,7 +170,7 @@
// to allow procs to work
bool Mob::CastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish, uint32 item_slot,
- uint32 timer, uint32 timer_duration, uint32 type, int16 *resist_adjust)
+ uint32 timer, uint32 timer_duration, uint32 norm_timer_duration, uint32 type, int16 *resist_adjust)
{
_ZP(Mob_CastSpell);
@@ -304,11 +304,11 @@
if(resist_adjust)
{
- return(DoCastSpell(spell_id, target_id, slot, cast_time, mana_cost, oSpellWillFinish, item_slot, timer, timer_duration, type, *resist_adjust));
+ return(DoCastSpell(spell_id, target_id, slot, cast_time, mana_cost, oSpellWillFinish, item_slot, timer, timer_duration, norm_timer_duration, type, *resist_adjust));
}
else
{
- return(DoCastSpell(spell_id, target_id, slot, cast_time, mana_cost, oSpellWillFinish, item_slot, timer, timer_duration, type, spells[spell_id].ResistDiff));
+ return(DoCastSpell(spell_id, target_id, slot, cast_time, mana_cost, oSpellWillFinish, item_slot, timer, timer_duration, norm_timer_duration, type, spells[spell_id].ResistDiff));
}
}
@@ -322,7 +322,7 @@
//
bool Mob::DoCastSpell(uint16 spell_id, uint16 target_id, uint16 slot,
int32 cast_time, int32 mana_cost, uint32* oSpellWillFinish,
- uint32 item_slot, uint32 timer, uint32 timer_duration, uint32 type,
+ uint32 item_slot, uint32 timer, uint32 timer_duration, uint32 norm_timer_duration, uint32 type,
int16 resist_adjust)
{
_ZP(Mob_DoCastSpell);
@@ -349,6 +349,7 @@
{
casting_spell_timer = timer;
casting_spell_timer_duration = timer_duration;
+ casting_spell_norm_timer_duration = norm_timer_duration;
}
casting_spell_type = type;
@@ -682,6 +683,7 @@
casting_spell_inventory_slot = 0;
casting_spell_timer = 0;
casting_spell_timer_duration = 0;
+ casting_spell_norm_timer_duration = 0;
casting_spell_type = 0;
casting_spell_resist_adjust = 0;
delaytimer = false;
@@ -1981,7 +1983,7 @@
if(casting_spell_type == 1) //AA
{
time_t timestamp = time(NULL);
- CastToClient()->SendAATimer((casting_spell_timer - pTimerAAStart), timestamp, timestamp);
+ CastToClient()->SendAATimer((casting_spell_timer - pTimerAAStart), timestamp, timestamp+(casting_spell_norm_timer_duration-casting_spell_timer_duration));
}
}
else if(spells[spell_id].recast_time > 1000) {
Index: EQEmuServer/zone/MobAI.cpp
===================================================================
--- EQEmuServer/zone/MobAI.cpp (revision 2476)
+++ EQEmuServer/zone/MobAI.cpp (working copy)
@@ -341,7 +341,7 @@
SetMoving(false);
}
- return CastSpell(AIspells[i].spellid, tar->GetID(), 1, AIspells[i].manacost == -2 ? 0 : -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, 0, &(AIspells[i].resist_adjust));
+ return CastSpell(AIspells[i].spellid, tar->GetID(), 1, AIspells[i].manacost == -2 ? 0 : -1, mana_cost, oDontDoAgainBefore, -1, -1, 0, 0, 0, &(AIspells[i].resist_adjust));
}
bool EntityList::AICheckCloseBeneficialSpells(NPC* caster, uint8 iChance, float iRange, uint16 iSpellTypes) {
|