revert(Core/Player): Revert Delayed Damage System (#16246)

* Revert "fix(Core/Spells): Delayed Damage system (#16183)"

This reverts commit d282cce4af.

* Revert "fix: Crash on ProcessDelayedDamages (#16166)"

This reverts commit 3dbdea5e28.

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

This reverts commit a238e5e27b.
This commit is contained in:
Gultask
2023-05-13 13:50:27 -03:00
committed by GitHub
parent f2e01028cf
commit 64c7c99bda
9 changed files with 5 additions and 131 deletions

View File

@@ -1,37 +0,0 @@
/*
* 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(ObjectGuid attacker, ObjectGuid victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, uint32 mapId, uint32 instanceId)
{
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;
delayedDamage.mapId = mapId;
delayedDamage.instanceId = instanceId;
_delayedDamages.push_back(delayedDamage);
}

View File

@@ -24,17 +24,15 @@
#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
@@ -518,13 +516,10 @@ 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(ObjectGuid attacker, ObjectGuid victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, uint32 mapId, uint32 instanceId);
virtual void AddSession(WorldSession* s) = 0;
virtual bool KickSession(uint32 id) = 0;
virtual void UpdateMaxSessionCounters() = 0;

View File

@@ -2064,8 +2064,6 @@ 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", " ");
@@ -2312,12 +2310,6 @@ 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)
{
@@ -3339,39 +3331,3 @@ CliCommandHolder::~CliCommandHolder()
{
free(m_command);
}
void World::AddDelayedDamage(ObjectGuid attacker, ObjectGuid victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, uint32 mapId, uint32 instanceId)
{
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;
delayedDamage.mapId = mapId;
delayedDamage.instanceId = instanceId;
_delayedDamages.push_back(delayedDamage);
}
void World::ProcessDelayedDamages()
{
for (auto& damage : _delayedDamages)
{
// Get map first
Map* map = sMapMgr->FindMap(damage.mapId, damage.instanceId);
if (!map)
continue;
// Now we get both, attacker and victim, but attacker can be null (although attacker is always a player).
Unit* attacker = ObjectAccessor::GetUnit(map, damage.attacker);
Unit* victim = ObjectAccessor::GetUnit(map, damage.victim);
if (!victim)
continue;
Unit::DealDamage(attacker, victim, damage.damage, damage.cleanDamage, damage.damagetype, damage.damageSchoolMask, damage.spellProto, damage.durabilityLoss);
}
_delayedDamages.clear();
}

View File

@@ -28,7 +28,6 @@
#include "QueryResult.h"
#include "SharedDefines.h"
#include "Timer.h"
#include "Unit.h"
#include <atomic>
#include <list>
#include <map>
@@ -71,7 +70,6 @@ enum WorldTimers
WUPDATE_PINGDB,
WUPDATE_5_SECS,
WUPDATE_WHO_LIST,
WUPDATE_DELAYED_DAMAGES,
WUPDATE_COUNT
};
@@ -155,8 +153,6 @@ public:
World();
~World() override;
std::list<DelayedDamage> _delayedDamages;
static World* instance();
static uint32 m_worldLoopCounter;
@@ -355,10 +351,6 @@ public:
void RemoveOldCorpses() override;
void AddDelayedDamage(ObjectGuid attacker, ObjectGuid victim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellInfo const* spellProto, bool durabilityLoss, uint32 mapId, uint32 instanceId) override;
void ProcessDelayedDamages();
protected:
void _UpdateGameTime();
// callback for UpdateRealmCharacters