common damage from attack.cpp
Changes:
Moved death and other checks to the bottom to allow proper damage message generation in the case of the damage still killing the mob.
Made hits that dealt no damage to not interrupt spells.
Code:
got knocked down to 2nd post due to length
next, fixing the death struct, need to update all instances of it to my knowledge.
Code:
struct Death_Struct
{
/*000*/ int32 spawn_id;
/*004*/ int32 killer_id;
/*008*/ int32 corpseid; // was corpseid
/*012*/ int32 bindzoneid; // was type -- was attack_skill
/*016*/ int32 spell_id;
/*020*/ int32 attack_skill; //was bindzoneid -- switched by Ailia
/*024*/ int32 damage;
/*028*/ int32 unknown028;
};
now preventing the client from displaying damage message from the death packet it was sent since the server is generating the damage message instead.
Code:
void NPC::Death(Mob* other, sint32 damage, int16 spell, SkillType attack_skill) {
mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", other->GetName(), damage, spell, attack_skill);
if (this->IsEngaged())
{
zone->DelAggroMob();
#if EQDEBUG >= 11
LogFile->write(EQEMuLog::Debug,"NPC::Death() Mobs currently Aggro %i", zone->MobsAggroCount());
#endif
}
SetHP(0);
SetPet(0);
Mob* killer = GetHateDamageTop(this);
entity_list.RemoveFromTargets(this);
if(p_depop == true)
return;
BuffFadeAll();
EQApplicationPacket* app= new EQApplicationPacket(OP_Death,sizeof(Death_Struct));
Death_Struct* d = (Death_Struct*)app->pBuffer;
d->spawn_id = GetID();
d->killer_id = other ? other->GetID() : 0;
// d->unknown12 = 1;
d->bindzoneid = 0;
d->spell_id = spell == SPELL_UNKNOWN ? 0xffffffff : spell;
d->attack_skill = 231; // prevent client from displaying extra hit message
d->damage = damage;
app->priority = 6;
entity_list.QueueClients(other, app, false);
and again for client death
Code:
void Client::Death(Mob* other, sint32 damage, int16 spell, SkillType attack_skill)
{
if(dead)
return; //cant die more than once...
int exploss;
mlog(COMBAT__HITS, "Fatal blow dealt by %s with %d damage, spell %d, skill %d", other->GetName(), damage, spell, attack_skill);
//
// #1: Send death packet to everyone
//
if(!spell) spell = SPELL_UNKNOWN;
SendLogoutPackets();
//make our become corpse packet, and queue to ourself before OP_Death.
EQApplicationPacket app2(OP_BecomeCorpse, sizeof(BecomeCorpse_Struct));
BecomeCorpse_Struct* bc = (BecomeCorpse_Struct*)app2.pBuffer;
bc->spawn_id = GetID();
bc->x = GetX();
bc->y = GetY();
bc->z = GetZ();
QueuePacket(&app2);
// make death packet
EQApplicationPacket app(OP_Death, sizeof(Death_Struct));
Death_Struct* d = (Death_Struct*)app.pBuffer;
d->spawn_id = GetID();
d->killer_id = other ? other->GetID() : 0;
//d->unknown12 = 1;
d->bindzoneid = m_pp.binds[0].zoneId;
d->spell_id = spell == SPELL_UNKNOWN ? 0xffffffff : spell;
d->attack_skill = 231;
d->damage = damage;
app.priority = 6;
entity_list.QueueClients(this, &app);