mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-02-01 18:13:48 +00:00
feat(Core/SavingSystem): remove old player saving system (#9779)
This commit is contained in:
@@ -66,7 +66,6 @@
|
||||
#include "QueryHolder.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "Realm.h"
|
||||
#include "SavingSystem.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "Spell.h"
|
||||
@@ -192,7 +191,6 @@ Player::Player(WorldSession* session): Unit(true), m_mover(this)
|
||||
|
||||
m_needZoneUpdate = false;
|
||||
|
||||
m_nextSave = SavingSystemMgr::IncreaseSavingMaxValue(1);
|
||||
m_additionalSaveTimer = 0;
|
||||
m_additionalSaveMask = 0;
|
||||
m_hostileReferenceCheckTimer = 15000;
|
||||
|
||||
@@ -58,7 +58,6 @@
|
||||
#include "QueryHolder.h"
|
||||
#include "QuestDef.h"
|
||||
#include "ReputationMgr.h"
|
||||
#include "SavingSystem.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SocialMgr.h"
|
||||
#include "Spell.h"
|
||||
@@ -7176,16 +7175,6 @@ void Player::SaveToDB(CharacterDatabaseTransaction trans, bool create, bool logo
|
||||
// save pet (hunter pet level and experience and all type pets health/mana).
|
||||
if (Pet* pet = GetPet())
|
||||
pet->SavePetToDB(PET_SAVE_AS_CURRENT, logout);
|
||||
|
||||
// our: saving system
|
||||
if (!create && !logout)
|
||||
{
|
||||
// pussywizard: if it was not yet our time to save, be we are saved (additional save after important changes)
|
||||
// pussywizard: then free our original ticket in saving queue, so saving is fluent with no gaps
|
||||
SavingSystemMgr::InsertToSavingSkipListIfNeeded(m_nextSave);
|
||||
|
||||
m_nextSave = SavingSystemMgr::IncreaseSavingMaxValue(1);
|
||||
}
|
||||
}
|
||||
|
||||
// fast save function for item/money cheating preventing - save only inventory and money state
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
#include "OutdoorPvPMgr.h"
|
||||
#include "Pet.h"
|
||||
#include "Player.h"
|
||||
#include "SavingSystem.h"
|
||||
#include "ScriptMgr.h"
|
||||
#include "SkillDiscovery.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
@@ -316,35 +315,18 @@ void Player::Update(uint32 p_time)
|
||||
if (m_deathState == JUST_DIED)
|
||||
KillPlayer();
|
||||
|
||||
if (m_nextSave <= SavingSystemMgr::GetSavingCurrentValue() &&
|
||||
!GetSession()->isLogingOut())
|
||||
SaveToDB(false, false);
|
||||
else if (m_additionalSaveTimer && !GetSession()->isLogingOut()) // pussywizard:
|
||||
if (m_nextSave)
|
||||
{
|
||||
if (m_additionalSaveTimer <= p_time)
|
||||
if (p_time >= m_nextSave)
|
||||
{
|
||||
CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
if (m_additionalSaveMask & ADDITIONAL_SAVING_INVENTORY_AND_GOLD)
|
||||
SaveInventoryAndGoldToDB(trans);
|
||||
if (m_additionalSaveMask & ADDITIONAL_SAVING_QUEST_STATUS)
|
||||
{
|
||||
_SaveQuestStatus(trans);
|
||||
|
||||
// xinef: if nothing changed, nothing will happen
|
||||
_SaveDailyQuestStatus(trans);
|
||||
_SaveWeeklyQuestStatus(trans);
|
||||
_SaveSeasonalQuestStatus(trans);
|
||||
_SaveMonthlyQuestStatus(trans);
|
||||
}
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
m_additionalSaveTimer = 0;
|
||||
m_additionalSaveMask = 0;
|
||||
// m_nextSave reset in SaveToDB call
|
||||
SaveToDB(false, false);
|
||||
FMT_LOG_DEBUG("entities.player", "Player::Update: Player '{}' ({}) saved", GetName(), GetGUID().ToString());
|
||||
}
|
||||
else
|
||||
m_additionalSaveTimer -= p_time;
|
||||
{
|
||||
m_nextSave -= p_time;
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Water/drowning
|
||||
|
||||
Reference in New Issue
Block a user