|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
02-01-2013, 11:15 PM
|
Demi-God
|
|
Join Date: Apr 2008
Location: MA
Posts: 1,164
|
|
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) {
|
|
|
|
|
|
|
02-02-2013, 01:36 AM
|
Demi-God
|
|
Join Date: Apr 2008
Location: MA
Posts: 1,164
|
|
Hmm, well, it appears a few AAs (long reuse ones like Divine Bestow Aura and Purify Soul get modded already and this just makes the appeared timer less, need to look into it more) This now works more live like where the timer starts when you click and is reset if you fail.
Code:
Index: EQEmuServer/zone/AA.cpp
===================================================================
--- EQEmuServer/zone/AA.cpp (revision 2476)
+++ EQEmuServer/zone/AA.cpp (working copy)
@@ -289,9 +289,14 @@
{
p_timers.Start(pTimerHarmTouch, HarmTouchReuseTime);
}
+ //AA timers start before cast, resets on failures
+ //SendAATime's begin and end appear weird, doesn't need timestamp, difference seems important
+ //for redux'd timers it appears to want how much to shave off, reuse time will clear it
+ SendAATimer(AATimerID, 0, caa->reuse_time-timer_base);
+ p_timers.Start(AATimerID + pTimerAAStart, timer_base);
- 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;
Index: EQEmuServer/zone/StringIDs.h
===================================================================
--- EQEmuServer/zone/StringIDs.h (revision 2476)
+++ EQEmuServer/zone/StringIDs.h (working copy)
@@ -10,6 +10,7 @@
#define SPELL_DOES_NOT_WORK_PLANE 107 //This spell does not work on this plane.
#define CANT_SEE_TARGET 108 //You cannot see your target.
#define MGB_STRING 113 //The next group buff you cast will hit all targets in range.
+#define ABILITY_FAILED 116 //Your ability failed. Timer has been reset.
#define TARGET_TOO_FAR 124 //Your target is too far away, get closer!
#define PROC_TOOLOW 126 //Your will is not sufficient to command this weapon.
#define PROC_PETTOOLOW 127 //Your pet's will is not sufficient to command its weapon.
Index: EQEmuServer/zone/spells.cpp
===================================================================
--- 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;
@@ -715,7 +717,11 @@
}
if(casting_spell_type == 1 && IsClient()) //Rest AA Timer on failed cast
+ {
+ CastToClient()->SendAATimer((casting_spell_timer - pTimerAAStart), 0, casting_spell_norm_timer_duration);
+ CastToClient()->Message_StringID(15,ABILITY_FAILED); // MT confirmed on live
CastToClient()->GetPTimers().Clear(&database, casting_spell_timer);
+ }
ZeroCastingVars(); // resets all the state keeping stuff
@@ -1976,12 +1982,14 @@
{
if(spell_id == casting_spell_id && casting_spell_timer != 0xFFFFFFFF)
{
- CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration);
- mlog(SPELLS__CASTING, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration);
+ if(casting_spell_type != 1) {
+ CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration);
+ mlog(SPELLS__CASTING, "Spell %d: Setting custom reuse timer %d to %d", spell_id, casting_spell_timer, casting_spell_timer_duration);
+ }
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) {
|
|
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -4. The time now is 07:54 PM.
|
|
|
|
|
|
|
|
|
|
|
|
|