mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-10-02 10:53:44 +00:00
feat: store each named pet's LOT in pet_names
pet_names gets a pet_lot column (mysql 80, sqlite 63). The world writes it whenever it saves a pet name, from the pet entity's LOT, and fills it in for older rows when the owner loads into a world (from the pets the game loads for that character, only where it is still missing). The dashboard's pet name tables read pet_lot instead of scanning the owner's character XML; pets without it yet show as Unknown. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1731,9 +1731,9 @@ void InventoryComponent::LoadPetXml(const tinyxml2::XMLDocument& document) {
|
||||
auto* petElement = petInventoryElement->FirstChildElement();
|
||||
|
||||
while (petElement != nullptr) {
|
||||
LWOOBJID id;
|
||||
LOT lot;
|
||||
int32_t moderationStatus;
|
||||
LWOOBJID id{};
|
||||
LOT lot{};
|
||||
int32_t moderationStatus{};
|
||||
|
||||
petElement->QueryAttribute("id", &id);
|
||||
petElement->QueryAttribute("l", &lot);
|
||||
@@ -1747,6 +1747,9 @@ void InventoryComponent::LoadPetXml(const tinyxml2::XMLDocument& document) {
|
||||
|
||||
SetDatabasePet(id, databasePet);
|
||||
|
||||
// Pets named before pet_names recorded their LOT get it now that their owner is loaded
|
||||
if (id != LWOOBJID_EMPTY && lot > 0) Database::Get()->SetPetLotIfMissing(id, lot);
|
||||
|
||||
petElement = petElement->NextSiblingElement();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user