diff --git a/common/database/database_update_manifest.cpp b/common/database/database_update_manifest.cpp index bd030f98a..d5abb2a0e 100644 --- a/common/database/database_update_manifest.cpp +++ b/common/database/database_update_manifest.cpp @@ -7190,8 +7190,22 @@ CHANGE COLUMN `field223` `spell_subclass` int(11) NULL DEFAULT 0 AFTER `spell_cl CHANGE COLUMN `field232` `no_remove` int(11) NOT NULL DEFAULT 0 AFTER `min_range`; )", .content_schema_update = true - } + }, + ManifestEntry{ + .version = 9329, + .description = "2025_08_22_character_parcel_updates.sql", + .check = "SHOW COLUMNS FROM `character_parcels` LIKE 'evolve_amount'", + .condition = "empty", + .match = "", + .sql = R"( +ALTER TABLE `character_parcels` + ADD COLUMN `evolve_amount` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `quantity`; +ALTER TABLE `character_parcels_containers` + ADD COLUMN `evolve_amount` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `quantity`; +)", + .content_schema_update = false + }, // -- template; copy/paste this when you need to create a new entry // ManifestEntry{ // .version = 9228, diff --git a/common/evolving_items.cpp b/common/evolving_items.cpp index f7f99b7a6..f14a733f3 100644 --- a/common/evolving_items.cpp +++ b/common/evolving_items.cpp @@ -74,6 +74,10 @@ void EvolvingItemsManager::DoLootChecks(const uint32 char_id, const uint16 slot_ e.item_id = inst.GetID(); e.equipped = inst.GetEvolveEquipped(); e.final_item_id = EvolvingItemsManager::Instance()->GetFinalItemID(inst); + if (inst.GetEvolveCurrentAmount() > 0) { + e.current_amount = inst.GetEvolveCurrentAmount(); + inst.CalculateEvolveProgression(); + } auto r = CharacterEvolvingItemsRepository::InsertOne(*m_db, e); e.id = r.id; diff --git a/common/patches/rof2.cpp b/common/patches/rof2.cpp index 0d4043d30..b250a5de6 100644 --- a/common/patches/rof2.cpp +++ b/common/patches/rof2.cpp @@ -6481,7 +6481,7 @@ namespace RoF2 hdr.scaled_value = (inst->IsScaling() ? (inst->GetExp() / 100) : 0); hdr.instance_id = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : inst->GetSerialNumber()); hdr.parcel_item_id = packet_type == ItemPacketParcel ? inst->GetID() : 0; - if (item->EvolvingItem) { + if (item->EvolvingItem && packet_type != ItemPacketParcel && packet_type != ItemPacketMerchant) { hdr.instance_id = inst->GetEvolveUniqueID() & 0xFFFFFFFF; //lower dword hdr.parcel_item_id = inst->GetEvolveUniqueID() >> 32; //upper dword } @@ -6500,6 +6500,7 @@ namespace RoF2 if (item->EvolvingItem > 0) { RoF2::structs::EvolvingItem_Struct evotop; + inst->CalculateEvolveProgression(); evotop.final_item_id = inst->GetEvolveFinalItemID(); evotop.evolve_level = item->EvolvingLevel; diff --git a/common/repositories/base/base_character_parcels_containers_repository.h b/common/repositories/base/base_character_parcels_containers_repository.h index 9c98cc068..12ca611b7 100644 --- a/common/repositories/base/base_character_parcels_containers_repository.h +++ b/common/repositories/base/base_character_parcels_containers_repository.h @@ -30,6 +30,7 @@ public: uint32_t aug_slot_5; uint32_t aug_slot_6; uint32_t quantity; + uint32_t evolve_amount; }; static std::string PrimaryKey() @@ -51,6 +52,7 @@ public: "aug_slot_5", "aug_slot_6", "quantity", + "evolve_amount", }; } @@ -68,6 +70,7 @@ public: "aug_slot_5", "aug_slot_6", "quantity", + "evolve_amount", }; } @@ -108,17 +111,18 @@ 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.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; return e; } @@ -155,17 +159,18 @@ public: if (results.RowCount() == 1) { CharacterParcelsContainers e{}; - e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.parcels_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.slot_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.item_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.aug_slot_1 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.aug_slot_2 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.aug_slot_3 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; - e.aug_slot_4 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; - e.aug_slot_5 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.aug_slot_6 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; + e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; + e.parcels_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; + e.slot_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; + e.item_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; + e.aug_slot_1 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; + e.aug_slot_2 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; + e.aug_slot_3 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; + e.aug_slot_4 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; + e.aug_slot_5 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; + e.aug_slot_6 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; + e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; + e.evolve_amount = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; return e; } @@ -209,6 +214,7 @@ public: 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)); auto results = db.QueryDatabase( fmt::format( @@ -241,6 +247,7 @@ public: v.push_back(std::to_string(e.aug_slot_5)); v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.quantity)); + v.push_back(std::to_string(e.evolve_amount)); auto results = db.QueryDatabase( fmt::format( @@ -281,6 +288,7 @@ public: v.push_back(std::to_string(e.aug_slot_5)); v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.quantity)); + v.push_back(std::to_string(e.evolve_amount)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } @@ -314,17 +322,18 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterParcelsContainers e{}; - e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.parcels_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.slot_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.item_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.aug_slot_1 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.aug_slot_2 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.aug_slot_3 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; - e.aug_slot_4 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; - e.aug_slot_5 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.aug_slot_6 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; + e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; + e.parcels_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; + e.slot_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; + e.item_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; + e.aug_slot_1 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; + e.aug_slot_2 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; + e.aug_slot_3 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; + e.aug_slot_4 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; + e.aug_slot_5 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; + e.aug_slot_6 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; + e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; + e.evolve_amount = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; all_entries.push_back(e); } @@ -349,17 +358,18 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterParcelsContainers e{}; - e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.parcels_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.slot_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.item_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.aug_slot_1 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.aug_slot_2 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.aug_slot_3 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; - e.aug_slot_4 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; - e.aug_slot_5 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.aug_slot_6 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; + e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; + e.parcels_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; + e.slot_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; + e.item_id = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; + e.aug_slot_1 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; + e.aug_slot_2 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; + e.aug_slot_3 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; + e.aug_slot_4 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; + e.aug_slot_5 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; + e.aug_slot_6 = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; + e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; + e.evolve_amount = row[11] ? static_cast(strtoul(row[11], nullptr, 10)) : 0; all_entries.push_back(e); } @@ -445,6 +455,7 @@ public: v.push_back(std::to_string(e.aug_slot_5)); v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.quantity)); + v.push_back(std::to_string(e.evolve_amount)); auto results = db.QueryDatabase( fmt::format( @@ -478,6 +489,7 @@ public: v.push_back(std::to_string(e.aug_slot_5)); v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.quantity)); + v.push_back(std::to_string(e.evolve_amount)); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); } diff --git a/common/repositories/base/base_character_parcels_repository.h b/common/repositories/base/base_character_parcels_repository.h index 9263f307b..df7242aed 100644 --- a/common/repositories/base/base_character_parcels_repository.h +++ b/common/repositories/base/base_character_parcels_repository.h @@ -30,6 +30,7 @@ public: uint32_t aug_slot_6; uint32_t slot_id; uint32_t quantity; + uint32_t evolve_amount; std::string from_name; std::string note; time_t sent_date; @@ -54,6 +55,7 @@ public: "aug_slot_6", "slot_id", "quantity", + "evolve_amount", "from_name", "note", "sent_date", @@ -74,6 +76,7 @@ public: "aug_slot_6", "slot_id", "quantity", + "evolve_amount", "from_name", "note", "UNIX_TIMESTAMP(sent_date)", @@ -117,20 +120,21 @@ public: { CharacterParcels e{}; - e.id = 0; - e.char_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.slot_id = 0; - e.quantity = 0; - e.from_name = ""; - e.note = ""; - e.sent_date = 0; + e.id = 0; + e.char_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.slot_id = 0; + e.quantity = 0; + e.evolve_amount = 0; + e.from_name = ""; + e.note = ""; + e.sent_date = 0; return e; } @@ -167,20 +171,21 @@ public: if (results.RowCount() == 1) { CharacterParcels e{}; - e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.char_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.item_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.aug_slot_1 = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.aug_slot_2 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.aug_slot_3 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.aug_slot_4 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; - e.aug_slot_5 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; - e.aug_slot_6 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.slot_id = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.from_name = row[11] ? row[11] : ""; - e.note = row[12] ? row[12] : ""; - e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10); + e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; + e.char_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; + e.item_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; + e.aug_slot_1 = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; + e.aug_slot_2 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; + e.aug_slot_3 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; + e.aug_slot_4 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; + e.aug_slot_5 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; + e.aug_slot_6 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; + e.slot_id = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; + e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; + e.evolve_amount = row[11] ? static_cast(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); return e; } @@ -224,9 +229,10 @@ public: 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] + " = '" + Strings::Escape(e.from_name) + "'"); - v.push_back(columns[12] + " = '" + Strings::Escape(e.note) + "'"); - v.push_back(columns[13] + " = FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); + 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") + ")"); auto results = db.QueryDatabase( fmt::format( @@ -259,6 +265,7 @@ public: v.push_back(std::to_string(e.aug_slot_6)); 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)); v.push_back("'" + Strings::Escape(e.from_name) + "'"); v.push_back("'" + Strings::Escape(e.note) + "'"); v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); @@ -302,6 +309,7 @@ public: v.push_back(std::to_string(e.aug_slot_6)); 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)); v.push_back("'" + Strings::Escape(e.from_name) + "'"); v.push_back("'" + Strings::Escape(e.note) + "'"); v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); @@ -338,20 +346,21 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterParcels e{}; - e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.char_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.item_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.aug_slot_1 = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.aug_slot_2 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.aug_slot_3 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.aug_slot_4 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; - e.aug_slot_5 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; - e.aug_slot_6 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.slot_id = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.from_name = row[11] ? row[11] : ""; - e.note = row[12] ? row[12] : ""; - e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10); + e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; + e.char_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; + e.item_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; + e.aug_slot_1 = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; + e.aug_slot_2 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; + e.aug_slot_3 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; + e.aug_slot_4 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; + e.aug_slot_5 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; + e.aug_slot_6 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; + e.slot_id = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; + e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; + e.evolve_amount = row[11] ? static_cast(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); all_entries.push_back(e); } @@ -376,20 +385,21 @@ public: for (auto row = results.begin(); row != results.end(); ++row) { CharacterParcels e{}; - e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; - e.char_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; - e.item_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; - e.aug_slot_1 = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; - e.aug_slot_2 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; - e.aug_slot_3 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; - e.aug_slot_4 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; - e.aug_slot_5 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; - e.aug_slot_6 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; - e.slot_id = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; - e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; - e.from_name = row[11] ? row[11] : ""; - e.note = row[12] ? row[12] : ""; - e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10); + e.id = row[0] ? static_cast(strtoul(row[0], nullptr, 10)) : 0; + e.char_id = row[1] ? static_cast(strtoul(row[1], nullptr, 10)) : 0; + e.item_id = row[2] ? static_cast(strtoul(row[2], nullptr, 10)) : 0; + e.aug_slot_1 = row[3] ? static_cast(strtoul(row[3], nullptr, 10)) : 0; + e.aug_slot_2 = row[4] ? static_cast(strtoul(row[4], nullptr, 10)) : 0; + e.aug_slot_3 = row[5] ? static_cast(strtoul(row[5], nullptr, 10)) : 0; + e.aug_slot_4 = row[6] ? static_cast(strtoul(row[6], nullptr, 10)) : 0; + e.aug_slot_5 = row[7] ? static_cast(strtoul(row[7], nullptr, 10)) : 0; + e.aug_slot_6 = row[8] ? static_cast(strtoul(row[8], nullptr, 10)) : 0; + e.slot_id = row[9] ? static_cast(strtoul(row[9], nullptr, 10)) : 0; + e.quantity = row[10] ? static_cast(strtoul(row[10], nullptr, 10)) : 0; + e.evolve_amount = row[11] ? static_cast(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); all_entries.push_back(e); } @@ -475,6 +485,7 @@ public: v.push_back(std::to_string(e.aug_slot_6)); 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)); v.push_back("'" + Strings::Escape(e.from_name) + "'"); v.push_back("'" + Strings::Escape(e.note) + "'"); v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); @@ -511,6 +522,7 @@ public: v.push_back(std::to_string(e.aug_slot_6)); 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)); v.push_back("'" + Strings::Escape(e.from_name) + "'"); v.push_back("'" + Strings::Escape(e.note) + "'"); v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); diff --git a/common/version.h b/common/version.h index af74568c6..9b9ddb4a6 100644 --- a/common/version.h +++ b/common/version.h @@ -42,7 +42,7 @@ * Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt */ -#define CURRENT_BINARY_DATABASE_VERSION 9328 +#define CURRENT_BINARY_DATABASE_VERSION 9329 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054 #define CUSTOM_BINARY_DATABASE_VERSION 0 diff --git a/zone/parcels.cpp b/zone/parcels.cpp index 4ef3b1a2b..f1dc874c1 100644 --- a/zone/parcels.cpp +++ b/zone/parcels.cpp @@ -61,6 +61,7 @@ void Client::SendBulkParcels() inst->SetCharges(p.second.quantity); inst->SetMerchantCount(1); inst->SetMerchantSlot(p.second.slot_id); + inst->SetEvolveCurrentAmount(p.second.evolve_amount); if (inst->IsStackable()) { inst->SetCharges(p.second.quantity); } @@ -164,6 +165,7 @@ void Client::SendParcel(Parcel_Struct &parcel_in) inst->SetCharges(p.quantity); inst->SetMerchantCount(1); inst->SetMerchantSlot(p.slot_id); + inst->SetEvolveCurrentAmount(p.evolve_amount); if (inst->IsStackable()) { inst->SetCharges(p.quantity); } @@ -381,23 +383,23 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in) return; } - uint32 quantity{}; + uint32 quantity = 1; if (inst->IsStackable()) { quantity = parcel_in->quantity; - } - else { - quantity = inst->GetCharges() >= 0 ? inst->GetCharges() : parcel_in->quantity; + } else if (inst->GetItem()->MaxCharges > 0) { + quantity = inst->GetCharges(); } CharacterParcelsRepository::CharacterParcels parcel_out{}; - parcel_out.from_name = GetName(); - parcel_out.note = parcel_in->note; - parcel_out.sent_date = time(nullptr); - parcel_out.quantity = quantity; - parcel_out.item_id = inst->GetID(); - parcel_out.char_id = send_to_client.at(0).char_id; - parcel_out.slot_id = next_slot; - parcel_out.id = 0; + parcel_out.from_name = GetName(); + parcel_out.note = parcel_in->note; + parcel_out.sent_date = time(nullptr); + parcel_out.quantity = quantity; + parcel_out.item_id = inst->GetID(); + parcel_out.char_id = send_to_client.at(0).char_id; + parcel_out.slot_id = next_slot; + parcel_out.evolve_amount = inst->GetEvolveCurrentAmount(); + parcel_out.id = 0; if (inst->IsAugmented()) { auto augs = inst->GetAugmentIDs(); @@ -445,7 +447,9 @@ void Client::DoParcelSend(const Parcel_Struct *parcel_in) cpc.aug_slot_5 = augs.at(4); cpc.aug_slot_6 = augs.at(5); } - cpc.quantity = kv.second->GetCharges() >= 0 ? kv.second->GetCharges() : 1; + + cpc.quantity = kv.second->GetCharges() >= 0 ? kv.second->GetCharges() : 1; + cpc.evolve_amount = kv.second->GetEvolveCurrentAmount(); all_entries.push_back(cpc); } CharacterParcelsContainersRepository::InsertMany(database, all_entries); @@ -679,6 +683,8 @@ void Client::DoParcelRetrieve(const ParcelRetrieve_Struct &parcel_in) return; } + inst->SetEvolveCurrentAmount(p->second.evolve_amount); + if (inst->IsStackable()) { inst->SetCharges(item_quantity > 0 ? item_quantity : 1); } @@ -715,6 +721,8 @@ void Client::DoParcelRetrieve(const ParcelRetrieve_Struct &parcel_in) return; } + item->SetEvolveCurrentAmount(i.evolve_amount); + if (CheckLoreConflict(item->GetItem())) { if (RuleB(Parcel, DeleteOnDuplicate)) { MessageString(Chat::Yellow, PARCEL_DUPLICATE_DELETE, inst->GetItem()->Name);