From ba748d0a5a73b7bc89f56f6f5627c68ec6dd7d92 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Tue, 17 Sep 2024 21:43:03 -0300 Subject: [PATCH 01/10] feat: new augments and update item description (amber items) --- data/items/items.xml | 118 ++++++++++++++++++++++++-------- src/creatures/combat/spells.cpp | 5 +- src/items/item.cpp | 9 ++- src/items/items.cpp | 7 +- src/items/items_definitions.hpp | 1 + 5 files changed, 103 insertions(+), 37 deletions(-) diff --git a/data/items/items.xml b/data/items/items.xml index 0afe5ebe858..6dfee2fe99f 100644 --- a/data/items/items.xml +++ b/data/items/items.xml @@ -75124,7 +75124,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75150,9 +75152,11 @@ Granted by TibiaGoals.com"/> - + + + - + @@ -75179,7 +75183,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75205,7 +75211,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75231,7 +75239,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75257,7 +75267,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75285,7 +75297,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75312,7 +75326,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75339,7 +75355,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75366,7 +75384,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75393,7 +75413,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75420,7 +75442,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75473,7 +75497,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75503,7 +75529,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75533,7 +75561,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75563,7 +75593,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75612,8 +75644,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75645,8 +75681,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75707,8 +75747,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75740,8 +75784,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75938,7 +75986,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -76101,7 +76151,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -76145,7 +76197,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -76160,8 +76214,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + diff --git a/src/creatures/combat/spells.cpp b/src/creatures/combat/spells.cpp index 105bf734c23..ee2154d2420 100644 --- a/src/creatures/combat/spells.cpp +++ b/src/creatures/combat/spells.cpp @@ -639,7 +639,10 @@ void Spell::getCombatDataAugment(std::shared_ptr player, CombatDamage &d if (augment->value == 0) { continue; } - if (augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || augment->type == Augment_t::StrongImpact) { + if ( + augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || + augment->type == Augment_t::StrongImpact || augment->type == Augment_t::Base + ) { const float augmentPercent = augment->value / 100.0; damage.primary.value += static_cast(damage.primary.value * augmentPercent); damage.secondary.value += static_cast(damage.secondary.value * augmentPercent); diff --git a/src/items/item.cpp b/src/items/item.cpp index dd2d5c965a6..b8fe4b1a566 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -2642,13 +2642,12 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std:: s << "Vol:" << volume; } } - if (attack != 0) { + if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { + begin = false; + s << " (Atk:" << attack << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); + } else if (attack != 0) { begin = false; s << " (Atk:" << attack; - - if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { - s << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); - } } if (defense != 0 || extraDefense != 0 || it.isMissile()) { diff --git a/src/items/items.cpp b/src/items/items.cpp index 2d4020c5416..7e8c7f33c1c 100644 --- a/src/items/items.cpp +++ b/src/items/items.cpp @@ -15,6 +15,7 @@ #include "lua/creature/movement.hpp" #include "game/game.hpp" #include "utils/pugicast.hpp" +#include "creatures/combat/spells.hpp" #include @@ -94,7 +95,7 @@ std::string ItemType::parseAugmentDescription(bool inspect /*= false*/) const { } std::string ItemType::getFormattedAugmentDescription(const std::shared_ptr &augmentInfo) const { - const std::string augmentName = Items::getAugmentNameByType(augmentInfo->type); + const auto &augmentName = Items::getAugmentNameByType(augmentInfo->type); std::string augmentSpellNameCapitalized = augmentInfo->spellName; capitalizeWordsIgnoringString(augmentSpellNameCapitalized, " of "); @@ -104,7 +105,11 @@ std::string ItemType::getFormattedAugmentDescription(const std::shared_ptr {}", augmentSpellNameCapitalized, augmentName); } else if (augmentInfo->type == Augment_t::Cooldown) { return fmt::format("{} -> {}{}s {}", augmentSpellNameCapitalized, signal, augmentInfo->value / 1000, augmentName); + } else if (augmentInfo->type == Augment_t::Base) { + const auto &spell = g_spells().getSpellByName(augmentInfo->spellName); + return fmt::format("{} -> {:+}% {} {}", augmentSpellNameCapitalized, augmentInfo->value, augmentName, spell->getGroup() == SPELLGROUP_HEALING ? "healing" : "damage"); } + return fmt::format("{} -> {:+}% {}", augmentSpellNameCapitalized, augmentInfo->value, augmentName); } diff --git a/src/items/items_definitions.hpp b/src/items/items_definitions.hpp index badac532951..7632c94b484 100644 --- a/src/items/items_definitions.hpp +++ b/src/items/items_definitions.hpp @@ -272,6 +272,7 @@ enum ImbuementTypes_t : int64_t { enum class Augment_t : uint8_t { None, + Base, PowerfulImpact, StrongImpact, IncreasedDamage, From e79e5df87943028b5a7fba2329f18be0322936e0 Mon Sep 17 00:00:00 2001 From: GitHub Actions Date: Wed, 18 Sep 2024 00:44:53 +0000 Subject: [PATCH 02/10] Code format - (Clang-format) --- src/creatures/combat/spells.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/creatures/combat/spells.cpp b/src/creatures/combat/spells.cpp index ee2154d2420..cd700f95ccf 100644 --- a/src/creatures/combat/spells.cpp +++ b/src/creatures/combat/spells.cpp @@ -640,9 +640,8 @@ void Spell::getCombatDataAugment(std::shared_ptr player, CombatDamage &d continue; } if ( - augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || - augment->type == Augment_t::StrongImpact || augment->type == Augment_t::Base - ) { + augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || augment->type == Augment_t::StrongImpact || augment->type == Augment_t::Base + ) { const float augmentPercent = augment->value / 100.0; damage.primary.value += static_cast(damage.primary.value * augmentPercent); damage.secondary.value += static_cast(damage.secondary.value * augmentPercent); From 885921c3e71fc7edaff19427d2845ed5b2eff6cf Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Tue, 17 Sep 2024 21:43:03 -0300 Subject: [PATCH 03/10] feat: new augments and update item description (amber items) --- data/items/items.xml | 118 ++++++++++++++----- src/creatures/combat/spells.cpp | 5 +- src/items/item.cpp | 17 ++- src/items/items.cpp | 7 +- src/items/items_definitions.hpp | 1 + src/server/network/protocol/protocolgame.cpp | 4 +- 6 files changed, 109 insertions(+), 43 deletions(-) diff --git a/data/items/items.xml b/data/items/items.xml index 0afe5ebe858..6dfee2fe99f 100644 --- a/data/items/items.xml +++ b/data/items/items.xml @@ -75124,7 +75124,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75150,9 +75152,11 @@ Granted by TibiaGoals.com"/> - + + + - + @@ -75179,7 +75183,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75205,7 +75211,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75231,7 +75239,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75257,7 +75267,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75285,7 +75297,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75312,7 +75326,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75339,7 +75355,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75366,7 +75384,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75393,7 +75413,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75420,7 +75442,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75473,7 +75497,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75503,7 +75529,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75533,7 +75561,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75563,7 +75593,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -75612,8 +75644,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75645,8 +75681,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75707,8 +75747,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75740,8 +75784,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + @@ -75938,7 +75986,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -76101,7 +76151,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -76145,7 +76197,9 @@ Granted by TibiaGoals.com"/> - + + + @@ -76160,8 +76214,12 @@ Granted by TibiaGoals.com"/> - - + + + + + + diff --git a/src/creatures/combat/spells.cpp b/src/creatures/combat/spells.cpp index 105bf734c23..ee2154d2420 100644 --- a/src/creatures/combat/spells.cpp +++ b/src/creatures/combat/spells.cpp @@ -639,7 +639,10 @@ void Spell::getCombatDataAugment(std::shared_ptr player, CombatDamage &d if (augment->value == 0) { continue; } - if (augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || augment->type == Augment_t::StrongImpact) { + if ( + augment->type == Augment_t::IncreasedDamage || augment->type == Augment_t::PowerfulImpact || + augment->type == Augment_t::StrongImpact || augment->type == Augment_t::Base + ) { const float augmentPercent = augment->value / 100.0; damage.primary.value += static_cast(damage.primary.value * augmentPercent); damage.secondary.value += static_cast(damage.secondary.value * augmentPercent); diff --git a/src/items/item.cpp b/src/items/item.cpp index dd2d5c965a6..b7281da584f 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -1181,12 +1181,12 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr ss << static_cast(shootRange) << " fields"; } descriptions.emplace_back("Attack", ss.str()); - } else if (!it.isRanged() && attack != 0) { + } else if (!it.isRanged()) { if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { ss.str(""); ss << attack << " physical +" << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); descriptions.emplace_back("Attack", ss.str()); - } else { + } else if (it.attack != 0) { descriptions.emplace_back("Attack", std::to_string(attack)); } } @@ -1594,12 +1594,12 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr ss << static_cast(shootRange) << " fields"; } descriptions.emplace_back("Attack", ss.str()); - } else if (!it.isRanged() && attack != 0) { + } else if (!it.isRanged()) { if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { ss.str(""); ss << attack << " physical +" << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); descriptions.emplace_back("Attack", ss.str()); - } else { + } else if (it.attack != 0) { descriptions.emplace_back("Attack", std::to_string(attack)); } } @@ -2642,13 +2642,12 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std:: s << "Vol:" << volume; } } - if (attack != 0) { + if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { + begin = false; + s << " (Atk:" << attack << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); + } else if (attack != 0) { begin = false; s << " (Atk:" << attack; - - if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { - s << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); - } } if (defense != 0 || extraDefense != 0 || it.isMissile()) { diff --git a/src/items/items.cpp b/src/items/items.cpp index 2d4020c5416..7e8c7f33c1c 100644 --- a/src/items/items.cpp +++ b/src/items/items.cpp @@ -15,6 +15,7 @@ #include "lua/creature/movement.hpp" #include "game/game.hpp" #include "utils/pugicast.hpp" +#include "creatures/combat/spells.hpp" #include @@ -94,7 +95,7 @@ std::string ItemType::parseAugmentDescription(bool inspect /*= false*/) const { } std::string ItemType::getFormattedAugmentDescription(const std::shared_ptr &augmentInfo) const { - const std::string augmentName = Items::getAugmentNameByType(augmentInfo->type); + const auto &augmentName = Items::getAugmentNameByType(augmentInfo->type); std::string augmentSpellNameCapitalized = augmentInfo->spellName; capitalizeWordsIgnoringString(augmentSpellNameCapitalized, " of "); @@ -104,7 +105,11 @@ std::string ItemType::getFormattedAugmentDescription(const std::shared_ptr {}", augmentSpellNameCapitalized, augmentName); } else if (augmentInfo->type == Augment_t::Cooldown) { return fmt::format("{} -> {}{}s {}", augmentSpellNameCapitalized, signal, augmentInfo->value / 1000, augmentName); + } else if (augmentInfo->type == Augment_t::Base) { + const auto &spell = g_spells().getSpellByName(augmentInfo->spellName); + return fmt::format("{} -> {:+}% {} {}", augmentSpellNameCapitalized, augmentInfo->value, augmentName, spell->getGroup() == SPELLGROUP_HEALING ? "healing" : "damage"); } + return fmt::format("{} -> {:+}% {}", augmentSpellNameCapitalized, augmentInfo->value, augmentName); } diff --git a/src/items/items_definitions.hpp b/src/items/items_definitions.hpp index badac532951..7632c94b484 100644 --- a/src/items/items_definitions.hpp +++ b/src/items/items_definitions.hpp @@ -272,6 +272,7 @@ enum ImbuementTypes_t : int64_t { enum class Augment_t : uint8_t { None, + Base, PowerfulImpact, StrongImpact, IncreasedDamage, diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index aab3f88bd47..a02c2fcc851 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -5740,12 +5740,12 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId, uint8_t tier) { ss << static_cast(it.shootRange) << " fields"; } msg.addString(ss.str(), "ProtocolGame::sendMarketDetail - ss.str()"); - } else if (!it.isRanged() && it.attack != 0) { + } else if (!it.isRanged()) { if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { std::ostringstream ss; ss << it.attack << " physical +" << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); msg.addString(ss.str(), "ProtocolGame::sendMarketDetail - ss.str()"); - } else { + } else if (it.attack != 0) { msg.addString(std::to_string(it.attack), "ProtocolGame::sendMarketDetail - std::to_string(it.attack)"); } } else { From 9f9eae960c80f07eb3faad9c951dcf273083308a Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Sun, 22 Sep 2024 22:12:35 -0300 Subject: [PATCH 04/10] fix: items description --- src/items/item.cpp | 43 +++++++++++++------- src/server/network/protocol/protocolgame.cpp | 15 ++++--- 2 files changed, 39 insertions(+), 19 deletions(-) diff --git a/src/items/item.cpp b/src/items/item.cpp index b7281da584f..95153bb812e 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -1182,12 +1182,17 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr } descriptions.emplace_back("Attack", ss.str()); } else if (!it.isRanged()) { + std::string attackDescription; if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { - ss.str(""); - ss << attack << " physical +" << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); - descriptions.emplace_back("Attack", ss.str()); - } else if (it.attack != 0) { - descriptions.emplace_back("Attack", std::to_string(attack)); + attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); + } + + if (it.attack != 0) { + attackDescription = fmt::format("{} physical + {}", attack, attackDescription); + } + + if (!attackDescription.empty()) { + descriptions.emplace_back("Attack", attackDescription); } } @@ -1595,12 +1600,17 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr } descriptions.emplace_back("Attack", ss.str()); } else if (!it.isRanged()) { + std::string attackDescription; if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { - ss.str(""); - ss << attack << " physical +" << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); - descriptions.emplace_back("Attack", ss.str()); - } else if (it.attack != 0) { - descriptions.emplace_back("Attack", std::to_string(attack)); + attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); + } + + if (it.attack != 0) { + attackDescription = fmt::format("{} physical + {}", attack, attackDescription); + } + + if (!attackDescription.empty()) { + descriptions.emplace_back("Attack", attackDescription); } } @@ -2642,14 +2652,19 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std:: s << "Vol:" << volume; } } - if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { - begin = false; - s << " (Atk:" << attack << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); - } else if (attack != 0) { + + if (attack != 0) { begin = false; s << " (Atk:" << attack; } + if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0 && !begin) { + s << " physical + " << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); + } else if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0 && begin) { + begin = false; + s << " (" << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); + } + if (defense != 0 || extraDefense != 0 || it.isMissile()) { if (begin) { begin = false; diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index a02c2fcc851..d2d31d4206d 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -5741,12 +5741,17 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId, uint8_t tier) { } msg.addString(ss.str(), "ProtocolGame::sendMarketDetail - ss.str()"); } else if (!it.isRanged()) { + std::string attackDescription; if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { - std::ostringstream ss; - ss << it.attack << " physical +" << it.abilities->elementDamage << ' ' << getCombatName(it.abilities->elementType); - msg.addString(ss.str(), "ProtocolGame::sendMarketDetail - ss.str()"); - } else if (it.attack != 0) { - msg.addString(std::to_string(it.attack), "ProtocolGame::sendMarketDetail - std::to_string(it.attack)"); + attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); + } + + if (it.attack != 0) { + attackDescription = fmt::format("{} physical + {}", it.attack, attackDescription); + } + + if (!attackDescription.empty()) { + msg.addString(attackDescription, "ProtocolGame::sendMarketDetail - attackDescription"); } } else { msg.add(0x00); From 8d8c450d1f0a57babddd7e02a72576c4db5cfc6e Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Sun, 22 Sep 2024 22:18:11 -0300 Subject: [PATCH 05/10] fix: incorrect item augment value --- data/items/items.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/data/items/items.xml b/data/items/items.xml index 6dfee2fe99f..0838f1c93c6 100644 --- a/data/items/items.xml +++ b/data/items/items.xml @@ -75594,7 +75594,7 @@ Granted by TibiaGoals.com"/> - + From cd534affa96d7f20ea991a3a111ef8757942934e Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Mon, 23 Sep 2024 23:13:45 -0300 Subject: [PATCH 06/10] fix: items with only attack bug --- src/items/item.cpp | 8 ++++++-- src/server/network/protocol/protocolgame.cpp | 8 ++++---- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/items/item.cpp b/src/items/item.cpp index 95153bb812e..81e63382cce 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -1187,8 +1187,10 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); } - if (it.attack != 0) { + if (attack != 0 && !attackDescription.empty()) { attackDescription = fmt::format("{} physical + {}", attack, attackDescription); + } else if (attack != 0 && attackDescription.empty()) { + attackDescription = std::to_string(attack); } if (!attackDescription.empty()) { @@ -1605,8 +1607,10 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); } - if (it.attack != 0) { + if (attack != 0 && !attackDescription.empty()) { attackDescription = fmt::format("{} physical + {}", attack, attackDescription); + } else if (attack != 0 && attackDescription.empty()) { + attackDescription = std::to_string(attack); } if (!attackDescription.empty()) { diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index d2d31d4206d..f81fb2b21a0 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -5746,13 +5746,13 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId, uint8_t tier) { attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); } - if (it.attack != 0) { + if (it.attack != 0 && !attackDescription.empty()) { attackDescription = fmt::format("{} physical + {}", it.attack, attackDescription); + } else if (it.attack != 0 && attackDescription.empty()) { + attackDescription = std::to_string(it.attack); } - if (!attackDescription.empty()) { - msg.addString(attackDescription, "ProtocolGame::sendMarketDetail - attackDescription"); - } + msg.addString(attackDescription, "ProtocolGame::sendMarketDetail - attackDescription"); } else { msg.add(0x00); } From 4ad267f691ce89f441a49e422582cb532d3037c2 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Mon, 23 Sep 2024 23:36:52 -0300 Subject: [PATCH 07/10] feat: add faster regeneration to items on look --- src/items/item.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/items/item.cpp b/src/items/item.cpp index 81e63382cce..04ef24cbb76 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -1260,6 +1260,10 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr skillBoost = true; } + if (it.abilities->regeneration) { + ss << ", faster regeneration"; + } + if (it.abilities->stats[STAT_MAGICPOINTS]) { if (skillBoost) { ss << ", "; @@ -2699,6 +2703,17 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std:: s << getSkillName(i) << ' ' << std::showpos << it.abilities->skills[i] << std::noshowpos; } + if (it.abilities->regeneration) { + if (begin) { + begin = false; + s << " ("; + } else { + s << ", "; + } + + s << "faster regeneration"; + } + for (uint8_t i = SKILL_CRITICAL_HIT_CHANCE; i <= SKILL_LAST; i++) { auto skill = item ? item->getSkill(static_cast(i)) : it.getSkill(static_cast(i)); if (!skill) { From 52fbf5c0a67d84d3ca9491db752287cca1de9256 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Mon, 14 Oct 2024 10:35:44 -0300 Subject: [PATCH 08/10] fix: compilation --- src/server/network/protocol/protocolgame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index 7f0185e632a..996cf7b3c17 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -5756,7 +5756,7 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId, uint8_t tier) { attackDescription = std::to_string(it.attack); } - msg.addString(attackDescription, "ProtocolGame::sendMarketDetail - attackDescription"); + msg.addString(attackDescription); } else { msg.add(0x00); } From 88909104dcad574b73c200d279dfd1a01e6b6956 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Tue, 29 Oct 2024 23:58:20 -0300 Subject: [PATCH 09/10] fix: const ref removal and always true conditional --- src/items/item.cpp | 4 ++-- src/items/items.cpp | 2 +- src/server/network/protocol/protocolgame.cpp | 4 +--- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/items/item.cpp b/src/items/item.cpp index aa8d3bc5418..d58d7759b47 100644 --- a/src/items/item.cpp +++ b/src/items/item.cpp @@ -1179,7 +1179,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr ss << static_cast(shootRange) << " fields"; } descriptions.emplace_back("Attack", ss.str()); - } else if (!it.isRanged()) { + } else { std::string attackDescription; if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); @@ -1603,7 +1603,7 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr item /*= nullptr ss << static_cast(shootRange) << " fields"; } descriptions.emplace_back("Attack", ss.str()); - } else if (!it.isRanged()) { + } else { std::string attackDescription; if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); diff --git a/src/items/items.cpp b/src/items/items.cpp index d0df4a130b8..6539481cb16 100644 --- a/src/items/items.cpp +++ b/src/items/items.cpp @@ -93,7 +93,7 @@ std::string ItemType::parseAugmentDescription(bool inspect /*= false*/) const { } std::string ItemType::getFormattedAugmentDescription(const std::shared_ptr &augmentInfo) const { - const auto &augmentName = Items::getAugmentNameByType(augmentInfo->type); + const auto augmentName = Items::getAugmentNameByType(augmentInfo->type); std::string augmentSpellNameCapitalized = augmentInfo->spellName; capitalizeWordsIgnoringString(augmentSpellNameCapitalized, " of "); diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index 996cf7b3c17..b1e97cbf9a0 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -5744,7 +5744,7 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId, uint8_t tier) { ss << static_cast(it.shootRange) << " fields"; } msg.addString(ss.str()); - } else if (!it.isRanged()) { + } else { std::string attackDescription; if (it.abilities && it.abilities->elementType != COMBAT_NONE && it.abilities->elementDamage != 0) { attackDescription = fmt::format("{} {}", it.abilities->elementDamage, getCombatName(it.abilities->elementType)); @@ -5757,8 +5757,6 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId, uint8_t tier) { } msg.addString(attackDescription); - } else { - msg.add(0x00); } if (it.isContainer()) { From fed6be2253d95a74440ed8ae13e9e465051dea18 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Alves Cruz Date: Wed, 30 Oct 2024 01:51:19 -0300 Subject: [PATCH 10/10] fix: remove skillboost decimal percentage from market details --- src/server/network/protocol/protocolgame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index 483beb15a0a..48800cc27ba 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -5869,7 +5869,7 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId, uint8_t tier) { separator = true; } - ss << fmt::format("{} {:+.2f}%", getSkillName(i), skills / 100.0); + ss << fmt::format("{} {:+}%", getSkillName(i), skills / 100.0); } if (it.abilities->stats[STAT_MAGICPOINTS] != 0) {