From df811d7669e8929e7a733f36f938f900f09ee06f Mon Sep 17 00:00:00 2001 From: roberto furtado Date: Fri, 29 Dec 2023 03:52:42 -0300 Subject: [PATCH] fix: cyclopedia description (#1923) * double protection information was removed * fixing speed information that showed in half --------- Co-authored-by: Eduardo Dantas Co-authored-by: Luan Santos Co-authored-by: GitHub Actions --- src/items/item.cpp | 51 ++++++++++++++++++++++++---------------------- 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/items/item.cpp b/src/items/item.cpp index a3f0b3f1a4b..87a3abd7d63 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -1291,7 +1291,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()); } @@ -1606,7 +1606,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; } @@ -1653,14 +1653,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++) { @@ -1692,12 +1689,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 << "%"; @@ -1728,17 +1719,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; @@ -2587,6 +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. } else if (it.weaponType != WEAPON_AMMO) { bool begin = true; @@ -2601,6 +2582,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;