mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 11:31:30 +00:00
Move conversion to world
This commit is contained in:
parent
d87d1dfb1d
commit
3c4cc74a54
@ -2288,3 +2288,22 @@ uint64_t Database::GetNextTableId(const std::string &table_name)
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void Database::ConvertInventoryToNewUniqueId()
|
||||
{
|
||||
LogInfo("Converting inventory entries with NULL item_unique_id");
|
||||
auto results = InventoryRepository::GetWhere(*this, "`item_unique_id` IS NULL");
|
||||
|
||||
if (results.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
TransactionBegin();
|
||||
for (auto &r: results) {
|
||||
r.item_unique_id = EQ::UniqueHashGenerator::generate();
|
||||
}
|
||||
|
||||
InventoryRepository::ReplaceMany(*this, results);
|
||||
TransactionCommit();
|
||||
LogInfo("Converted {} records", results.size());
|
||||
}
|
||||
@ -278,6 +278,7 @@ public:
|
||||
void Decode(std::string &in);
|
||||
|
||||
uint64_t GetNextTableId(const std::string& table_name);
|
||||
void ConvertInventoryToNewUniqueId();
|
||||
|
||||
private:
|
||||
Mutex Mvarcache;
|
||||
|
||||
@ -717,6 +717,8 @@ bool SharedDatabase::GetInventory(Client *c)
|
||||
inst->SetOrnamentationIDFile(ornament_idfile);
|
||||
inst->SetOrnamentHeroModel(item->HerosForgeModel);
|
||||
|
||||
//Mass conversion handled by world
|
||||
//This remains as a backup. Should not be required.
|
||||
if (row.item_unique_id.empty()) {
|
||||
inst->CreateUniqueID();
|
||||
row.item_unique_id = inst->GetUniqueID();
|
||||
|
||||
@ -15,6 +15,9 @@
|
||||
#include "../common/database.h"
|
||||
#include "../common/events/player_event_logs.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include "../common/evolving_items.h"
|
||||
#include "../common/content/world_content_service.h"
|
||||
|
||||
#include <time.h>
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
@ -295,6 +295,8 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv)
|
||||
database.ClearBuyerDetails();
|
||||
LogInfo("Clearing buyer table details");
|
||||
|
||||
database.ConvertInventoryToNewUniqueId();
|
||||
|
||||
if (RuleB(Bots, Enabled)) {
|
||||
LogInfo("Clearing [bot_pet_buffs] table of stale entries");
|
||||
database.QueryDatabase(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user