Very annoying not being able to edit. Now I remember another reason I don't post here.
Sorry, but I misread your post. Since I did a half assed post, here is a real solution.
To get it to not topslot, you can do it for same spell id. But put in a condition to not send a fade packet to the client. That way when new buff goes over to client, it will update same slot. I tested it, and the client will topslot lower level versions of spells, that would get overwritten.
You will have to add additional parameters to BuffFadeBySlot(), which perform the fade packet function. You have to call BuffFadeBySlot(), to get procs, etc., other things updated properly.
The BuffFadeBySlot I am using is:
Code:
void BuffFadeBySlot(int slot, bool iRecalcBonuses = true, bool death = false, bool sendmessage = true, bool sendfadepacket = true);
You can figure out where to put the checks for sendmessage (for sending the message that the buff faded) and sendfadepacket in the function, so they send when you want them.
The section of AddBuff() now becomes:
Code:
if(will_overwrite)
{
vector<int>::iterator cur, end;
cur = overwrite_slots.begin();
end = overwrite_slots.end();
for(; cur != end; cur++) {
if (buffs[*cur].spellid == spell_id) { // special handling for same spell (should overwrite only one buff)
emptyslot = *cur;
if(caster && buffs[*cur].casterid == caster->GetID()) {
BuffFadeBySlot(*cur, false, false, false, false); // no fade message or packet (same caster)
} else {
BuffFadeBySlot(*cur, false, false, true, false); // no fade packet, but send fade message
}
} else {
BuffFadeBySlot(*cur, false);
if (*cur < emptyslot || emptyslot == -1)
emptyslot = *cur;
}
}
}
Haynar