fix(core\player): Missing combat animation (#14199)

This commit is contained in:
M'Dic
2023-04-29 06:27:13 -04:00
committed by GitHub
parent e5665c32f8
commit a238e5e27b
7 changed files with 100 additions and 5 deletions

View File

@@ -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);
}

View File

@@ -24,15 +24,17 @@
#include "ObjectGuid.h"
#include "QueryResult.h"
#include "SharedDefines.h"
#include "Unit.h"
#include <atomic>
#include <list>
#include <map>
#include <set>
#include <unordered_map>
class IWorld;
class Player;
class WorldPacket;
class WorldSession;
class Player;
/// Storage class for commands issued for delayed execution
struct AC_GAME_API CliCommandHolder
@@ -516,10 +518,13 @@ enum Rates
class IWorld
{
public:
std::list<DelayedDamage> _delayedDamages;
virtual ~IWorld() = default;
[[nodiscard]] virtual WorldSession* FindSession(uint32 id) const = 0;
[[nodiscard]] virtual WorldSession* FindOfflineSession(uint32 id) 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 bool KickSession(uint32 id) = 0;
virtual void UpdateMaxSessionCounters() = 0;

View File

@@ -2064,6 +2064,8 @@ void World::SetInitialWorldSettings()
_mail_expire_check_timer = GameTime::GetGameTime() + 6h;
_timers[WUPDATE_DELAYED_DAMAGES].SetInterval(400);
///- Initialize MapMgr
LOG_INFO("server.loading", "Starting Map System");
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"));
if (_timers[WUPDATE_DELAYED_DAMAGES].Passed())
{
_timers[WUPDATE_DELAYED_DAMAGES].Reset();
ProcessDelayedDamages();
}
/// Handle daily quests reset time
if (currentGameTime > _nextDailyQuestReset)
{
@@ -3331,3 +3339,24 @@ CliCommandHolder::~CliCommandHolder()
{
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();
}

View File

@@ -28,6 +28,7 @@
#include "QueryResult.h"
#include "SharedDefines.h"
#include "Timer.h"
#include "Unit.h"
#include <atomic>
#include <list>
#include <map>
@@ -70,6 +71,7 @@ enum WorldTimers
WUPDATE_PINGDB,
WUPDATE_5_SECS,
WUPDATE_WHO_LIST,
WUPDATE_DELAYED_DAMAGES,
WUPDATE_COUNT
};
@@ -153,6 +155,8 @@ public:
World();
~World() override;
std::list<DelayedDamage> _delayedDamages;
static World* instance();
static uint32 m_worldLoopCounter;
@@ -351,6 +355,10 @@ public:
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:
void _UpdateGameTime();
// callback for UpdateRealmCharacters