This commit is contained in:
Mitch Freeman 2025-04-05 22:55:21 -03:00
parent 6a9bc7e6c1
commit c797fcca87
4 changed files with 33 additions and 21 deletions

View File

@ -37,7 +37,8 @@ public:
uint32_t ornament_icon;
uint32_t ornament_idfile;
int32_t ornament_hero_model;
std::string serial_number;
std::string item_unique_id;
uint32_t guid;
};
static std::string PrimaryKey()
@ -66,7 +67,8 @@ public:
"ornament_icon",
"ornament_idfile",
"ornament_hero_model",
"serial_number",
"item_unique_id",
"guid",
};
}
@ -91,7 +93,8 @@ public:
"ornament_icon",
"ornament_idfile",
"ornament_hero_model",
"serial_number",
"item_unique_id",
"guid",
};
}
@ -150,7 +153,8 @@ public:
e.ornament_icon = 0;
e.ornament_idfile = 0;
e.ornament_hero_model = 0;
e.serial_number = "";
e.item_unique_id = "";
e.guid = 0;
return e;
}
@ -205,7 +209,8 @@ public:
e.ornament_icon = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
e.ornament_idfile = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
e.ornament_hero_model = row[17] ? static_cast<int32_t>(atoi(row[17])) : 0;
e.serial_number = row[18] ? row[18] : "";
e.item_unique_id = row[18] ? row[18] : "";
e.guid = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
return e;
}
@ -257,7 +262,8 @@ public:
v.push_back(columns[15] + " = " + std::to_string(e.ornament_icon));
v.push_back(columns[16] + " = " + std::to_string(e.ornament_idfile));
v.push_back(columns[17] + " = " + std::to_string(e.ornament_hero_model));
v.push_back(columns[18] + " = '" + Strings::Escape(e.serial_number) + "'");
v.push_back(columns[18] + " = '" + Strings::Escape(e.item_unique_id) + "'");
v.push_back(columns[19] + " = " + std::to_string(e.guid));
auto results = db.QueryDatabase(
fmt::format(
@ -297,7 +303,8 @@ public:
v.push_back(std::to_string(e.ornament_icon));
v.push_back(std::to_string(e.ornament_idfile));
v.push_back(std::to_string(e.ornament_hero_model));
v.push_back("'" + Strings::Escape(e.serial_number) + "'");
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
v.push_back(std::to_string(e.guid));
auto results = db.QueryDatabase(
fmt::format(
@ -345,7 +352,8 @@ public:
v.push_back(std::to_string(e.ornament_icon));
v.push_back(std::to_string(e.ornament_idfile));
v.push_back(std::to_string(e.ornament_hero_model));
v.push_back("'" + Strings::Escape(e.serial_number) + "'");
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
v.push_back(std::to_string(e.guid));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
}
@ -397,7 +405,8 @@ public:
e.ornament_icon = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
e.ornament_idfile = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
e.ornament_hero_model = row[17] ? static_cast<int32_t>(atoi(row[17])) : 0;
e.serial_number = row[18] ? row[18] : "";
e.item_unique_id = row[18] ? row[18] : "";
e.guid = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
all_entries.push_back(e);
}
@ -440,7 +449,8 @@ public:
e.ornament_icon = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 0;
e.ornament_idfile = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
e.ornament_hero_model = row[17] ? static_cast<int32_t>(atoi(row[17])) : 0;
e.serial_number = row[18] ? row[18] : "";
e.item_unique_id = row[18] ? row[18] : "";
e.guid = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0;
all_entries.push_back(e);
}
@ -533,7 +543,8 @@ public:
v.push_back(std::to_string(e.ornament_icon));
v.push_back(std::to_string(e.ornament_idfile));
v.push_back(std::to_string(e.ornament_hero_model));
v.push_back("'" + Strings::Escape(e.serial_number) + "'");
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
v.push_back(std::to_string(e.guid));
auto results = db.QueryDatabase(
fmt::format(
@ -574,7 +585,8 @@ public:
v.push_back(std::to_string(e.ornament_icon));
v.push_back(std::to_string(e.ornament_idfile));
v.push_back(std::to_string(e.ornament_hero_model));
v.push_back("'" + Strings::Escape(e.serial_number) + "'");
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
v.push_back(std::to_string(e.guid));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
}

View File

@ -285,7 +285,7 @@ bool SharedDatabase::UpdateInventorySlot(uint32 char_id, const EQ::ItemInstance*
e.ornament_icon = inst->GetOrnamentationIcon();
e.ornament_idfile = inst->GetOrnamentationIDFile();
e.ornament_hero_model = inst->GetOrnamentHeroModel();
e.serial_number = inst->GetUniqueID();
e.item_unique_id = inst->GetUniqueID();
const int replaced = InventoryRepository::ReplaceOne(*this, e);
@ -717,13 +717,13 @@ bool SharedDatabase::GetInventory(Client *c)
inst->SetOrnamentationIDFile(ornament_idfile);
inst->SetOrnamentHeroModel(item->HerosForgeModel);
if (row.serial_number.empty()) {
if (row.item_unique_id.empty()) {
inst->CreateUniqueID();
row.serial_number = inst->GetUniqueID();
row.item_unique_id = inst->GetUniqueID();
queue.push_back(row);
}
else {
inst->SetUniqueID(row.serial_number);
inst->SetUniqueID(row.item_unique_id);
}
if (

View File

@ -2400,7 +2400,7 @@ bool Client::StoreCharacter(
e.ornament_icon = inst->GetOrnamentationIcon();
e.ornament_idfile = inst->GetOrnamentationIDFile();
e.ornament_hero_model = inst->GetOrnamentHeroModel();
e.serial_number = inst->GetUniqueID();
e.item_unique_id = inst->GetUniqueID();
v.emplace_back(e);
}

View File

@ -9055,11 +9055,11 @@ void Client::QuestReward(Mob* target, const QuestReward_Struct &reward, bool fac
void Client::CashReward(uint32 copper, uint32 silver, uint32 gold, uint32 platinum)
{
auto outapp = std::make_unique<EQApplicationPacket>(OP_CashReward, sizeof(CashReward_Struct));
auto outapp = std::make_unique<EQApplicationPacket>(OP_CashReward, static_cast<uint32>(sizeof(CashReward_Struct)));
auto outbuf = reinterpret_cast<CashReward_Struct *>(outapp->pBuffer);
outbuf->copper = copper;
outbuf->silver = silver;
outbuf->gold = gold;
outbuf->copper = copper;
outbuf->silver = silver;
outbuf->gold = gold;
outbuf->platinum = platinum;
AddMoneyToPP(copper, silver, gold, platinum);