PDA

View Full Version : Check For SpellEffect Fix


seveianrex
10-18-2008, 10:01 AM
I ran into this issue primarily with Levitate. If anyone can think of another effect that this might be useful for it should be a reasonably simple implementation.

Basically, lets say you cast Flight of Eagles and then a Bard uses Selo's Song of Travel (Invis/Levi/Movement song). As soon as EITHER buff fades, you lose levi, even though you still have the other buff supposedly giving you levi.

This is my fix.

{mob.h}
insert anywhere

bool AffectedExcludingSlot(int slot, int effect);


{spell_effects.cpp}
append

bool Mob::AffectedExcludingSlot(int slot, int effect)
{
for (int i = 0; i <= EFFECT_COUNT; i++)
{
if (i == slot)
continue;

if (IsEffectInSpell(buffs[i].spellid, effect))
return true;
}
return false;
}


in void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
find

case SE_Levitate:
{
SendAppearancePacket(AT_Levitate, 0);
break;
}


replace with

case SE_Levitate:
{
if (!AffectedExcludingSlot(slot, SE_Levitate))
SendAppearancePacket(AT_Levitate, 0);
break;
}

cavedude
10-18-2008, 02:03 PM
This works perfectly for the caster, but any group member that also recieved the buffs will still fall when one of the spells wears off.

cavedude
10-18-2008, 02:16 PM
Hmmm, nevermind on that. It's working for both caster and group members now without me changing a thing. I've even recreated the situation where it didn't work and seems to be fine. It might have been lag, my test machine is under heavy load, atm.