mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-17 02:50:29 +00:00
fix(Scripts/Kalimdor): fix Azuregos respawn timer not persisting after restarts (#10823)
This commit is contained in:
@@ -3517,3 +3517,12 @@ void Creature::SetRespawnTime(uint32 respawn)
|
||||
{
|
||||
m_respawnTime = respawn ? GameTime::GetGameTime().count() + respawn : 0;
|
||||
}
|
||||
|
||||
void Creature::SaveRespawnTimeToDB()
|
||||
{
|
||||
if (Map* map = GetMap())
|
||||
{
|
||||
time_t respawnTimer = GetRespawnTime();
|
||||
map->SaveCreatureRespawnTime(GetSpawnId(), respawnTimer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,6 +275,7 @@ public:
|
||||
[[nodiscard]] time_t const& GetRespawnTime() const { return m_respawnTime; }
|
||||
[[nodiscard]] time_t GetRespawnTimeEx() const;
|
||||
void SetRespawnTime(uint32 respawn);
|
||||
void SaveRespawnTimeToDB();
|
||||
void Respawn(bool force = false);
|
||||
void SaveRespawnTime() override;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "GameTime.h"
|
||||
#include "Player.h"
|
||||
#include "ScriptedGossip.h"
|
||||
#include "ScriptedCreature.h"
|
||||
@@ -142,6 +143,7 @@ public:
|
||||
});
|
||||
|
||||
me->SetRespawnTime(urand(2 * DAY, 3 * DAY));
|
||||
me->SaveRespawnTimeToDB();
|
||||
}
|
||||
|
||||
void UpdateAI(uint32 diff) override
|
||||
|
||||
Reference in New Issue
Block a user