mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
fix(Core/Maps): Move corpse expiration updates to map (#22780)
This commit is contained in:
@@ -73,6 +73,8 @@ Map::Map(uint32 id, uint32 InstanceId, uint8 SpawnMode, Map* _parent) :
|
||||
|
||||
//lets initialize visibility distance for map
|
||||
Map::InitVisibilityDistance();
|
||||
|
||||
_corpseUpdateTimer.SetInterval(20 * MINUTE * IN_MILLISECONDS);
|
||||
}
|
||||
|
||||
// Hook called after map is created AND after added to map list
|
||||
@@ -494,6 +496,8 @@ void Map::Update(const uint32 t_diff, const uint32 s_diff, bool /*thread*/)
|
||||
|
||||
HandleDelayedVisibility();
|
||||
|
||||
UpdateExpiredCorpses(t_diff);
|
||||
|
||||
sScriptMgr->OnMapUpdate(this, t_diff);
|
||||
|
||||
METRIC_VALUE("map_creatures", uint64(GetObjectsStore().Size<Creature>()),
|
||||
@@ -1580,6 +1584,17 @@ void Map::SendInitSelf(Player* player)
|
||||
player->SendDirectMessage(&packet);
|
||||
}
|
||||
|
||||
void Map::UpdateExpiredCorpses(uint32 const diff)
|
||||
{
|
||||
_corpseUpdateTimer.Update(diff);
|
||||
if (!_corpseUpdateTimer.Passed())
|
||||
return;
|
||||
|
||||
RemoveOldCorpses();
|
||||
|
||||
_corpseUpdateTimer.Reset();
|
||||
}
|
||||
|
||||
void Map::SendInitTransports(Player* player)
|
||||
{
|
||||
if (_transports.empty())
|
||||
|
||||
@@ -443,6 +443,8 @@ public:
|
||||
void SendZoneDynamicInfo(Player* player);
|
||||
void SendInitSelf(Player* player);
|
||||
|
||||
void UpdateExpiredCorpses(uint32 const diff);
|
||||
|
||||
void PlayDirectSoundToMap(uint32 soundId, uint32 zoneId = 0);
|
||||
void SetZoneMusic(uint32 zoneId, uint32 musicId);
|
||||
void SetZoneWeather(uint32 zoneId, WeatherState weatherId, float weatherGrade);
|
||||
@@ -576,6 +578,8 @@ private:
|
||||
ZoneDynamicInfoMap _zoneDynamicInfo;
|
||||
uint32 _defaultLight;
|
||||
|
||||
IntervalTimer _corpseUpdateTimer;
|
||||
|
||||
template<HighGuid high>
|
||||
inline ObjectGuidGeneratorBase& GetGuidSequenceGenerator()
|
||||
{
|
||||
|
||||
@@ -110,7 +110,6 @@ public:
|
||||
virtual void ResetEventSeasonalQuests(uint16 event_id) = 0;
|
||||
[[nodiscard]] virtual std::string const& GetRealmName() const = 0;
|
||||
virtual void SetRealmName(std::string name) = 0;
|
||||
virtual void RemoveOldCorpses() = 0;
|
||||
};
|
||||
|
||||
#endif //AZEROTHCORE_IWORLD_H
|
||||
|
||||
@@ -888,8 +888,6 @@ void World::SetInitialWorldSettings()
|
||||
_timers[WUPDATE_UPTIME].SetInterval(getIntConfig(CONFIG_UPTIME_UPDATE)*MINUTE * IN_MILLISECONDS);
|
||||
//Update "uptime" table based on configuration entry in minutes.
|
||||
|
||||
_timers[WUPDATE_CORPSES].SetInterval(20 * MINUTE * IN_MILLISECONDS);
|
||||
//erase corpses every 20 minutes
|
||||
_timers[WUPDATE_CLEANDB].SetInterval(getIntConfig(CONFIG_LOGDB_CLEARINTERVAL)*MINUTE * IN_MILLISECONDS);
|
||||
// clean logs table every 14 days by default
|
||||
_timers[WUPDATE_AUTOBROADCAST].SetInterval(getIntConfig(CONFIG_AUTOBROADCAST_INTERVAL));
|
||||
@@ -1278,18 +1276,6 @@ void World::Update(uint32 diff)
|
||||
LoginDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
///- Erase corpses once every 20 minutes
|
||||
if (_timers[WUPDATE_CORPSES].Passed())
|
||||
{
|
||||
METRIC_TIMER("world_update_time", METRIC_TAG("type", "Remove old corpses"));
|
||||
_timers[WUPDATE_CORPSES].Reset();
|
||||
|
||||
sMapMgr->DoForAllMaps([](Map* map)
|
||||
{
|
||||
map->RemoveOldCorpses();
|
||||
});
|
||||
}
|
||||
|
||||
///- Process Game events when necessary
|
||||
if (_timers[WUPDATE_EVENTS].Passed())
|
||||
{
|
||||
@@ -1824,11 +1810,6 @@ void World::ProcessQueryCallbacks()
|
||||
_queryProcessor.ProcessReadyCallbacks();
|
||||
}
|
||||
|
||||
void World::RemoveOldCorpses()
|
||||
{
|
||||
_timers[WUPDATE_CORPSES].SetCurrent(_timers[WUPDATE_CORPSES].GetInterval());
|
||||
}
|
||||
|
||||
bool World::IsPvPRealm() const
|
||||
{
|
||||
return getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP || getIntConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP;
|
||||
|
||||
@@ -60,7 +60,6 @@ enum WorldTimers
|
||||
{
|
||||
WUPDATE_WEATHERS,
|
||||
WUPDATE_UPTIME,
|
||||
WUPDATE_CORPSES,
|
||||
WUPDATE_EVENTS,
|
||||
WUPDATE_CLEANDB,
|
||||
WUPDATE_AUTOBROADCAST,
|
||||
@@ -241,8 +240,6 @@ public:
|
||||
[[nodiscard]] std::string const& GetRealmName() const override { return _realmName; } // pussywizard
|
||||
void SetRealmName(std::string name) override { _realmName = name; } // pussywizard
|
||||
|
||||
void RemoveOldCorpses() override;
|
||||
|
||||
protected:
|
||||
void _UpdateGameTime();
|
||||
// callback for UpdateRealmCharacters
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "GameTime.h"
|
||||
#include "GitRevision.h"
|
||||
#include "Log.h"
|
||||
#include "MapMgr.h"
|
||||
#include "ModuleMgr.h"
|
||||
#include "MotdMgr.h"
|
||||
#include "MySQLThreading.h"
|
||||
@@ -101,7 +102,10 @@ public:
|
||||
// Triggering corpses expire check in world
|
||||
static bool HandleServerCorpsesCommand(ChatHandler* /*handler*/)
|
||||
{
|
||||
sWorld->RemoveOldCorpses();
|
||||
sMapMgr->DoForAllMaps([](Map* map)
|
||||
{
|
||||
map->RemoveOldCorpses();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user