diff --git a/zone/client.cpp b/zone/client.cpp index fd40002a6..9bc6dd5b3 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -232,8 +232,9 @@ Client::Client(EQStreamInterface* ieqs) linkdead_timer.Disable(); zonesummon_id = 0; zonesummon_ignorerestrictions = 0; - bZoning = false; - zone_mode = ZoneUnsolicited; + bZoning = false; + m_lock_save_position = false; + zone_mode = ZoneUnsolicited; casting_spell_id = 0; npcflag = false; npclevel = 0; @@ -634,11 +635,14 @@ bool Client::Save(uint8 iCommitNow) { return false; /* Wrote current basics to PP for saves */ - m_pp.x = m_Position.x; - m_pp.y = m_Position.y; - m_pp.z = m_Position.z; + if (!m_lock_save_position) { + m_pp.x = m_Position.x; + m_pp.y = m_Position.y; + m_pp.z = m_Position.z; + m_pp.heading = m_Position.w; + } + m_pp.guildrank = guildrank; - m_pp.heading = m_Position.w; /* Mana and HP */ if (GetHP() <= 0) { @@ -11827,3 +11831,13 @@ bool Client::HasRecipeLearned(uint32 recipe_id) return false; } + +bool Client::IsLockSavePosition() const +{ + return m_lock_save_position; +} + +void Client::SetLockSavePosition(bool lock_save_position) +{ + Client::m_lock_save_position = lock_save_position; +} diff --git a/zone/client.h b/zone/client.h index 9b71cdc21..ba270f019 100644 --- a/zone/client.h +++ b/zone/client.h @@ -1801,6 +1801,13 @@ private: int32 max_end; int32 current_endurance; + // https://github.com/EQEmu/Server/pull/2479 + bool m_lock_save_position = false; +public: + bool IsLockSavePosition() const; + void SetLockSavePosition(bool lock_save_position); +private: + PlayerProfile_Struct m_pp; ExtendedProfile_Struct m_epp; EQ::InventoryProfile m_inv; diff --git a/zone/worldserver.cpp b/zone/worldserver.cpp index 7d1059aba..ec2cb9b85 100644 --- a/zone/worldserver.cpp +++ b/zone/worldserver.cpp @@ -365,6 +365,7 @@ void WorldServer::HandleMessage(uint16 opcode, const EQ::Net::Packet &p) zc2->success = ZONE_ERROR_NOTREADY; entity->CastToMob()->SetZone(ztz->current_zone_id, ztz->current_instance_id); entity->CastToClient()->SetZoning(false); + entity->CastToClient()->SetLockSavePosition(false); } else { entity->CastToClient()->UpdateWho(1); diff --git a/zone/zoning.cpp b/zone/zoning.cpp index 9753d3a29..36616028f 100644 --- a/zone/zoning.cpp +++ b/zone/zoning.cpp @@ -394,6 +394,8 @@ void Client::SendZoneCancel(ZoneChange_Struct *zc) { zone_mode = ZoneUnsolicited; // reset since we're not zoning anymore bZoning = false; + // remove save position lock + m_lock_save_position = false; } void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) @@ -413,6 +415,8 @@ void Client::SendZoneError(ZoneChange_Struct *zc, int8 err) zone_mode = ZoneUnsolicited; // reset since we're not zoning anymore bZoning = false; + // remove save position lock + m_lock_save_position = false; } void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instance_id, float dest_x, float dest_y, float dest_z, float dest_h, int8 ignore_r) { @@ -467,6 +471,8 @@ void Client::DoZoneSuccess(ZoneChange_Struct *zc, uint16 zone_id, uint32 instanc //Force a save so its waiting for them when they zone Save(2); + m_lock_save_position = true; + if (zone_id == zone->GetZoneID() && instance_id == zone->GetInstanceID()) { // No need to ask worldserver if we're zoning to ourselves (most // likely to a bind point), also fixes a bug since the default response was failure