mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 13:16:39 +00:00
Added initial duration to buff tracking and corrected buff removal
This commit is contained in:
@@ -113,8 +113,13 @@ void ClientPatch::SendSingleBuffChange(Mob* sender, const Buffs_Struct& buff, in
|
||||
// first, send to self if self is client, which takes the definition and the refresh
|
||||
if (sender->IsClient()) {
|
||||
Client* c = sender->CastToClient();
|
||||
FastQueuePacket(c, &IBuff::BuffDefinition, GetClientComponent<IBuff>(c), sender, buff, slot, remove);
|
||||
FastQueuePacket(c, &IBuff::RefreshBuffs, GetClientComponent<IBuff>(c), OP_RefreshBuffs, sender, remove, suspended, slots);
|
||||
IBuff* component = GetClientComponent<IBuff>(c);
|
||||
FastQueuePacket(c, &IBuff::BuffDefinition, component, sender, buff, slot, remove);
|
||||
FastQueuePacket(c, &IBuff::RefreshBuffs, component, OP_RefreshBuffs, sender, remove, suspended, slots);
|
||||
|
||||
// the client doesn't automatically do this for some reason pre-TOB
|
||||
if (remove && component->NeedsWearMessage())
|
||||
c->SendColoredText(Chat::Spells, spells[buff.spellid].spell_fades);
|
||||
}
|
||||
|
||||
// the rest of the buff packets do not take the definition, only the refresh
|
||||
@@ -131,8 +136,4 @@ void ClientPatch::SendSingleBuffChange(Mob* sender, const Buffs_Struct& buff, in
|
||||
|
||||
QueueClientsByTarget(sender, ackreq, ShouldSendTargetBuffs, mutate)(
|
||||
&IBuff::RefreshBuffs, GetClientComponent<IBuff>, OP_RefreshTargetBuffs, sender, remove, suspended, slots);
|
||||
|
||||
// the client doesn't automatically do this for some reason, only send it to the sender (TOB doesn't actually need this, but it doesn't double show the message)
|
||||
if (remove && sender->IsClient())
|
||||
sender->CastToClient()->SendColoredText(Chat::Spells, spells[buff.spellid].spell_fades);
|
||||
}
|
||||
|
||||
@@ -123,6 +123,7 @@ void FastQueuePacket(Client* c, Fun fun, Obj* obj, Args&&... args)
|
||||
if (app) {
|
||||
// FastQueuePacket specifically takes lifetime management of packet, so release here
|
||||
EQApplicationPacket* packet = app.release();
|
||||
LogNetcode("S->C FastQueuePacket {}", DumpPacketToString(packet));
|
||||
c->FastQueuePacket(&packet);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,6 +228,7 @@ struct Buffs_Struct {
|
||||
uint32 casterid; // Maybe change this to a pointer sometime, but gotta make sure it's 0'd when it no longer points to anything
|
||||
char caster_name[64];
|
||||
int32 ticsremaining;
|
||||
int32 initialduration;
|
||||
uint32 counters;
|
||||
uint32 hit_number; //the number of physical hits this buff can take before it fades away, lots of druid armor spells take advantage of this mixed with powerful effects
|
||||
uint32 melee_rune;
|
||||
|
||||
@@ -4243,9 +4243,6 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
if(!IsValidSpell(buffs[slot].spellid))
|
||||
return;
|
||||
|
||||
if (IsClient() && !CastToClient()->IsDead())
|
||||
ClientPatch::SendSingleBuffChange(this, buffs[slot], slot);
|
||||
|
||||
LogSpells("Fading buff [{}] from slot [{}]", buffs[slot].spellid, slot);
|
||||
|
||||
const auto has_fade_event = parse->SpellHasQuestSub(buffs[slot].spellid, EVENT_SPELL_FADE);
|
||||
@@ -4650,8 +4647,12 @@ void Mob::BuffFadeBySlot(int slot, bool iRecalcBonuses)
|
||||
if (spells[buffs[slot].spellid].nimbus_effect > 0)
|
||||
RemoveNimbusEffect(spells[buffs[slot].spellid].nimbus_effect);
|
||||
|
||||
buffs[slot].spellid = SPELL_UNKNOWN;
|
||||
// the client expects remaining duration to be 0 in the single packet change
|
||||
buffs[slot].ticsremaining = 0;
|
||||
ClientPatch::SendSingleBuffChange(this, buffs[slot], slot, true);
|
||||
|
||||
// don't set the spell to unknown until after the server has sent the single remove packets
|
||||
buffs[slot].spellid = SPELL_UNKNOWN;
|
||||
ClientPatch::SendFullBuffRefresh(this);
|
||||
|
||||
// we will eventually call CalcBonuses() even if we skip it right here, so should correct itself if we still have them
|
||||
|
||||
@@ -3720,6 +3720,7 @@ int Mob::AddBuff(Mob *caster, int32 spell_id, int duration, int32 level_override
|
||||
memset(buffs[emptyslot].caster_name, 0, 64);
|
||||
buffs[emptyslot].casterid = caster ? caster->GetID() : 0;
|
||||
buffs[emptyslot].ticsremaining = duration;
|
||||
buffs[emptyslot].initialduration = duration;
|
||||
buffs[emptyslot].counters = CalculateCounters(spell_id);
|
||||
buffs[emptyslot].hit_number = spells[spell_id].hit_number;
|
||||
buffs[emptyslot].client = caster ? caster->IsClient() : 0;
|
||||
|
||||
Reference in New Issue
Block a user