Committing update to zone/client_packet.pp which fixes a bug with Lay

on Hands and Harm Touch. Basically what is happening is that because
LoH and Harm Touch come in on spell slot 9 (ABILITY_SLOT), and because
ABILITY_SLOT is handled in the same block of code as standard memorized
spells, it was failing the MAX_PP_MEMSPELL check and always getting
silently interrupted. I broke DISCIPLINE_SLOT and ABILITY_SLOT processing
out into separate blocks which not only resolves this problem, but also
cleans up that processing a little bit.
This commit is contained in:
Nicholas Haggmark 2013-12-27 22:28:54 -05:00
parent 13fcccefd5
commit 6dc444d2d1

View File

@ -4499,7 +4499,7 @@ void Client::Handle_OP_CastSpell(const EQApplicationPacket *app)
#endif #endif
LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot); LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv=%lx", castspell->slot, castspell->spell_id, castspell->target_id, (unsigned long)castspell->inventoryslot);
if ((castspell->slot == USE_ITEM_SPELL_SLOT) || (castspell->slot == POTION_BELT_SPELL_SLOT)) // this means item if ((castspell->slot == USE_ITEM_SPELL_SLOT) || (castspell->slot == POTION_BELT_SPELL_SLOT)) // ITEM or POTION cast
{ {
//discipline, using the item spell slot //discipline, using the item spell slot
if (castspell->inventoryslot == 0xFFFFFFFF) { if (castspell->inventoryslot == 0xFFFFFFFF) {
@ -4534,7 +4534,8 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
if (i == 0) { if (i == 0) {
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot); CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
} else { }
else {
InterruptSpell(castspell->spell_id); InterruptSpell(castspell->spell_id);
return; return;
} }
@ -4553,7 +4554,8 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
if (i == 0) { if (i == 0) {
CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot); CastSpell(item->Click.Effect, castspell->target_id, castspell->slot, item->CastTime, 0, 0, castspell->inventoryslot);
} else { }
else {
InterruptSpell(castspell->spell_id); InterruptSpell(castspell->spell_id);
return; return;
} }
@ -4576,13 +4578,17 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
InterruptSpell(castspell->spell_id); InterruptSpell(castspell->spell_id);
} }
} }
else // ability, or regular memmed spell else if (castspell->slot == DISCIPLINE_SPELL_SLOT) { // DISCIPLINE cast
{ if (!UseDiscipline(castspell->spell_id, castspell->target_id)) {
printf("Unknown ability being used by %s, spell being cast is: %i\n", GetName(), castspell->spell_id);
InterruptSpell(castspell->spell_id);
return;
}
}
else if (castspell->slot == ABILITY_SPELL_SLOT) { // ABILITY cast (LoH and Harm Touch)
uint16 spell_to_cast = 0; uint16 spell_to_cast = 0;
//current client seems to send LH in slot 8 now... if (castspell->spell_id == SPELL_LAY_ON_HANDS && GetClass() == PALADIN) {
if(castspell->slot == ABILITY_SPELL_SLOT &&
castspell->spell_id == SPELL_LAY_ON_HANDS && GetClass() == PALADIN) {
if (!p_timers.Expired(&database, pTimerLayHands)) { if (!p_timers.Expired(&database, pTimerLayHands)) {
Message(13, "Ability recovery time not yet met."); Message(13, "Ability recovery time not yet met.");
InterruptSpell(castspell->spell_id); InterruptSpell(castspell->spell_id);
@ -4590,32 +4596,30 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
} }
spell_to_cast = SPELL_LAY_ON_HANDS; spell_to_cast = SPELL_LAY_ON_HANDS;
p_timers.Start(pTimerLayHands, LayOnHandsReuseTime); p_timers.Start(pTimerLayHands, LayOnHandsReuseTime);
} else if(castspell->slot == ABILITY_SPELL_SLOT && }
(castspell->spell_id == SPELL_HARM_TOUCH else if ((castspell->spell_id == SPELL_HARM_TOUCH
|| castspell->spell_id == SPELL_HARM_TOUCH2 || castspell->spell_id == SPELL_HARM_TOUCH2) && GetClass() == SHADOWKNIGHT) {
) && GetClass() == SHADOWKNIGHT) {
if (!p_timers.Expired(&database, pTimerHarmTouch)) { if (!p_timers.Expired(&database, pTimerHarmTouch)) {
Message(13, "Ability recovery time not yet met."); Message(13, "Ability recovery time not yet met.");
InterruptSpell(castspell->spell_id); InterruptSpell(castspell->spell_id);
return; return;
} }
// determine which version of HT we are casting based on level
if (GetLevel() < 40) if (GetLevel() < 40)
spell_to_cast = SPELL_HARM_TOUCH; spell_to_cast = SPELL_HARM_TOUCH;
else else
spell_to_cast = SPELL_HARM_TOUCH2; spell_to_cast = SPELL_HARM_TOUCH2;
p_timers.Start(pTimerHarmTouch, HarmTouchReuseTime); p_timers.Start(pTimerHarmTouch, HarmTouchReuseTime);
} }
//handle disciplines, OLD, they keep changing this if (spell_to_cast > 0) // if we've matched LoH or HT, cast now
if(castspell->slot == DISCIPLINE_SPELL_SLOT) { CastSpell(spell_to_cast, castspell->target_id, castspell->slot);
if(!UseDiscipline(castspell->spell_id, castspell->target_id)) {
printf("Unknown ability being used by %s, spell being cast is: %i\n",GetName(),castspell->spell_id);
InterruptSpell(castspell->spell_id);
}
return;
} }
else // MEMORIZED SPELL (first confirm that it's a valid memmed spell slot, then validate that the spell is currently memorized)
{
uint16 spell_to_cast = 0;
if(castspell->slot < MAX_PP_MEMSPELL) if(castspell->slot < MAX_PP_MEMSPELL)
{ {
@ -4626,7 +4630,7 @@ LogFile->write(EQEMuLog::Debug, "OP CastSpell: slot=%d, spell=%d, target=%d, inv
return; return;
} }
} }
else { else if (castspell->slot >= MAX_PP_MEMSPELL) {
InterruptSpell(); InterruptSpell();
return; return;
} }