From b3e7268fc86e17290b9137001c675cf4a7879fcd Mon Sep 17 00:00:00 2001 From: roberto furtado Date: Mon, 27 Nov 2023 07:56:57 -0300 Subject: [PATCH 1/3] Correction of cyclopedia descriptions * double protection information was removed * fixing speed information that showed in half --- src/items/item.cpp | 28 ++++------------------------ 1 file changed, 4 insertions(+), 24 deletions(-) diff --git a/src/items/item.cpp b/src/items/item.cpp index 1632cba95dc..b10db18503d 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -1197,7 +1197,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr if (it.abilities->speed) { ss.str(""); - ss << std::showpos << (it.abilities->speed >> 1) << std::noshowpos; + ss << std::showpos << it.abilities->speed << std::noshowpos; descriptions.emplace_back("Speed", ss.str()); } @@ -1512,7 +1512,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr ss.str(""); bool skillBoost = false; if (it.abilities->speed) { - ss << std::showpos << "speed " << (it.abilities->speed >> 1) << std::noshowpos; + ss << std::showpos << "speed " << it.abilities->speed << std::noshowpos; skillBoost = true; } @@ -1559,14 +1559,11 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr ss << it.abilities->skills[i]; } ss << '%' << std::noshowpos; - skillBoost = true; } - if (it.abilities->stats[STAT_MAGICPOINTS]) { - ss.str(""); - ss << std::showpos << it.abilities->stats[STAT_MAGICPOINTS] << std::noshowpos; - descriptions.emplace_back("Magic Level", ss.str()); + if (skillBoost) { + descriptions.emplace_back("Skill Boost", ss.str()); } for (uint8_t i = 1; i <= 11; i++) { @@ -1598,12 +1595,6 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr descriptions.emplace_back("Damage Reflection", ss.str()); } - if (it.abilities->speed) { - ss.str(""); - ss << std::showpos << (it.abilities->speed >> 1) << std::noshowpos; - descriptions.emplace_back("Speed", ss.str()); - } - if (it.abilities->cleavePercent) { ss.str(""); ss << std::showpos << (it.abilities->cleavePercent) << std::noshowpos << "%"; @@ -1634,17 +1625,6 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr descriptions.emplace_back("Effect", ss.str()); } - for (size_t i = 0; i < COMBAT_COUNT; ++i) { - if (it.abilities->absorbPercent[i] == 0) { - continue; - } - - ss.str(""); - ss << getCombatName(indexToCombatType(i)) << ' ' - << std::showpos << it.abilities->absorbPercent[i] << std::noshowpos << '%'; - descriptions.emplace_back("Protection", ss.str()); - } - for (size_t i = 0; i < COMBAT_COUNT; ++i) { if (it.abilities->fieldAbsorbPercent[i] == 0) { continue; From c82044b58ac8a4f813ba04f39b64b30b1ca0a49a Mon Sep 17 00:00:00 2001 From: roberto furtado Date: Fri, 1 Dec 2023 03:16:30 -0300 Subject: [PATCH 2/3] Update item.cpp capacity --- src/items/item.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/items/item.cpp b/src/items/item.cpp index b10db18503d..d4a81d66dc6 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -2473,6 +2473,7 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std:: if (!begin) { s << ')'; } + // This block refers to the look of the weapons. } else if (it.weaponType != WEAPON_AMMO) { bool begin = true; @@ -2487,6 +2488,28 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std:: extraDefense = it.extraDefense; } + if (it.isContainer() || (item && item->getContainer())) { + uint32_t volume = 0; + + if (!item || !item->hasAttribute(ItemAttribute_t::UNIQUEID)) { + if (it.isContainer()) { + volume = it.maxItems; + } else if (item) { + volume = item->getContainer()->capacity(); + } + } + + if (volume != 0) { + if (begin) { + begin = false; + s << " ("; + } else { + s << ", "; + } + + s << "Vol:" << volume; + } + } if (attack != 0) { begin = false; s << " (Atk:" << attack; From 9346cc1c9d5f3ca16e69f6c042d6ae726778e20e Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Thu, 28 Dec 2023 22:12:45 +0000 Subject: [PATCH 3/3] Code format - (Clang-format) --- src/items/item.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/items/item.cpp b/src/items/item.cpp index 0b21a8f65a0..87a3abd7d63 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -2567,7 +2567,7 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std:: if (!begin) { s << ')'; } - // This block refers to the look of the weapons. + // This block refers to the look of the weapons. } else if (it.weaponType != WEAPON_AMMO) { bool begin = true; @@ -2600,7 +2600,7 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std:: } else { s << ", "; } - + s << "Vol:" << volume; } }