Skip to content

Commit

Permalink
fix: items with only attack bug
Browse files Browse the repository at this point in the history
  • Loading branch information
phacUFPE committed Sep 24, 2024
1 parent 8d8c450 commit cd534af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions src/items/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1187,8 +1187,10 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr<Item> 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()) {
Expand Down Expand Up @@ -1605,8 +1607,10 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr<Item> 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()) {
Expand Down
8 changes: 4 additions & 4 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<uint16_t>(0x00);
}
Expand Down

0 comments on commit cd534af

Please sign in to comment.