From cc98f4024551df2d0f498024a2574791deb80601 Mon Sep 17 00:00:00 2001 From: Eduardo Dantas Date: Tue, 15 Feb 2022 21:50:42 -0300 Subject: [PATCH] [Fix] - Set item tier bytes from "0" to "1" (#219) Modified item tier byte to be 1 by default. Added one "static_cast" in the function "item->getImbuementSlot()", for resolve review check from CodeQL. --- src/server/network/protocol/protocolgame.cpp | 30 ++++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/server/network/protocol/protocolgame.cpp b/src/server/network/protocol/protocolgame.cpp index 4d0943d1b84..486b5d92496 100644 --- a/src/server/network/protocol/protocolgame.cpp +++ b/src/server/network/protocol/protocolgame.cpp @@ -76,7 +76,7 @@ void ProtocolGame::AddItem(NetworkMessage &msg, uint16_t id, uint8_t count) msg.addByte(0x01); } if (it.upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } } @@ -191,7 +191,7 @@ void ProtocolGame::AddItem(NetworkMessage &msg, const Item *item) msg.addByte(podiumVisible ? static_cast(boost::get(podiumVisible->value)) : 0x01); } if (it.upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } } @@ -4046,7 +4046,7 @@ void ProtocolGame::sendMarketEnter(uint32_t depotId) msg.add(it->first); if (Item::items[it->first].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.add(std::min(0xFFFF, it->second)); } @@ -4121,7 +4121,7 @@ void ProtocolGame::sendMarketBrowseItem(uint16_t itemId, const MarketOfferList & msg.addByte(MARKETREQUEST_ITEM_BROWSE); msg.addItemId(itemId); if (Item::items[itemId].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.add(buyOffers.size()); @@ -4155,7 +4155,7 @@ void ProtocolGame::sendMarketAcceptOffer(const MarketOfferEx &offer) msg.addByte(MARKETREQUEST_ITEM_BROWSE); msg.addItemId(offer.itemId); if (Item::items[offer.itemId].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } if (offer.type == MARKETACTION_BUY) @@ -4195,7 +4195,7 @@ void ProtocolGame::sendMarketBrowseOwnOffers(const MarketOfferList &buyOffers, c msg.add(offer.counter); msg.addItemId(offer.itemId); if (Item::items[offer.itemId].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.add(offer.amount); msg.add(offer.price); @@ -4208,7 +4208,7 @@ void ProtocolGame::sendMarketBrowseOwnOffers(const MarketOfferList &buyOffers, c msg.add(offer.counter); msg.addItemId(offer.itemId); if (Item::items[offer.itemId].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.add(offer.amount); msg.add(offer.price); @@ -4230,7 +4230,7 @@ void ProtocolGame::sendMarketCancelOffer(const MarketOfferEx &offer) msg.add(offer.counter); msg.addItemId(offer.itemId); if (Item::items[offer.itemId].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.add(offer.amount); msg.add(offer.price); @@ -4244,7 +4244,7 @@ void ProtocolGame::sendMarketCancelOffer(const MarketOfferEx &offer) msg.add(offer.counter); msg.addItemId(offer.itemId); if (Item::items[offer.itemId].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.add(offer.amount); msg.add(offer.price); @@ -4271,7 +4271,7 @@ void ProtocolGame::sendMarketBrowseOwnHistory(const HistoryMarketOfferList &buyO msg.add(counterMap[it->timestamp]++); msg.addItemId(it->itemId); if (Item::items[it->itemId].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.add(it->amount); msg.add(it->price); @@ -4288,7 +4288,7 @@ void ProtocolGame::sendMarketBrowseOwnHistory(const HistoryMarketOfferList &buyO msg.add(counterMap[it->timestamp]++); msg.addItemId(it->itemId); if (Item::items[it->itemId].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.add(it->amount); msg.add(it->price); @@ -4332,7 +4332,7 @@ void ProtocolGame::sendMarketDetail(uint16_t itemId) const ItemType &it = Item::items[itemId]; if (it.upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } if (it.armor != 0) @@ -6494,12 +6494,12 @@ void ProtocolGame::openImbuementWindow(Item *item) msg.addByte(0xEB); msg.addItemId(item->getID()); if (Item::items[item->getID()].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.addByte(item->getImbuementSlot()); // Send imbuement time - for (uint8_t slotid = 0; slotid < item->getImbuementSlot(); slotid++) + for (uint8_t slotid = 0; slotid < static_cast(item->getImbuementSlot()); slotid++) { ImbuementInfo imbuementInfo; if (!item->getImbuementInfo(slotid, &imbuementInfo)) @@ -6853,7 +6853,7 @@ void ProtocolGame::sendItemsPrice() msg.addItemId(it.first); if (Item::items[it.first].upgradeClassification > 0) { - msg.addByte(0); + msg.addByte(1); } msg.add(it.second); msg.add(0);