mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-31 04:56:20 +00:00
Move conversion to world
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user