mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 13:41:31 +00:00
Send caster name in buff packets for UF+
Currently the names only show for inspecting via Target Window because we send buff packets in the wrong order and there is a dependency on them being correct for self that isn't present for target window.
This commit is contained in:
parent
9856df20fb
commit
50d5f3785c
@ -4767,6 +4767,7 @@ struct BuffIconEntry_Struct
|
||||
uint32 spell_id;
|
||||
int32 tics_remaining;
|
||||
uint32 num_hits;
|
||||
char caster[64];
|
||||
};
|
||||
|
||||
struct BuffIcon_Struct
|
||||
@ -4776,6 +4777,7 @@ struct BuffIcon_Struct
|
||||
uint16 count;
|
||||
uint8 type; // 0 = self buff window, 1 = self target window, 4 = group, 5 = PC, 7 = NPC
|
||||
int32 tic_timer;
|
||||
int32 name_lengths; // so ahh we kind of do these packets hacky, this is the total length of all the names to make creating the real packets in the translators easier
|
||||
BuffIconEntry_Struct entries[0];
|
||||
};
|
||||
|
||||
|
||||
@ -460,7 +460,7 @@ namespace RoF
|
||||
{
|
||||
SETUP_VAR_ENCODE(BuffIcon_Struct);
|
||||
|
||||
uint32 sz = 12 + (17 * emu->count);
|
||||
uint32 sz = 12 + (17 * emu->count) + emu->name_lengths; // 17 includes nullterm
|
||||
__packet->size = sz;
|
||||
__packet->pBuffer = new unsigned char[sz];
|
||||
memset(__packet->pBuffer, 0, sz);
|
||||
@ -476,7 +476,7 @@ namespace RoF
|
||||
__packet->WriteUInt32(emu->entries[i].spell_id);
|
||||
__packet->WriteUInt32(emu->entries[i].tics_remaining);
|
||||
__packet->WriteUInt32(emu->entries[i].num_hits); // Unknown
|
||||
__packet->WriteString("");
|
||||
__packet->WriteString(emu->entries[i].caster);
|
||||
}
|
||||
__packet->WriteUInt8(emu->type); // Unknown
|
||||
|
||||
|
||||
@ -528,7 +528,7 @@ namespace RoF2
|
||||
{
|
||||
SETUP_VAR_ENCODE(BuffIcon_Struct);
|
||||
|
||||
uint32 sz = 12 + (17 * emu->count);
|
||||
uint32 sz = 12 + (17 * emu->count) + emu->name_lengths; // 17 includes nullterm
|
||||
__packet->size = sz;
|
||||
__packet->pBuffer = new unsigned char[sz];
|
||||
memset(__packet->pBuffer, 0, sz);
|
||||
@ -544,7 +544,7 @@ namespace RoF2
|
||||
__packet->WriteUInt32(emu->entries[i].spell_id);
|
||||
__packet->WriteUInt32(emu->entries[i].tics_remaining);
|
||||
__packet->WriteUInt32(emu->entries[i].num_hits); // Unknown
|
||||
__packet->WriteString("");
|
||||
__packet->WriteString(emu->entries[i].caster);
|
||||
}
|
||||
__packet->WriteUInt8(emu->type); // Unknown
|
||||
|
||||
|
||||
@ -391,7 +391,7 @@ namespace UF
|
||||
{
|
||||
SETUP_VAR_ENCODE(BuffIcon_Struct);
|
||||
|
||||
uint32 sz = 12 + (17 * emu->count);
|
||||
uint32 sz = 12 + (17 * emu->count) + emu->name_lengths; // 17 includes nullterm
|
||||
__packet->size = sz;
|
||||
__packet->pBuffer = new unsigned char[sz];
|
||||
memset(__packet->pBuffer, 0, sz);
|
||||
@ -407,7 +407,7 @@ namespace UF
|
||||
__packet->WriteUInt32(emu->entries[i].spell_id);
|
||||
__packet->WriteUInt32(emu->entries[i].tics_remaining);
|
||||
__packet->WriteUInt32(emu->entries[i].num_hits);
|
||||
__packet->WriteString("");
|
||||
__packet->WriteString(emu->entries[i].caster);
|
||||
}
|
||||
__packet->WriteUInt8(emu->type);
|
||||
|
||||
|
||||
@ -137,6 +137,15 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
buffs[buffslot].magic_rune = 0;
|
||||
buffs[buffslot].numhits = 0;
|
||||
|
||||
if (spells[spell_id].numhits > 0) {
|
||||
|
||||
int numhit = spells[spell_id].numhits;
|
||||
|
||||
numhit += numhit * caster->GetFocusEffect(focusFcLimitUse, spell_id) / 100;
|
||||
numhit += caster->GetFocusEffect(focusIncreaseNumHits, spell_id);
|
||||
buffs[buffslot].numhits = numhit;
|
||||
}
|
||||
|
||||
if (spells[spell_id].EndurUpkeep > 0)
|
||||
SetEndurUpkeep(true);
|
||||
|
||||
@ -184,14 +193,6 @@ bool Mob::SpellEffect(Mob* caster, uint16 spell_id, float partial, int level_ove
|
||||
}
|
||||
}
|
||||
|
||||
if(spells[spell_id].numhits > 0 && buffslot >= 0){
|
||||
|
||||
int numhit = spells[spell_id].numhits;
|
||||
|
||||
numhit += numhit*caster->GetFocusEffect(focusFcLimitUse, spell_id)/100;
|
||||
numhit += caster->GetFocusEffect(focusIncreaseNumHits, spell_id);
|
||||
buffs[buffslot].numhits = numhit;
|
||||
}
|
||||
|
||||
if (!IsPowerDistModSpell(spell_id))
|
||||
SetSpellPowerDistanceMod(0);
|
||||
|
||||
@ -3309,8 +3309,8 @@ int Mob::AddBuff(Mob *caster, uint16 spell_id, int duration, int32 level_overrid
|
||||
|
||||
buffs[emptyslot].spellid = spell_id;
|
||||
buffs[emptyslot].casterlevel = caster_level;
|
||||
if (caster && caster->IsClient())
|
||||
strcpy(buffs[emptyslot].caster_name, caster->GetName());
|
||||
if (caster && !caster->IsAura()) // maybe some other things we don't want to ...
|
||||
strcpy(buffs[emptyslot].caster_name, caster->GetCleanName());
|
||||
else
|
||||
memset(buffs[emptyslot].caster_name, 0, 64);
|
||||
buffs[emptyslot].casterid = caster ? caster->GetID() : 0;
|
||||
@ -5548,6 +5548,8 @@ void Client::SendBuffNumHitPacket(Buffs_Struct &buff, int slot)
|
||||
bi->entries[0].spell_id = buff.spellid;
|
||||
bi->entries[0].tics_remaining = buff.ticsremaining;
|
||||
bi->entries[0].num_hits = buff.numhits;
|
||||
strn0cpy(bi->entries[0].caster, buff.caster_name, 64);
|
||||
bi->name_lengths = strlen(bi->entries[0].caster);
|
||||
FastQueuePacket(&outapp);
|
||||
}
|
||||
|
||||
@ -5633,6 +5635,7 @@ EQApplicationPacket *Mob::MakeBuffsPacket(bool for_target)
|
||||
else
|
||||
buff->type = 0;
|
||||
|
||||
buff->name_lengths = 0; // hacky shit
|
||||
uint32 index = 0;
|
||||
for(int i = 0; i < buff_count; ++i)
|
||||
{
|
||||
@ -5642,6 +5645,8 @@ EQApplicationPacket *Mob::MakeBuffsPacket(bool for_target)
|
||||
buff->entries[index].spell_id = buffs[i].spellid;
|
||||
buff->entries[index].tics_remaining = buffs[i].ticsremaining;
|
||||
buff->entries[index].num_hits = buffs[i].numhits;
|
||||
strn0cpy(buff->entries[index].caster, buffs[i].caster_name, 64);
|
||||
buff->name_lengths += strlen(buff->entries[index].caster);
|
||||
++index;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user