Skip to content

Commit

Permalink
[Fix] - Set item tier bytes from "0" to "1" (#219)
Browse files Browse the repository at this point in the history
Modified item tier byte to be 1 by default.
Added one "static_cast<uint8_t>" in the function "item->getImbuementSlot()", for resolve review check from CodeQL.
  • Loading branch information
dudantas authored Feb 16, 2022
1 parent 29846fa commit cc98f40
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -191,7 +191,7 @@ void ProtocolGame::AddItem(NetworkMessage &msg, const Item *item)
msg.addByte(podiumVisible ? static_cast<uint8_t>(boost::get<int64_t>(podiumVisible->value)) : 0x01);
}
if (it.upgradeClassification > 0) {
msg.addByte(0);
msg.addByte(1);
}
}

Expand Down Expand Up @@ -4046,7 +4046,7 @@ void ProtocolGame::sendMarketEnter(uint32_t depotId)
msg.add<uint16_t>(it->first);
if (Item::items[it->first].upgradeClassification > 0)
{
msg.addByte(0);
msg.addByte(1);
}
msg.add<uint16_t>(std::min<uint32_t>(0xFFFF, it->second));
}
Expand Down Expand Up @@ -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<uint32_t>(buyOffers.size());
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -4195,7 +4195,7 @@ void ProtocolGame::sendMarketBrowseOwnOffers(const MarketOfferList &buyOffers, c
msg.add<uint16_t>(offer.counter);
msg.addItemId(offer.itemId);
if (Item::items[offer.itemId].upgradeClassification > 0) {
msg.addByte(0);
msg.addByte(1);
}
msg.add<uint16_t>(offer.amount);
msg.add<uint64_t>(offer.price);
Expand All @@ -4208,7 +4208,7 @@ void ProtocolGame::sendMarketBrowseOwnOffers(const MarketOfferList &buyOffers, c
msg.add<uint16_t>(offer.counter);
msg.addItemId(offer.itemId);
if (Item::items[offer.itemId].upgradeClassification > 0) {
msg.addByte(0);
msg.addByte(1);
}
msg.add<uint16_t>(offer.amount);
msg.add<uint64_t>(offer.price);
Expand All @@ -4230,7 +4230,7 @@ void ProtocolGame::sendMarketCancelOffer(const MarketOfferEx &offer)
msg.add<uint16_t>(offer.counter);
msg.addItemId(offer.itemId);
if (Item::items[offer.itemId].upgradeClassification > 0) {
msg.addByte(0);
msg.addByte(1);
}
msg.add<uint16_t>(offer.amount);
msg.add<uint64_t>(offer.price);
Expand All @@ -4244,7 +4244,7 @@ void ProtocolGame::sendMarketCancelOffer(const MarketOfferEx &offer)
msg.add<uint16_t>(offer.counter);
msg.addItemId(offer.itemId);
if (Item::items[offer.itemId].upgradeClassification > 0) {
msg.addByte(0);
msg.addByte(1);
}
msg.add<uint16_t>(offer.amount);
msg.add<uint64_t>(offer.price);
Expand All @@ -4271,7 +4271,7 @@ void ProtocolGame::sendMarketBrowseOwnHistory(const HistoryMarketOfferList &buyO
msg.add<uint16_t>(counterMap[it->timestamp]++);
msg.addItemId(it->itemId);
if (Item::items[it->itemId].upgradeClassification > 0) {
msg.addByte(0);
msg.addByte(1);
}
msg.add<uint16_t>(it->amount);
msg.add<uint64_t>(it->price);
Expand All @@ -4288,7 +4288,7 @@ void ProtocolGame::sendMarketBrowseOwnHistory(const HistoryMarketOfferList &buyO
msg.add<uint16_t>(counterMap[it->timestamp]++);
msg.addItemId(it->itemId);
if (Item::items[it->itemId].upgradeClassification > 0) {
msg.addByte(0);
msg.addByte(1);
}
msg.add<uint16_t>(it->amount);
msg.add<uint64_t>(it->price);
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<uint8_t>(item->getImbuementSlot()); slotid++)
{
ImbuementInfo imbuementInfo;
if (!item->getImbuementInfo(slotid, &imbuementInfo))
Expand Down Expand Up @@ -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<uint32_t>(it.second);
msg.add<uint32_t>(0);
Expand Down

0 comments on commit cc98f40

Please sign in to comment.