Skip to content

Commit

Permalink
fix: quiver bugs (opentibiabr#2609)
Browse files Browse the repository at this point in the history
  • Loading branch information
phacUFPE authored May 7, 2024
1 parent 9efbe4c commit afb1b0d
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
33 changes: 20 additions & 13 deletions src/items/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,10 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr<Item> item /*= nullptr
descriptions.emplace_back("Description", it.description);
}

if (item->getContainer()) {
descriptions.emplace_back("Capacity", std::to_string(item->getContainer()->capacity()));
}

if (it.showCharges) {
auto charges = item->getAttribute<int32_t>(ItemAttribute_t::CHARGES);
if (charges != 0) {
Expand Down Expand Up @@ -1403,10 +1407,6 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr<Item> item /*= nullptr
descriptions.emplace_back("Tier", std::to_string(item->getTier()));
}

if (item->getContainer()) {
descriptions.emplace_back("Capacity", std::to_string(item->getContainer()->capacity()));
}

std::string slotName;
if (item->getImbuementSlot() > 0) {
for (uint8_t i = 0; i < item->getImbuementSlot(); ++i) {
Expand Down Expand Up @@ -1562,6 +1562,10 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr<Item> item /*= nullptr
descriptions.emplace_back("Description", it.description);
}

if (it.isContainer()) {
descriptions.emplace_back("Capacity", std::to_string(it.maxItems));
}

int32_t attack = it.attack;
if (it.isRanged()) {
bool separator = false;
Expand Down Expand Up @@ -1781,10 +1785,6 @@ Item::getDescriptions(const ItemType &it, std::shared_ptr<Item> item /*= nullptr
}
}

if (it.isContainer()) {
descriptions.emplace_back("Capacity", std::to_string(it.maxItems));
}

if (it.imbuementSlot > 0) {
descriptions.emplace_back("Imbuement Slots", std::to_string(it.imbuementSlot));
}
Expand Down Expand Up @@ -2075,13 +2075,18 @@ std::string Item::parseShowDuration(std::shared_ptr<Item> item) {
std::string Item::parseShowAttributesDescription(std::shared_ptr<Item> item, const uint16_t itemId) {
std::ostringstream itemDescription;
const ItemType &itemType = Item::items[itemId];

if (itemType.armor != 0 || (item && item->getArmor() != 0) || itemType.showAttributes) {
bool begin = true;
bool begin = itemType.isQuiver() ? false : true;

int32_t armor = (item ? item->getArmor() : itemType.armor);
if (armor != 0) {
itemDescription << " (Arm:" << armor;
begin = false;
if (begin) {
itemDescription << " (Arm:" << armor;
begin = false;
} else {
itemDescription << ", Arm:" << armor;
}
}

if (itemType.abilities) {
Expand Down Expand Up @@ -2167,7 +2172,7 @@ std::string Item::parseShowAttributesDescription(std::shared_ptr<Item> item, con
itemDescription << ", ";
}

itemDescription << "Perfect Shot " << std::showpos << itemType.abilities->perfectShotDamage << std::noshowpos << " at range " << unsigned(itemType.abilities->perfectShotRange);
itemDescription << "perfect shot " << std::showpos << itemType.abilities->perfectShotDamage << std::noshowpos << " at range " << unsigned(itemType.abilities->perfectShotRange);
}

if (itemType.abilities->reflectFlat[0] != 0) {
Expand Down Expand Up @@ -2869,8 +2874,10 @@ std::string Item::getDescription(const ItemType &it, int32_t lookDistance, std::
}
}

if (volume != 0) {
if (volume != 0 && !it.isQuiver()) {
s << " (Vol:" << volume << ')';
} else if (volume != 0 && it.isQuiver()) {
s << " (Vol:" << volume;
}
} else {
bool found = true;
Expand Down
2 changes: 1 addition & 1 deletion src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5643,7 +5643,7 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId, uint8_t tier) {

if (it.abilities->perfectShotDamage > 0) {
string.clear();
string << std::showpos << it.abilities->perfectShotDamage << std::noshowpos << " at " << it.abilities->perfectShotRange << "%";
string << std::showpos << it.abilities->perfectShotDamage << std::noshowpos << " at range " << unsigned(it.abilities->perfectShotRange);
msg.addString(string.str(), "ProtocolGame::sendMarketDetail - string.str()");
} else {
msg.add<uint16_t>(0x00);
Expand Down

0 comments on commit afb1b0d

Please sign in to comment.