mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-05 20:33:44 +00:00
feat: save_property_location, logging back in on a property
A character's location was only saved outside properties, so logging out on a property and back in always went to the last world before it (as live). save_property_location=1 (worldconfig.ini, dashboard: world settings) saves it on properties too, and login returns to that property. Off by default. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include "Logger.h"
|
||||
#include "BitStream.h"
|
||||
#include "Game.h"
|
||||
#include "dConfig.h"
|
||||
#include <chrono>
|
||||
#include "Entity.h"
|
||||
#include "EntityManager.h"
|
||||
@@ -282,8 +283,11 @@ void Character::SaveXMLToDatabase() {
|
||||
character->SetAttribute("cc", m_Coins);
|
||||
|
||||
auto zoneInfo = Game::zoneManager->GetZone()->GetZoneID();
|
||||
// Where the character logs back in. Not a property (a clone) unless save_property_location is 1: by default
|
||||
// logging in from a property goes to the last world before it.
|
||||
const bool savesHere = zoneInfo.GetCloneID() == 0 || (Game::config && Game::config->GetValue("save_property_location") == "1");
|
||||
// lzid garbage, binary concat of zoneID, zoneInstance and zoneClone
|
||||
if (zoneInfo.GetMapID() != 0 && zoneInfo.GetCloneID() == 0 && !Game::zoneManager->GetDisableSaveLocation()) {
|
||||
if (zoneInfo.GetMapID() != 0 && savesHere && !Game::zoneManager->GetDisableSaveLocation()) {
|
||||
uint64_t lzidConcat = zoneInfo.GetCloneID();
|
||||
lzidConcat = (lzidConcat << 16) | uint16_t(zoneInfo.GetInstanceID());
|
||||
lzidConcat = (lzidConcat << 16) | uint16_t(zoneInfo.GetMapID());
|
||||
|
||||
Reference in New Issue
Block a user