Example #1
0
void PlayerLogger::LogDamage(bool done, uint16 damage, uint16 heal, ObjectGuid const & unitGuid, uint16 spell)
{
    if (!IsLoggingActive(done ? PLAYER_LOGMASK_DAMAGE_DONE : PLAYER_LOGMASK_DAMAGE_GET))
        return;
    PlayerLogDamage log = PlayerLogDamage(sWorld.GetUptime());
    log.dmgUnit = (unitGuid.GetCounter() == playerGuid) ? 0 : (unitGuid.IsPlayer() ? unitGuid.GetCounter() : unitGuid.GetEntry());
    log.SetCreature(unitGuid.IsCreatureOrPet());
    log.damage = damage > 0 ? int16(damage) : -int16(heal);
    log.spell = spell;
    ((std::vector<PlayerLogDamage>*)(data[done ? PLAYER_LOG_DAMAGE_DONE : PLAYER_LOG_DAMAGE_GET]))->push_back(log);
}