mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-13 18:51:29 +00:00
[Performance] Character Save Optimizations (#4851)
This commit is contained in:
parent
50ad97aa0b
commit
b883888a19
@ -995,6 +995,8 @@ bool Client::Save(uint8 iCommitNow) {
|
|||||||
if(!ClientDataLoaded())
|
if(!ClientDataLoaded())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
BenchTimer timer;
|
||||||
|
|
||||||
/* Wrote current basics to PP for saves */
|
/* Wrote current basics to PP for saves */
|
||||||
if (!m_lock_save_position) {
|
if (!m_lock_save_position) {
|
||||||
m_pp.x = m_Position.x;
|
m_pp.x = m_Position.x;
|
||||||
@ -1022,6 +1024,8 @@ bool Client::Save(uint8 iCommitNow) {
|
|||||||
m_pp.endurance = current_endurance;
|
m_pp.endurance = current_endurance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
database.TransactionBegin();
|
||||||
|
|
||||||
/* Save Character Currency */
|
/* Save Character Currency */
|
||||||
database.SaveCharacterCurrency(CharacterID(), &m_pp);
|
database.SaveCharacterCurrency(CharacterID(), &m_pp);
|
||||||
|
|
||||||
@ -1105,6 +1109,10 @@ bool Client::Save(uint8 iCommitNow) {
|
|||||||
database.botdb.SaveBotSettings(this);
|
database.botdb.SaveBotSettings(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
database.TransactionCommit();
|
||||||
|
|
||||||
|
LogInfo("Save for [{}] took [{}]", GetCleanName(), timer.elapsed());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -483,6 +483,9 @@ public:
|
|||||||
|
|
||||||
virtual bool Save() { return Save(0); }
|
virtual bool Save() { return Save(0); }
|
||||||
bool Save(uint8 iCommitNow); // 0 = delayed, 1=async now, 2=sync now
|
bool Save(uint8 iCommitNow); // 0 = delayed, 1=async now, 2=sync now
|
||||||
|
inline void SaveCharacterData() {
|
||||||
|
database.SaveCharacterData(this, &m_pp, &m_epp);
|
||||||
|
};
|
||||||
|
|
||||||
/* New PP Save Functions */
|
/* New PP Save Functions */
|
||||||
bool SaveCurrency(){ return database.SaveCharacterCurrency(this->CharacterID(), &m_pp); }
|
bool SaveCurrency(){ return database.SaveCharacterCurrency(this->CharacterID(), &m_pp); }
|
||||||
|
|||||||
@ -217,6 +217,8 @@ bool Client::Process() {
|
|||||||
GetMerc()->Depop();
|
GetMerc()->Depop();
|
||||||
}
|
}
|
||||||
instalog = true;
|
instalog = true;
|
||||||
|
|
||||||
|
camp_timer.Disable();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsStunned() && stunned_timer.Check())
|
if (IsStunned() && stunned_timer.Check())
|
||||||
|
|||||||
@ -4621,8 +4621,12 @@ void Mob::SetZone(uint32 zone_id, uint32 instance_id)
|
|||||||
{
|
{
|
||||||
CastToClient()->GetPP().zone_id = zone_id;
|
CastToClient()->GetPP().zone_id = zone_id;
|
||||||
CastToClient()->GetPP().zoneInstance = instance_id;
|
CastToClient()->GetPP().zoneInstance = instance_id;
|
||||||
|
CastToClient()->SaveCharacterData();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsClient()) {
|
||||||
|
Save(); // bots or other things might be covered here for some reason
|
||||||
}
|
}
|
||||||
Save();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Mob::Kill() {
|
void Mob::Kill() {
|
||||||
|
|||||||
@ -528,8 +528,12 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc
|
|||||||
m_pp.zone_id = zone_id;
|
m_pp.zone_id = zone_id;
|
||||||
m_pp.zoneInstance = instance_id;
|
m_pp.zoneInstance = instance_id;
|
||||||
|
|
||||||
//Force a save so its waiting for them when they zone
|
// save character position
|
||||||
Save(2);
|
m_pp.x = m_Position.x;
|
||||||
|
m_pp.y = m_Position.y;
|
||||||
|
m_pp.z = m_Position.z;
|
||||||
|
m_pp.heading = m_Position.w;
|
||||||
|
SaveCharacterData();
|
||||||
|
|
||||||
m_lock_save_position = true;
|
m_lock_save_position = true;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user