fix(core\player): Missing combat animation (#14199)
This commit is contained in:
@@ -812,8 +812,14 @@ void Unit::DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, bool /*allowGM*/, Spell const* damageSpell /*= nullptr*/)
|
uint32 Unit::DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, bool /*allowGM*/, Spell const* damageSpell /*= nullptr*/, bool delayed)
|
||||||
{
|
{
|
||||||
|
if (delayed && attacker->GetTypeId() == TYPEID_PLAYER && attacker->GetGUID() != victim->GetGUID())
|
||||||
|
{
|
||||||
|
sWorld->AddDelayedDamage(attacker, victim, damage, cleanDamage, damagetype, damageSchoolMask, spellProto, durabilityLoss);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Xinef: initialize damage done for rage calculations
|
// Xinef: initialize damage done for rage calculations
|
||||||
// Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0
|
// Xinef: its rare to modify damage in hooks, however training dummy's sets damage to 0
|
||||||
uint32 rage_damage = damage + ((cleanDamage != nullptr) ? cleanDamage->absorbed_damage : 0);
|
uint32 rage_damage = damage + ((cleanDamage != nullptr) ? cleanDamage->absorbed_damage : 0);
|
||||||
@@ -1454,7 +1460,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage* damageInfo, bool durabilityLoss,
|
|||||||
|
|
||||||
// Call default DealDamage
|
// Call default DealDamage
|
||||||
CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, BASE_ATTACK, MELEE_HIT_NORMAL);
|
CleanDamage cleanDamage(damageInfo->cleanDamage, damageInfo->absorb, BASE_ATTACK, MELEE_HIT_NORMAL);
|
||||||
Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss, false, spell);
|
Unit::DealDamage(this, victim, damageInfo->damage, &cleanDamage, SPELL_DIRECT_DAMAGE, SpellSchoolMask(damageInfo->schoolMask), spellProto, durabilityLoss, false, spell, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @todo for melee need create structure as in
|
// @todo for melee need create structure as in
|
||||||
|
|||||||
@@ -765,6 +765,18 @@ struct CleanDamage
|
|||||||
struct CalcDamageInfo;
|
struct CalcDamageInfo;
|
||||||
struct SpellNonMeleeDamage;
|
struct SpellNonMeleeDamage;
|
||||||
|
|
||||||
|
struct DelayedDamage
|
||||||
|
{
|
||||||
|
Unit* attacker;
|
||||||
|
Unit* victim;
|
||||||
|
uint32 damage;
|
||||||
|
CleanDamage const* cleanDamage;
|
||||||
|
DamageEffectType damagetype;
|
||||||
|
SpellSchoolMask damageSchoolMask;
|
||||||
|
SpellInfo const* spellProto;
|
||||||
|
bool durabilityLoss;
|
||||||
|
};
|
||||||
|
|
||||||
class DamageInfo
|
class DamageInfo
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
@@ -1575,7 +1587,7 @@ public:
|
|||||||
|
|
||||||
uint16 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : GetLevel()) * 5; }
|
uint16 GetMaxSkillValueForLevel(Unit const* target = nullptr) const { return (target ? getLevelForTarget(target) : GetLevel()) * 5; }
|
||||||
static void DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb);
|
static void DealDamageMods(Unit const* victim, uint32& damage, uint32* absorb);
|
||||||
static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true, bool allowGM = false, Spell const* spell = nullptr);
|
static uint32 DealDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage = nullptr, DamageEffectType damagetype = DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask = SPELL_SCHOOL_MASK_NORMAL, SpellInfo const* spellProto = nullptr, bool durabilityLoss = true, bool allowGM = false, Spell const* spell = nullptr, bool delayed = false);
|
||||||
static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr);
|
static void Kill(Unit* killer, Unit* victim, bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr);
|
||||||
void KillSelf(bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr) { Kill(this, this, durabilityLoss, attackType, spellProto, spell); };
|
void KillSelf(bool durabilityLoss = true, WeaponAttackType attackType = BASE_ATTACK, SpellInfo const* spellProto = nullptr, Spell const* spell = nullptr) { Kill(this, this, durabilityLoss, attackType, spellProto, spell); };
|
||||||
static int32 DealHeal(Unit* healer, Unit* victim, uint32 addhealth);
|
static int32 DealHeal(Unit* healer, Unit* victim, uint32 addhealth);
|
||||||
|
|||||||
@@ -6383,7 +6383,7 @@ void AuraEffect::HandlePeriodicDamageAurasTick(Unit* target, Unit* caster) const
|
|||||||
SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
|
SpellPeriodicAuraLogInfo pInfo(this, damage, overkill, absorb, resist, 0.0f, crit);
|
||||||
target->SendPeriodicAuraLog(&pInfo);
|
target->SendPeriodicAuraLog(&pInfo);
|
||||||
|
|
||||||
Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true);
|
Unit::DealDamage(caster, target, damage, &cleanDamage, DOT, GetSpellInfo()->GetSchoolMask(), GetSpellInfo(), true, false);
|
||||||
|
|
||||||
Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
|
Unit::ProcDamageAndSpell(caster, target, caster ? procAttacker : 0, procVictim, procEx, damage, BASE_ATTACK, GetSpellInfo(), nullptr, GetEffIndex(), nullptr, &dmgInfo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
/*
|
||||||
|
* This file is part of the AzerothCore Project. See AUTHORS file for Copyright information
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or modify it
|
||||||
|
* under the terms of the GNU Affero General Public License as published by the
|
||||||
|
* Free Software Foundation; either version 3 of the License, or (at your
|
||||||
|
* option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||||
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for
|
||||||
|
* more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along
|
||||||
|
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "IWorld.h"
|
||||||
|
|
||||||
|
class Unit;
|
||||||
|
class IWorld;
|
||||||
|
|
||||||
|
void IWorld::AddDelayedDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss)
|
||||||
|
{
|
||||||
|
DelayedDamage delayedDamage;
|
||||||
|
delayedDamage.attacker = attacker;
|
||||||
|
delayedDamage.victim = victim;
|
||||||
|
delayedDamage.damage = damage;
|
||||||
|
delayedDamage.cleanDamage = cleanDamage;
|
||||||
|
delayedDamage.damagetype = damagetype;
|
||||||
|
delayedDamage.damageSchoolMask = damageSchoolMask;
|
||||||
|
delayedDamage.spellProto = spellProto;
|
||||||
|
delayedDamage.durabilityLoss = durabilityLoss;
|
||||||
|
_delayedDamages.push_back(delayedDamage);
|
||||||
|
}
|
||||||
@@ -24,15 +24,17 @@
|
|||||||
#include "ObjectGuid.h"
|
#include "ObjectGuid.h"
|
||||||
#include "QueryResult.h"
|
#include "QueryResult.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
|
#include "Unit.h"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
|
|
||||||
|
class IWorld;
|
||||||
|
class Player;
|
||||||
class WorldPacket;
|
class WorldPacket;
|
||||||
class WorldSession;
|
class WorldSession;
|
||||||
class Player;
|
|
||||||
|
|
||||||
/// Storage class for commands issued for delayed execution
|
/// Storage class for commands issued for delayed execution
|
||||||
struct AC_GAME_API CliCommandHolder
|
struct AC_GAME_API CliCommandHolder
|
||||||
@@ -516,10 +518,13 @@ enum Rates
|
|||||||
class IWorld
|
class IWorld
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
std::list<DelayedDamage> _delayedDamages;
|
||||||
|
|
||||||
virtual ~IWorld() = default;
|
virtual ~IWorld() = default;
|
||||||
[[nodiscard]] virtual WorldSession* FindSession(uint32 id) const = 0;
|
[[nodiscard]] virtual WorldSession* FindSession(uint32 id) const = 0;
|
||||||
[[nodiscard]] virtual WorldSession* FindOfflineSession(uint32 id) const = 0;
|
[[nodiscard]] virtual WorldSession* FindOfflineSession(uint32 id) const = 0;
|
||||||
[[nodiscard]] virtual WorldSession* FindOfflineSessionForCharacterGUID(ObjectGuid::LowType guidLow) const = 0;
|
[[nodiscard]] virtual WorldSession* FindOfflineSessionForCharacterGUID(ObjectGuid::LowType guidLow) const = 0;
|
||||||
|
virtual void AddDelayedDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss);
|
||||||
virtual void AddSession(WorldSession* s) = 0;
|
virtual void AddSession(WorldSession* s) = 0;
|
||||||
virtual bool KickSession(uint32 id) = 0;
|
virtual bool KickSession(uint32 id) = 0;
|
||||||
virtual void UpdateMaxSessionCounters() = 0;
|
virtual void UpdateMaxSessionCounters() = 0;
|
||||||
|
|||||||
@@ -2064,6 +2064,8 @@ void World::SetInitialWorldSettings()
|
|||||||
|
|
||||||
_mail_expire_check_timer = GameTime::GetGameTime() + 6h;
|
_mail_expire_check_timer = GameTime::GetGameTime() + 6h;
|
||||||
|
|
||||||
|
_timers[WUPDATE_DELAYED_DAMAGES].SetInterval(400);
|
||||||
|
|
||||||
///- Initialize MapMgr
|
///- Initialize MapMgr
|
||||||
LOG_INFO("server.loading", "Starting Map System");
|
LOG_INFO("server.loading", "Starting Map System");
|
||||||
LOG_INFO("server.loading", " ");
|
LOG_INFO("server.loading", " ");
|
||||||
@@ -2310,6 +2312,12 @@ void World::Update(uint32 diff)
|
|||||||
{
|
{
|
||||||
METRIC_TIMER("world_update_time", METRIC_TAG("type", "Check quest reset times"));
|
METRIC_TIMER("world_update_time", METRIC_TAG("type", "Check quest reset times"));
|
||||||
|
|
||||||
|
if (_timers[WUPDATE_DELAYED_DAMAGES].Passed())
|
||||||
|
{
|
||||||
|
_timers[WUPDATE_DELAYED_DAMAGES].Reset();
|
||||||
|
ProcessDelayedDamages();
|
||||||
|
}
|
||||||
|
|
||||||
/// Handle daily quests reset time
|
/// Handle daily quests reset time
|
||||||
if (currentGameTime > _nextDailyQuestReset)
|
if (currentGameTime > _nextDailyQuestReset)
|
||||||
{
|
{
|
||||||
@@ -3331,3 +3339,24 @@ CliCommandHolder::~CliCommandHolder()
|
|||||||
{
|
{
|
||||||
free(m_command);
|
free(m_command);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void World::AddDelayedDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss)
|
||||||
|
{
|
||||||
|
DelayedDamage delayedDamage;
|
||||||
|
delayedDamage.attacker = attacker;
|
||||||
|
delayedDamage.victim = victim;
|
||||||
|
delayedDamage.damage = damage;
|
||||||
|
delayedDamage.cleanDamage = cleanDamage;
|
||||||
|
delayedDamage.damagetype = damagetype;
|
||||||
|
delayedDamage.damageSchoolMask = damageSchoolMask;
|
||||||
|
delayedDamage.spellProto = spellProto;
|
||||||
|
delayedDamage.durabilityLoss = durabilityLoss;
|
||||||
|
_delayedDamages.push_back(delayedDamage);
|
||||||
|
}
|
||||||
|
|
||||||
|
void World::ProcessDelayedDamages()
|
||||||
|
{
|
||||||
|
for (auto& damage : _delayedDamages)
|
||||||
|
Unit::DealDamage(damage.attacker, damage.victim, damage.damage, damage.cleanDamage, damage.damagetype, damage.damageSchoolMask, damage.spellProto, damage.durabilityLoss);
|
||||||
|
_delayedDamages.clear();
|
||||||
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
#include "QueryResult.h"
|
#include "QueryResult.h"
|
||||||
#include "SharedDefines.h"
|
#include "SharedDefines.h"
|
||||||
#include "Timer.h"
|
#include "Timer.h"
|
||||||
|
#include "Unit.h"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <map>
|
#include <map>
|
||||||
@@ -70,6 +71,7 @@ enum WorldTimers
|
|||||||
WUPDATE_PINGDB,
|
WUPDATE_PINGDB,
|
||||||
WUPDATE_5_SECS,
|
WUPDATE_5_SECS,
|
||||||
WUPDATE_WHO_LIST,
|
WUPDATE_WHO_LIST,
|
||||||
|
WUPDATE_DELAYED_DAMAGES,
|
||||||
WUPDATE_COUNT
|
WUPDATE_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -153,6 +155,8 @@ public:
|
|||||||
World();
|
World();
|
||||||
~World() override;
|
~World() override;
|
||||||
|
|
||||||
|
std::list<DelayedDamage> _delayedDamages;
|
||||||
|
|
||||||
static World* instance();
|
static World* instance();
|
||||||
|
|
||||||
static uint32 m_worldLoopCounter;
|
static uint32 m_worldLoopCounter;
|
||||||
@@ -351,6 +355,10 @@ public:
|
|||||||
|
|
||||||
void RemoveOldCorpses() override;
|
void RemoveOldCorpses() override;
|
||||||
|
|
||||||
|
void AddDelayedDamage(Unit* attacker, Unit* victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss) override;
|
||||||
|
|
||||||
|
void ProcessDelayedDamages();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void _UpdateGameTime();
|
void _UpdateGameTime();
|
||||||
// callback for UpdateRealmCharacters
|
// callback for UpdateRealmCharacters
|
||||||
|
|||||||
Reference in New Issue
Block a user