mirror of
https://github.com/EQEmu/Server.git
synced 2026-02-21 17:52:25 +00:00
Update parcels for item_unique_id
This commit is contained in:
parent
1519c2429a
commit
6a9bc7e6c1
@ -7188,15 +7188,22 @@ ALTER TABLE `character_parcels_containers`
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9329,
|
||||
.description = "2025_03_27_implement_item_unique_serial_number.sql",
|
||||
.description = "2025_03_27_implement_item_unique_unique_id.sql",
|
||||
.check = "SHOW COLUMNS FROM `inventory` LIKE 'serial_number'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `inventory`
|
||||
DROP COLUMN `guid`,
|
||||
ADD COLUMN `serial_number` VARCHAR(16) NULL DEFAULT NULL AFTER `ornament_hero_model`,
|
||||
ADD UNIQUE INDEX `idx_serial_number` (`serial_number`);
|
||||
ADD COLUMN `item_unique_id` VARCHAR(16) NULL DEFAULT NULL AFTER `ornament_hero_model`,
|
||||
ADD UNIQUE INDEX `idx_item_unique_id` (`item_unique_id`);
|
||||
|
||||
ALTER TABLE `character_parcels`
|
||||
ADD COLUMN `item_unique_id` VARCHAR(16) NULL DEFAULT NULL AFTER `item_id`;
|
||||
|
||||
ALTER TABLE `character_parcels_containers`
|
||||
ADD COLUMN `item_unique_id` VARCHAR(16) NULL DEFAULT NULL AFTER `item_id`;
|
||||
|
||||
)",
|
||||
.content_schema_update = false
|
||||
},
|
||||
|
||||
@ -1426,6 +1426,7 @@ namespace PlayerEvent {
|
||||
|
||||
struct ParcelRetrieve {
|
||||
uint32 item_id;
|
||||
std::string item_unique_id;
|
||||
uint32 augment_1_id;
|
||||
uint32 augment_2_id;
|
||||
uint32 augment_3_id;
|
||||
@ -1471,6 +1472,7 @@ namespace PlayerEvent {
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
CEREAL_NVP(item_unique_id),
|
||||
CEREAL_NVP(augment_1_id),
|
||||
CEREAL_NVP(augment_2_id),
|
||||
CEREAL_NVP(augment_3_id),
|
||||
@ -1486,6 +1488,7 @@ namespace PlayerEvent {
|
||||
|
||||
struct ParcelSend {
|
||||
uint32 item_id;
|
||||
std::string item_unique_id;
|
||||
uint32 augment_1_id;
|
||||
uint32 augment_2_id;
|
||||
uint32 augment_3_id;
|
||||
@ -1535,6 +1538,7 @@ namespace PlayerEvent {
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
CEREAL_NVP(item_unique_id),
|
||||
CEREAL_NVP(augment_1_id),
|
||||
CEREAL_NVP(augment_2_id),
|
||||
CEREAL_NVP(augment_3_id),
|
||||
@ -1553,6 +1557,7 @@ namespace PlayerEvent {
|
||||
struct ParcelDelete {
|
||||
uint32 char_id;
|
||||
uint32 item_id;
|
||||
std::string item_unique_id;
|
||||
uint32 augment_1_id;
|
||||
uint32 augment_2_id;
|
||||
uint32 augment_3_id;
|
||||
@ -1601,6 +1606,7 @@ namespace PlayerEvent {
|
||||
{
|
||||
ar(
|
||||
CEREAL_NVP(item_id),
|
||||
CEREAL_NVP(item_unique_id),
|
||||
CEREAL_NVP(augment_1_id),
|
||||
CEREAL_NVP(augment_2_id),
|
||||
CEREAL_NVP(augment_3_id),
|
||||
|
||||
@ -260,8 +260,8 @@ int16 EQ::InventoryProfile::PutItem(int16 slot_id, const ItemInstance& inst)
|
||||
}
|
||||
|
||||
int16 EQ::InventoryProfile::PushCursor(const ItemInstance &inst) {
|
||||
if (inst.GetSerialNumber2().empty()) {
|
||||
inst.CreateSerialNumber2();
|
||||
if (inst.GetUniqueID().empty()) {
|
||||
inst.CreateUniqueID();
|
||||
}
|
||||
|
||||
m_cursor.push(inst.Clone());
|
||||
|
||||
@ -158,11 +158,11 @@ EQ::ItemInstance::ItemInstance(const ItemInstance& copy)
|
||||
m_custom_data = copy.m_custom_data;
|
||||
m_timers = copy.m_timers;
|
||||
|
||||
m_serial_number2 = copy.m_serial_number2;
|
||||
if (copy.GetSerialNumber2().empty()) {
|
||||
if (copy.GetUniqueID().empty()) {
|
||||
LogError("Creating Serial Number as part of Clone command");
|
||||
CreateSerialNumber2();
|
||||
copy.CreateUniqueID();
|
||||
}
|
||||
m_unique_id = copy.m_unique_id;
|
||||
|
||||
m_exp = copy.m_exp;
|
||||
m_evolveLvl = copy.m_evolveLvl;
|
||||
@ -2013,7 +2013,7 @@ void EQ::ItemInstance::SetEvolveEquipped(const bool in) const
|
||||
GetTimers().at("evolve").Disable();
|
||||
}
|
||||
|
||||
std::string EQ::ItemInstance::GenerateUniqueSerialNumber()
|
||||
std::string EQ::ItemInstance::GenerateUniqueID()
|
||||
{
|
||||
std::string unique_hash = UniqueHashGenerator::generate();
|
||||
|
||||
|
||||
@ -234,13 +234,14 @@ namespace EQ
|
||||
|
||||
int32 GetSerialNumber() const { return m_SerialNumber; }
|
||||
void SetSerialNumber(int32 id) { m_SerialNumber = id; }
|
||||
const std::string &GetSerialNumber2() const { return m_serial_number2; }
|
||||
const std::string &GetSerialNumber2() const { return m_unique_id; }
|
||||
const std::string &GetUniqueID() const { return m_unique_id; }
|
||||
//std::string &GetSerialNumber2() const { return m_serial_number2; }
|
||||
void SetSerialNumber2(std::string sn) { m_serial_number2 = std::move(sn); }
|
||||
void SetUniqueID(std::string sn) { m_unique_id = std::move(sn); }
|
||||
|
||||
void CreateSerialNumber2() const
|
||||
void CreateUniqueID() const
|
||||
{
|
||||
m_serial_number2 = GenerateUniqueSerialNumber();
|
||||
m_unique_id = GenerateUniqueID();
|
||||
}
|
||||
|
||||
std::map<std::string, ::Timer>& GetTimers() const { return m_timers; }
|
||||
@ -359,29 +360,29 @@ namespace EQ
|
||||
std::map<uint8, ItemInstance*>::const_iterator _cend() { return m_contents.cend(); }
|
||||
|
||||
void _PutItem(uint8 index, ItemInstance *inst) { m_contents[index] = inst; }
|
||||
static std::string GenerateUniqueSerialNumber();
|
||||
static std::string GenerateUniqueID();
|
||||
|
||||
ItemInstTypes m_use_type{ItemInstNormal};// Usage type for item
|
||||
const ItemData * m_item{nullptr}; // Ptr to item data
|
||||
int16 m_charges{0}; // # of charges for chargeable items
|
||||
uint32 m_price{0}; // Bazaar /trader price
|
||||
uint32 m_color{0};
|
||||
uint32 m_merchantslot{0};
|
||||
int16 m_currentslot{0};
|
||||
bool m_attuned{false};
|
||||
int32 m_merchantcount{1};//number avaliable on the merchant, -1=unlimited
|
||||
int32 m_SerialNumber{0}; // Unique identifier for this instance of an item. Needed for Bazaar.
|
||||
mutable std::string m_serial_number2{}; // unique serial number across all zones/world TESTING March 2025
|
||||
uint32 m_exp{0};
|
||||
int8 m_evolveLvl{0};
|
||||
ItemData * m_scaledItem{nullptr};
|
||||
bool m_scaling{false};
|
||||
uint32 m_ornamenticon{0};
|
||||
uint32 m_ornamentidfile{0};
|
||||
uint32 m_new_id_file{0};
|
||||
uint32 m_ornament_hero_model{0};
|
||||
uint32 m_recast_timestamp{0};
|
||||
int m_task_delivered_count{0};
|
||||
ItemInstTypes m_use_type{ ItemInstNormal }; // Usage type for item
|
||||
const ItemData *m_item{ nullptr }; // Ptr to item data
|
||||
int16 m_charges{ 0 }; // # of charges for chargeable items
|
||||
uint32 m_price{ 0 }; // Bazaar /trader price
|
||||
uint32 m_color{ 0 };
|
||||
uint32 m_merchantslot{ 0 };
|
||||
int16 m_currentslot{ 0 };
|
||||
bool m_attuned{ false };
|
||||
int32 m_merchantcount{ 1 }; // number avaliable on the merchant, -1=unlimited
|
||||
int32 m_SerialNumber{ 0 }; // Unique identifier for this instance of an item. Needed for Bazaar.
|
||||
mutable std::string m_unique_id{}; // unique serial number across all zones/world TESTING March 2025
|
||||
uint32 m_exp{ 0 };
|
||||
int8 m_evolveLvl{ 0 };
|
||||
ItemData *m_scaledItem{ nullptr };
|
||||
bool m_scaling{ false };
|
||||
uint32 m_ornamenticon{ 0 };
|
||||
uint32 m_ornamentidfile{ 0 };
|
||||
uint32 m_new_id_file{ 0 };
|
||||
uint32 m_ornament_hero_model{ 0 };
|
||||
uint32 m_recast_timestamp{ 0 };
|
||||
int m_task_delivered_count{ 0 };
|
||||
mutable CharacterEvolvingItemsRepository::CharacterEvolvingItems m_evolving_details{};
|
||||
|
||||
// Items inside of this item (augs or contents) {};
|
||||
|
||||
@ -6474,9 +6474,14 @@ namespace RoF2
|
||||
RoF2::structs::ItemSerializationHeader hdr;
|
||||
|
||||
//sprintf(hdr.unknown000, "06e0002Y1W00");
|
||||
//strn0cpy(hdr.unknown000, fmt::format("{:016}\0", inst->GetSerialNumber()).c_str(),sizeof(hdr.unknown000));
|
||||
strn0cpy(hdr.unknown000, inst->GetSerialNumber2().c_str(),sizeof(hdr.unknown000));
|
||||
hdr.unknown000[16] = '\0';
|
||||
|
||||
if (inst->GetUniqueID().empty()) {
|
||||
strn0cpy(hdr.unknown000, fmt::format("{:016}\0", inst->GetSerialNumber()).c_str(),sizeof(hdr.unknown000));
|
||||
}
|
||||
else {
|
||||
strn0cpy(hdr.unknown000, inst->GetUniqueID().c_str(),sizeof(hdr.unknown000));
|
||||
hdr.unknown000[16] = '\0';
|
||||
}
|
||||
|
||||
// strn0cpy(
|
||||
// hdr.unknown000,
|
||||
|
||||
@ -19,18 +19,19 @@
|
||||
class BaseCharacterParcelsContainersRepository {
|
||||
public:
|
||||
struct CharacterParcelsContainers {
|
||||
uint32_t id;
|
||||
uint32_t parcels_id;
|
||||
uint32_t slot_id;
|
||||
uint32_t item_id;
|
||||
uint32_t aug_slot_1;
|
||||
uint32_t aug_slot_2;
|
||||
uint32_t aug_slot_3;
|
||||
uint32_t aug_slot_4;
|
||||
uint32_t aug_slot_5;
|
||||
uint32_t aug_slot_6;
|
||||
uint32_t quantity;
|
||||
uint32_t evolve_amount;
|
||||
uint32_t id;
|
||||
uint32_t parcels_id;
|
||||
uint32_t slot_id;
|
||||
uint32_t item_id;
|
||||
std::string item_unique_id;
|
||||
uint32_t aug_slot_1;
|
||||
uint32_t aug_slot_2;
|
||||
uint32_t aug_slot_3;
|
||||
uint32_t aug_slot_4;
|
||||
uint32_t aug_slot_5;
|
||||
uint32_t aug_slot_6;
|
||||
uint32_t quantity;
|
||||
uint32_t evolve_amount;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@ -45,6 +46,7 @@ public:
|
||||
"parcels_id",
|
||||
"slot_id",
|
||||
"item_id",
|
||||
"item_unique_id",
|
||||
"aug_slot_1",
|
||||
"aug_slot_2",
|
||||
"aug_slot_3",
|
||||
@ -63,6 +65,7 @@ public:
|
||||
"parcels_id",
|
||||
"slot_id",
|
||||
"item_id",
|
||||
"item_unique_id",
|
||||
"aug_slot_1",
|
||||
"aug_slot_2",
|
||||
"aug_slot_3",
|
||||
@ -111,18 +114,19 @@ public:
|
||||
{
|
||||
CharacterParcelsContainers e{};
|
||||
|
||||
e.id = 0;
|
||||
e.parcels_id = 0;
|
||||
e.slot_id = 0;
|
||||
e.item_id = 0;
|
||||
e.aug_slot_1 = 0;
|
||||
e.aug_slot_2 = 0;
|
||||
e.aug_slot_3 = 0;
|
||||
e.aug_slot_4 = 0;
|
||||
e.aug_slot_5 = 0;
|
||||
e.aug_slot_6 = 0;
|
||||
e.quantity = 0;
|
||||
e.evolve_amount = 0;
|
||||
e.id = 0;
|
||||
e.parcels_id = 0;
|
||||
e.slot_id = 0;
|
||||
e.item_id = 0;
|
||||
e.item_unique_id = "";
|
||||
e.aug_slot_1 = 0;
|
||||
e.aug_slot_2 = 0;
|
||||
e.aug_slot_3 = 0;
|
||||
e.aug_slot_4 = 0;
|
||||
e.aug_slot_5 = 0;
|
||||
e.aug_slot_6 = 0;
|
||||
e.quantity = 0;
|
||||
e.evolve_amount = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -159,18 +163,19 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterParcelsContainers e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.item_unique_id = row[4] ? row[4] : "";
|
||||
e.aug_slot_1 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.quantity = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -207,14 +212,15 @@ public:
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.parcels_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.slot_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.item_id));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.aug_slot_1));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.aug_slot_2));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.aug_slot_3));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.aug_slot_4));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_5));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.aug_slot_6));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.quantity));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.evolve_amount));
|
||||
v.push_back(columns[4] + " = '" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.aug_slot_1));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.aug_slot_2));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.aug_slot_3));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_4));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.aug_slot_5));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.aug_slot_6));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.quantity));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.evolve_amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -240,6 +246,7 @@ public:
|
||||
v.push_back(std::to_string(e.parcels_id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(std::to_string(e.aug_slot_1));
|
||||
v.push_back(std::to_string(e.aug_slot_2));
|
||||
v.push_back(std::to_string(e.aug_slot_3));
|
||||
@ -281,6 +288,7 @@ public:
|
||||
v.push_back(std::to_string(e.parcels_id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(std::to_string(e.aug_slot_1));
|
||||
v.push_back(std::to_string(e.aug_slot_2));
|
||||
v.push_back(std::to_string(e.aug_slot_3));
|
||||
@ -322,18 +330,19 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterParcelsContainers e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.item_unique_id = row[4] ? row[4] : "";
|
||||
e.aug_slot_1 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.quantity = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -358,18 +367,19 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterParcelsContainers e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.item_unique_id = row[4] ? row[4] : "";
|
||||
e.aug_slot_1 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.quantity = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -448,6 +458,7 @@ public:
|
||||
v.push_back(std::to_string(e.parcels_id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(std::to_string(e.aug_slot_1));
|
||||
v.push_back(std::to_string(e.aug_slot_2));
|
||||
v.push_back(std::to_string(e.aug_slot_3));
|
||||
@ -482,6 +493,7 @@ public:
|
||||
v.push_back(std::to_string(e.parcels_id));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(std::to_string(e.aug_slot_1));
|
||||
v.push_back(std::to_string(e.aug_slot_2));
|
||||
v.push_back(std::to_string(e.aug_slot_3));
|
||||
|
||||
@ -28,6 +28,7 @@ public:
|
||||
uint32_t aug_slot_4;
|
||||
uint32_t aug_slot_5;
|
||||
uint32_t aug_slot_6;
|
||||
std::string item_unique_id;
|
||||
uint32_t slot_id;
|
||||
uint32_t quantity;
|
||||
uint32_t evolve_amount;
|
||||
@ -53,6 +54,7 @@ public:
|
||||
"aug_slot_4",
|
||||
"aug_slot_5",
|
||||
"aug_slot_6",
|
||||
"item_unique_id",
|
||||
"slot_id",
|
||||
"quantity",
|
||||
"evolve_amount",
|
||||
@ -74,6 +76,7 @@ public:
|
||||
"aug_slot_4",
|
||||
"aug_slot_5",
|
||||
"aug_slot_6",
|
||||
"item_unique_id",
|
||||
"slot_id",
|
||||
"quantity",
|
||||
"evolve_amount",
|
||||
@ -129,6 +132,7 @@ public:
|
||||
e.aug_slot_4 = 0;
|
||||
e.aug_slot_5 = 0;
|
||||
e.aug_slot_6 = 0;
|
||||
e.item_unique_id = "";
|
||||
e.slot_id = 0;
|
||||
e.quantity = 0;
|
||||
e.evolve_amount = 0;
|
||||
@ -171,21 +175,22 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterParcels e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.from_name = row[12] ? row[12] : "";
|
||||
e.note = row[13] ? row[13] : "";
|
||||
e.sent_date = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.item_unique_id = row[9] ? row[9] : "";
|
||||
e.slot_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.quantity = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.from_name = row[13] ? row[13] : "";
|
||||
e.note = row[14] ? row[14] : "";
|
||||
e.sent_date = strtoll(row[15] ? row[15] : "-1", nullptr, 10);
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -227,12 +232,13 @@ public:
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.aug_slot_4));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.aug_slot_5));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_6));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.slot_id));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.quantity));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.evolve_amount));
|
||||
v.push_back(columns[12] + " = '" + Strings::Escape(e.from_name) + "'");
|
||||
v.push_back(columns[13] + " = '" + Strings::Escape(e.note) + "'");
|
||||
v.push_back(columns[14] + " = FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
|
||||
v.push_back(columns[9] + " = '" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.slot_id));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.quantity));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.evolve_amount));
|
||||
v.push_back(columns[13] + " = '" + Strings::Escape(e.from_name) + "'");
|
||||
v.push_back(columns[14] + " = '" + Strings::Escape(e.note) + "'");
|
||||
v.push_back(columns[15] + " = FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -263,6 +269,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_4));
|
||||
v.push_back(std::to_string(e.aug_slot_5));
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
@ -307,6 +314,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_4));
|
||||
v.push_back(std::to_string(e.aug_slot_5));
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
@ -346,21 +354,22 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterParcels e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.from_name = row[12] ? row[12] : "";
|
||||
e.note = row[13] ? row[13] : "";
|
||||
e.sent_date = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.item_unique_id = row[9] ? row[9] : "";
|
||||
e.slot_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.quantity = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.from_name = row[13] ? row[13] : "";
|
||||
e.note = row[14] ? row[14] : "";
|
||||
e.sent_date = strtoll(row[15] ? row[15] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -385,21 +394,22 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterParcels e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.from_name = row[12] ? row[12] : "";
|
||||
e.note = row[13] ? row[13] : "";
|
||||
e.sent_date = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.item_unique_id = row[9] ? row[9] : "";
|
||||
e.slot_id = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.quantity = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[12] ? static_cast<uint32_t>(strtoul(row[12], nullptr, 10)) : 0;
|
||||
e.from_name = row[13] ? row[13] : "";
|
||||
e.note = row[14] ? row[14] : "";
|
||||
e.sent_date = strtoll(row[15] ? row[15] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -483,6 +493,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_4));
|
||||
v.push_back(std::to_string(e.aug_slot_5));
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
@ -520,6 +531,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_4));
|
||||
v.push_back(std::to_string(e.aug_slot_5));
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back("'" + Strings::Escape(e.item_unique_id) + "'");
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
|
||||
@ -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->GetSerialNumber2();
|
||||
e.serial_number = inst->GetUniqueID();
|
||||
|
||||
const int replaced = InventoryRepository::ReplaceOne(*this, e);
|
||||
|
||||
@ -718,12 +718,12 @@ bool SharedDatabase::GetInventory(Client *c)
|
||||
inst->SetOrnamentHeroModel(item->HerosForgeModel);
|
||||
|
||||
if (row.serial_number.empty()) {
|
||||
inst->CreateSerialNumber2();
|
||||
row.serial_number = inst->GetSerialNumber2();
|
||||
inst->CreateUniqueID();
|
||||
row.serial_number = inst->GetUniqueID();
|
||||
queue.push_back(row);
|
||||
}
|
||||
else {
|
||||
inst->SetSerialNumber2(row.serial_number);
|
||||
inst->SetUniqueID(row.serial_number);
|
||||
}
|
||||
|
||||
if (
|
||||
|
||||
@ -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->GetSerialNumber2();
|
||||
e.serial_number = inst->GetUniqueID();
|
||||
|
||||
v.emplace_back(e);
|
||||
}
|
||||
|
||||
@ -12700,13 +12700,11 @@ uint16 Client::GetSkill(EQ::skills::SkillType skill_id) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
void Client::RemoveItemBySerialNumber(const std::string &serial_number, uint32 quantity)
|
||||
void Client::RemoveItemBySerialNumber(const std::string &item_unique_id, uint32 quantity)
|
||||
{
|
||||
EQ::ItemInstance *item = nullptr;
|
||||
|
||||
uint32 removed_count = 0;
|
||||
|
||||
const auto& slot_ids = GetInventorySlots();
|
||||
EQ::ItemInstance *item = nullptr;
|
||||
uint32 removed_count = 0;
|
||||
const auto &slot_ids = GetInventorySlots();
|
||||
|
||||
for (const int16& slot_id : slot_ids) {
|
||||
if (removed_count == quantity) {
|
||||
@ -12714,7 +12712,7 @@ void Client::RemoveItemBySerialNumber(const std::string &serial_number, uint32 q
|
||||
}
|
||||
|
||||
item = GetInv().GetItem(slot_id);
|
||||
if (item && item->GetSerialNumber2().compare(serial_number) == 0) {
|
||||
if (item && item->GetUniqueID().compare(item_unique_id) == 0) {
|
||||
uint32 charges = item->IsStackable() ? item->GetCharges() : 0;
|
||||
uint32 stack_size = std::max(charges, static_cast<uint32>(1));
|
||||
if ((removed_count + stack_size) <= quantity) {
|
||||
|
||||
@ -1150,7 +1150,7 @@ public:
|
||||
void SetItemCooldown(uint32 item_id, bool use_saved_timer = false, uint32 in_seconds = 1);
|
||||
uint32 GetItemCooldown(uint32 item_id);
|
||||
void RemoveItem(uint32 item_id, uint32 quantity = 1);
|
||||
void RemoveItemBySerialNumber(const std::string &serial_number, uint32 quantity = 1);
|
||||
void RemoveItemBySerialNumber(const std::string &item_unique_id, uint32 quantity = 1);
|
||||
bool SwapItem(MoveItem_Struct* move_in);
|
||||
void SwapItemResync(MoveItem_Struct* move_slots);
|
||||
void PutLootInInventory(int16 slot_id, const EQ::ItemInstance &inst, LootItem** bag_item_data = 0);
|
||||
|
||||
@ -386,7 +386,7 @@ bool Client::DoEvolveCheckProgression(EQ::ItemInstance &inst)
|
||||
|
||||
PlayerEvent::EvolveItem e{};
|
||||
|
||||
RemoveItemBySerialNumber(inst.GetSerialNumber2());
|
||||
RemoveItemBySerialNumber(inst.GetUniqueID());
|
||||
EvolvingItemsManager::Instance()->LoadPlayerEvent(inst, e);
|
||||
e.status = "Evolved Item due to obtaining progression - Old Evolve Item removed from inventory.";
|
||||
RecordPlayerEventLog(PlayerEvent::EVOLVE_ITEM, e);
|
||||
@ -506,7 +506,7 @@ void Client::DoEvolveTransferXP(const EQApplicationPacket *app)
|
||||
|
||||
PlayerEvent::EvolveItem e{};
|
||||
|
||||
RemoveItemBySerialNumber(inst_from->GetSerialNumber2());
|
||||
RemoveItemBySerialNumber(inst_from->GetUniqueID());
|
||||
EvolvingItemsManager::Instance()->LoadPlayerEvent(*inst_from, e);
|
||||
e.status = "Transfer XP - Original FROM Evolve Item removed from inventory.";
|
||||
RecordPlayerEventLog(PlayerEvent::EVOLVE_ITEM, e);
|
||||
@ -516,7 +516,7 @@ void Client::DoEvolveTransferXP(const EQApplicationPacket *app)
|
||||
e.status = "Transfer XP - Updated FROM item placed in inventory.";
|
||||
RecordPlayerEventLog(PlayerEvent::EVOLVE_ITEM, e);
|
||||
|
||||
RemoveItemBySerialNumber(inst_to->GetSerialNumber2());
|
||||
RemoveItemBySerialNumber(inst_to->GetUniqueID());
|
||||
EvolvingItemsManager::Instance()->LoadPlayerEvent(*inst_to, e);
|
||||
e.status = "Transfer XP - Original TO Evolve Item removed from inventory.";
|
||||
RecordPlayerEventLog(PlayerEvent::EVOLVE_ITEM, e);
|
||||
|
||||
@ -185,7 +185,7 @@ void ShowInventory(Client *c, const Seperator *sep)
|
||||
scope_bit & peekWorld ? EQ::invslot::WORLD_BEGIN + index_main : index_main,
|
||||
linker.GenerateLink(),
|
||||
item_data->ID,
|
||||
inst_main->GetSerialNumber2().c_str(),
|
||||
inst_main->GetUniqueID().c_str(),
|
||||
inst_main->IsStackable() && inst_main->GetCharges() > 0 ?
|
||||
fmt::format(
|
||||
" (Stack of {})",
|
||||
@ -254,7 +254,7 @@ void ShowInventory(Client *c, const Seperator *sep)
|
||||
sub_index,
|
||||
linker.GenerateLink(),
|
||||
item_data->ID,
|
||||
inst_sub->GetSerialNumber2().c_str(),
|
||||
inst_sub->GetUniqueID().c_str(),
|
||||
(
|
||||
inst_sub->IsStackable() && inst_sub->GetCharges() > 0 ?
|
||||
fmt::format(
|
||||
|
||||
@ -1055,8 +1055,8 @@ bool Client::PushItemOnCursor(const EQ::ItemInstance& inst, bool client_update)
|
||||
bool Client::PutItemInInventory(int16 slot_id, const EQ::ItemInstance& inst, bool client_update) {
|
||||
LogInventory("Putting item [{}] ([{}]) into slot [{}]", inst.GetItem()->Name, inst.GetItem()->ID, slot_id);
|
||||
|
||||
if (inst.GetSerialNumber2().empty()) {
|
||||
inst.CreateSerialNumber2();
|
||||
if (inst.GetUniqueID().empty()) {
|
||||
inst.CreateUniqueID();
|
||||
}
|
||||
|
||||
if (slot_id == EQ::invslot::slotCursor) { // don't trust macros before conditional statements...
|
||||
|
||||
@ -396,6 +396,7 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in)
|
||||
parcel_out.sent_date = time(nullptr);
|
||||
parcel_out.quantity = quantity;
|
||||
parcel_out.item_id = inst->GetID();
|
||||
parcel_out.item_unique_id = inst->GetUniqueID();
|
||||
parcel_out.char_id = send_to_client.at(0).char_id;
|
||||
parcel_out.slot_id = next_slot;
|
||||
parcel_out.evolve_amount = inst->GetEvolveCurrentAmount();
|
||||
@ -433,13 +434,14 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in)
|
||||
|
||||
std::vector<CharacterParcelsContainersRepository::CharacterParcelsContainers> all_entries{};
|
||||
if (inst->IsNoneEmptyContainer()) {
|
||||
for (auto const &kv: *inst->GetContents()) {
|
||||
for (auto const &[slot, item]: *inst->GetContents()) {
|
||||
CharacterParcelsContainersRepository::CharacterParcelsContainers cpc{};
|
||||
cpc.parcels_id = result.id;
|
||||
cpc.slot_id = kv.first;
|
||||
cpc.item_id = kv.second->GetID();
|
||||
if (kv.second->IsAugmented()) {
|
||||
auto augs = kv.second->GetAugmentIDs();
|
||||
cpc.parcels_id = result.id;
|
||||
cpc.slot_id = slot;
|
||||
cpc.item_id = item->GetID();
|
||||
cpc.item_unique_id = item->GetUniqueID();
|
||||
if (item->IsAugmented()) {
|
||||
auto augs = item->GetAugmentIDs();
|
||||
cpc.aug_slot_1 = augs.at(0);
|
||||
cpc.aug_slot_2 = augs.at(1);
|
||||
cpc.aug_slot_3 = augs.at(2);
|
||||
@ -448,14 +450,15 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in)
|
||||
cpc.aug_slot_6 = augs.at(5);
|
||||
}
|
||||
|
||||
cpc.quantity = kv.second->GetCharges() >= 0 ? kv.second->GetCharges() : 1;
|
||||
cpc.evolve_amount = kv.second->GetEvolveCurrentAmount();
|
||||
cpc.quantity = item->GetCharges() >= 0 ? item->GetCharges() : 1;
|
||||
cpc.evolve_amount = item->GetEvolveCurrentAmount();
|
||||
cpc.quantity = item->GetCharges() >= 0 ? item->GetCharges() : 1;
|
||||
all_entries.push_back(cpc);
|
||||
}
|
||||
CharacterParcelsContainersRepository::InsertMany(database, all_entries);
|
||||
}
|
||||
|
||||
RemoveItemBySerialNumber(inst->GetSerialNumber2(), parcel_out.quantity == 0 ? 1 : parcel_out.quantity);
|
||||
RemoveItemBySerialNumber(inst->GetUniqueID(), parcel_out.quantity == 0 ? 1 : parcel_out.quantity);
|
||||
std::unique_ptr<EQApplicationPacket> outapp(new EQApplicationPacket(OP_ShopSendParcel));
|
||||
QueuePacket(outapp.get());
|
||||
|
||||
@ -477,6 +480,7 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in)
|
||||
e.from_player_name = parcel_out.from_name;
|
||||
e.to_player_name = send_to_client.at(0).character_name;
|
||||
e.item_id = parcel_out.item_id;
|
||||
e.item_unique_id = parcel_out.item_unique_id;
|
||||
e.augment_1_id = parcel_out.aug_slot_1;
|
||||
e.augment_2_id = parcel_out.aug_slot_2;
|
||||
e.augment_3_id = parcel_out.aug_slot_3;
|
||||
@ -493,6 +497,7 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in)
|
||||
e.from_player_name = parcel_out.from_name;
|
||||
e.to_player_name = send_to_client.at(0).character_name;
|
||||
e.item_id = i.item_id;
|
||||
e.item_unique_id = i.item_unique_id;
|
||||
e.augment_1_id = i.aug_slot_1;
|
||||
e.augment_2_id = i.aug_slot_2;
|
||||
e.augment_3_id = i.aug_slot_3;
|
||||
@ -655,8 +660,9 @@ void Client::DoParcelRetrieve(const ParcelRetrieve_Struct &parcel_in)
|
||||
}
|
||||
);
|
||||
if (p != m_parcels.end()) {
|
||||
uint32 item_id = parcel_in.parcel_item_id;
|
||||
uint32 item_quantity = p->second.quantity;
|
||||
uint32 item_id = parcel_in.parcel_item_id;
|
||||
uint32 item_quantity = p->second.quantity;
|
||||
std::string item_unique_id = p->second.item_unique_id;
|
||||
if (!item_id) {
|
||||
LogError(
|
||||
"Attempt to retrieve parcel with erroneous item id for client character id {}.",
|
||||
@ -698,6 +704,7 @@ void Client::DoParcelRetrieve(const ParcelRetrieve_Struct &parcel_in)
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
inst->SetUniqueID(item_unique_id);
|
||||
std::vector<CharacterParcelsContainersRepository::CharacterParcelsContainers> results{};
|
||||
if (inst->IsClassBag() && inst->GetItem()->BagSlots > 0) {
|
||||
auto contents = inst->GetContents();
|
||||
@ -722,7 +729,7 @@ void Client::DoParcelRetrieve(const ParcelRetrieve_Struct &parcel_in)
|
||||
}
|
||||
|
||||
item->SetEvolveCurrentAmount(i.evolve_amount);
|
||||
|
||||
item->SetUniqueID(i.item_unique_id);
|
||||
if (CheckLoreConflict(item->GetItem())) {
|
||||
if (RuleB(Parcel, DeleteOnDuplicate)) {
|
||||
MessageString(Chat::Yellow, PARCEL_DUPLICATE_DELETE, inst->GetItem()->Name);
|
||||
@ -771,6 +778,7 @@ void Client::DoParcelRetrieve(const ParcelRetrieve_Struct &parcel_in)
|
||||
PlayerEvent::ParcelRetrieve e{};
|
||||
e.from_player_name = p->second.from_name;
|
||||
e.item_id = p->second.item_id;
|
||||
e.item_unique_id = p->second.item_unique_id;
|
||||
e.augment_1_id = p->second.aug_slot_1;
|
||||
e.augment_2_id = p->second.aug_slot_2;
|
||||
e.augment_3_id = p->second.aug_slot_3;
|
||||
@ -784,6 +792,7 @@ void Client::DoParcelRetrieve(const ParcelRetrieve_Struct &parcel_in)
|
||||
for (auto const &i:results) {
|
||||
e.from_player_name = p->second.from_name;
|
||||
e.item_id = i.item_id;
|
||||
e.item_unique_id = i.item_unique_id;
|
||||
e.augment_1_id = i.aug_slot_1;
|
||||
e.augment_2_id = i.aug_slot_2;
|
||||
e.augment_3_id = i.aug_slot_3;
|
||||
@ -793,8 +802,6 @@ void Client::DoParcelRetrieve(const ParcelRetrieve_Struct &parcel_in)
|
||||
e.quantity = i.quantity;
|
||||
e.sent_date = p->second.sent_date;
|
||||
RecordPlayerEventLog(PlayerEvent::PARCEL_RETRIEVE, e);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1062,7 +1062,7 @@ void Client::BulkSendTraderInventory(uint32 char_id)
|
||||
)
|
||||
);
|
||||
if (inst) {
|
||||
inst->SetSerialNumber2(trader_items.at(i).item_sn);
|
||||
inst->SetUniqueID(trader_items.at(i).item_sn);
|
||||
if (trader_items.at(i).item_charges > 0) {
|
||||
inst->SetCharges(trader_items.at(i).item_charges);
|
||||
}
|
||||
@ -1118,7 +1118,7 @@ EQ::ItemInstance *Client::FindTraderItemBySerialNumber(std::string &serial_numbe
|
||||
slot_id = EQ::InventoryProfile::CalcSlotId(i, x);
|
||||
item = GetInv().GetItem(slot_id);
|
||||
if (item) {
|
||||
if (item->GetSerialNumber2().compare(serial_number) == 0) {
|
||||
if (item->GetUniqueID().compare(serial_number) == 0) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@ -1155,7 +1155,7 @@ GetItems2_Struct *Client::GetTraderItems()
|
||||
|
||||
if (item) {
|
||||
gis->items[ndx] = item->GetID();
|
||||
gis->serial_number[ndx] = item->GetSerialNumber2();
|
||||
gis->serial_number[ndx] = item->GetUniqueID();
|
||||
gis->charges[ndx] = item->GetCharges() == 0 ? 1 : item->GetCharges();
|
||||
ndx++;
|
||||
}
|
||||
@ -1177,7 +1177,7 @@ uint16 Client::FindTraderItem(std::string &serial_number, uint16 Quantity){
|
||||
|
||||
item = GetInv().GetItem(SlotID);
|
||||
|
||||
if (item && item->GetSerialNumber2().compare(serial_number) == 0 &&
|
||||
if (item && item->GetUniqueID().compare(serial_number) == 0 &&
|
||||
(item->GetCharges() >= Quantity || (item->GetCharges() <= 0 && Quantity == 1)))
|
||||
{
|
||||
return SlotID;
|
||||
@ -1316,8 +1316,8 @@ void Client::FindAndNukeTraderItem(std::string &serial_number, int16 quantity, C
|
||||
return;
|
||||
}
|
||||
else {
|
||||
TraderRepository::UpdateQuantity(database, CharacterID(), item->GetSerialNumber2(), charges - quantity);
|
||||
NukeTraderItem(slot_id, charges, quantity, customer, trader_slot, item->GetSerialNumber2(), item->GetID());
|
||||
TraderRepository::UpdateQuantity(database, CharacterID(), item->GetUniqueID(), charges - quantity);
|
||||
NukeTraderItem(slot_id, charges, quantity, customer, trader_slot, item->GetUniqueID(), item->GetID());
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -1563,7 +1563,7 @@ void Client::BuyTraderItem(TraderBuy_Struct *tbs, Client *Trader, const EQApplic
|
||||
strn0cpy(outtbs->item_name, buy_item->GetItem()->Name, sizeof(outtbs->item_name));
|
||||
strn0cpy(
|
||||
outtbs->serial_number,
|
||||
buy_item->GetSerialNumber2().data(),
|
||||
buy_item->GetUniqueID().data(),
|
||||
sizeof(outtbs->serial_number)
|
||||
);
|
||||
|
||||
@ -1690,7 +1690,7 @@ static void UpdateTraderCustomerItemsAdded(
|
||||
|
||||
inst->SetCharges(i.item_charges);
|
||||
inst->SetPrice(i.item_cost);
|
||||
inst->SetSerialNumber2(i.item_sn);
|
||||
inst->SetUniqueID(i.item_sn);
|
||||
//FIXinst->SetMerchantSlot(i.item_sn);
|
||||
if (inst->IsStackable()) {
|
||||
inst->SetMerchantCount(i.item_charges);
|
||||
@ -1794,7 +1794,7 @@ static void UpdateTraderCustomerPriceChanged(
|
||||
continue;
|
||||
}
|
||||
|
||||
inst->SetSerialNumber2(trader_items.at(i).item_sn);
|
||||
inst->SetUniqueID(trader_items.at(i).item_sn);
|
||||
//inst->SetMerchantSlot(trader_items.at(i).item_sn);
|
||||
|
||||
LogTrading("Sending price update for [{}], Serial No. [{}] with [{}] charges",
|
||||
|
||||
@ -354,7 +354,7 @@ std::unique_ptr<EQ::ItemInstance> ZoneDatabase::LoadSingleTraderItem(uint32 char
|
||||
}
|
||||
|
||||
inst->SetCharges(charges);
|
||||
inst->SetSerialNumber2(serial_number);
|
||||
inst->SetUniqueID(serial_number);
|
||||
//FIX inst->SetMerchantSlot(serial_number);
|
||||
inst->SetPrice(cost);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user