Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: forge correct slots #2850

Merged
merged 6 commits into from
Sep 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 29 additions & 11 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@
const auto lookLegs = item->getCustomAttribute(legs);
const auto lookFeet = item->getCustomAttribute(feet);

msg.addByte(lookHead ? lookHead->getAttribute<uint8_t>() : 0);

Check warning on line 85 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(lookBody ? lookBody->getAttribute<uint8_t>() : 0);

Check warning on line 86 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(lookLegs ? lookLegs->getAttribute<uint8_t>() : 0);

Check warning on line 87 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(lookFeet ? lookFeet->getAttribute<uint8_t>() : 0);

Check warning on line 88 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

if (addAddon) {
const auto lookAddons = item->getCustomAttribute("LookAddons");
msg.addByte(lookAddons ? lookAddons->getAttribute<uint8_t>() : 0);

Check warning on line 92 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
} else {
if (addByte) {
Expand Down Expand Up @@ -124,7 +124,7 @@
if (weapon) {
uint8_t slots = Item::items[weapon->getID()].imbuementSlot;
if (slots > 0) {
for (uint8_t i = 0; i < slots; i++) {

Check warning on line 127 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
ImbuementInfo imbuementInfo;
if (!weapon->getImbuementInfo(i, &imbuementInfo)) {
continue;
Expand All @@ -133,8 +133,8 @@
if (imbuementInfo.duration > 0) {
auto imbuement = *imbuementInfo.imbuement;
if (imbuement.combatType != COMBAT_NONE) {
msg.addByte(static_cast<uint32_t>(imbuement.elementDamage));

Check warning on line 136 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(getCipbiaElement(imbuement.combatType));

Check warning on line 137 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
imbueDmg = true;
break;
}
Expand All @@ -143,8 +143,8 @@
}
}
if (!imbueDmg) {
msg.addByte(0);

Check warning on line 146 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0);

Check warning on line 147 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

Expand Down Expand Up @@ -180,7 +180,7 @@

uint8_t imbuementSlots = itemType.imbuementSlot;
if (imbuementSlots > 0) {
for (uint8_t slotId = 0; slotId < imbuementSlots; ++slotId) {

Check warning on line 183 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
ImbuementInfo imbuementInfo;
if (!item->getImbuementInfo(slotId, &imbuementInfo)) {
continue;
Expand Down Expand Up @@ -214,7 +214,7 @@
if (damageModifiers[i] != 10000) {
int16_t clientModifier = std::clamp(10000 - static_cast<int16_t>(damageModifiers[i]), -10000, 10000);
g_logger().debug("[{}] CombatType: {}, Damage Modifier: {}, Resulting Client Modifier: {}", __FUNCTION__, i, damageModifiers[i], clientModifier);
msg.addByte(getCipbiaElement(indexToCombatType(i)));

Check warning on line 217 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<int16_t>(clientModifier);
++combats;
}
Expand All @@ -231,10 +231,10 @@
* @param msg The network message to send the category to.
*/
template <typename T>
void sendContainerCategory(NetworkMessage &msg, const std::vector<T> &categories = {}, uint8_t categoryType = 0) {

Check warning on line 234 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(categoryType);
g_logger().debug("Sendding category type '{}', categories total size '{}'", categoryType, categories.size());
msg.addByte(categories.size());

Check warning on line 237 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (auto value : categories) {
if (value == T::All) {
continue;
Expand All @@ -258,7 +258,7 @@
msg.add<uint16_t>(it.id);

if (oldProtocol) {
msg.addByte(0xFF);

Check warning on line 261 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (it.stackable) {
Expand All @@ -271,16 +271,16 @@

if (oldProtocol) {
if (it.animationType == ANIMATION_RANDOM) {
msg.addByte(0xFE);

Check warning on line 274 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else if (it.animationType == ANIMATION_DESYNC) {
msg.addByte(0xFF);

Check warning on line 276 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

return;
}

if (it.isContainer()) {
msg.addByte(0x00);

Check warning on line 283 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (it.isPodium) {
Expand All @@ -288,8 +288,8 @@
msg.add<uint16_t>(0);
msg.add<uint16_t>(0);

msg.addByte(2);

Check warning on line 291 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x01);

Check warning on line 292 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (it.upgradeClassification > 0) {
Expand All @@ -298,12 +298,12 @@

if (it.expire || it.expireStop || it.clockExpire) {
msg.add<uint32_t>(it.decayTime);
msg.addByte(0x01); // Brand-new

Check warning on line 301 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (it.wearOut) {
msg.add<uint32_t>(it.charges);
msg.addByte(0x01); // Brand-new

Check warning on line 306 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (it.isWrapKit && !oldProtocol) {
Expand All @@ -321,7 +321,7 @@
msg.add<uint16_t>(it.id);

if (oldProtocol) {
msg.addByte(0xFF);

Check warning on line 324 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (it.stackable) {
Expand All @@ -334,16 +334,16 @@

if (oldProtocol) {
if (it.animationType == ANIMATION_RANDOM) {
msg.addByte(0xFE);

Check warning on line 337 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else if (it.animationType == ANIMATION_DESYNC) {
msg.addByte(0xFF);

Check warning on line 339 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

return;
}

if (it.isContainer()) {
uint8_t containerType = 0;

Check warning on line 346 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

std::shared_ptr<Container> container = item->getContainer();
if (container && containerType == 0 && container->getHoldingPlayer() == player) {
Expand All @@ -362,7 +362,7 @@
}

if (lootFlags != 0 || obtainFlags != 0) {
containerType = 9;

Check warning on line 365 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(containerType);
msg.add<uint32_t>(lootFlags);
msg.add<uint32_t>(obtainFlags);
Expand All @@ -377,13 +377,13 @@
ammoTotal += listItem->getItemCount();
}
}
containerType = 2;

Check warning on line 380 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(containerType);
msg.add<uint32_t>(ammoTotal);
}

if (containerType == 0) {
msg.addByte(0x00);

Check warning on line 386 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

Expand Down Expand Up @@ -415,8 +415,8 @@
msg.add<uint16_t>(0);
}

msg.addByte(lookDirection ? lookDirection->getAttribute<uint8_t>() : 2);

Check warning on line 418 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(podiumVisible ? podiumVisible->getAttribute<uint8_t>() : 0x01);

Check warning on line 419 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (item->getClassification() > 0) {
Expand All @@ -427,10 +427,10 @@
if (it.expire || it.expireStop || it.clockExpire) {
if (item->hasAttribute(ItemAttribute_t::DURATION)) {
msg.add<uint32_t>(item->getDuration() / 1000);
msg.addByte((item->getDuration() / 1000) == it.decayTime ? 0x01 : 0x00); // Brand-new

Check warning on line 430 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else {
msg.add<uint32_t>(it.decayTime);
msg.addByte(0x01); // Brand-new

Check warning on line 433 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

Expand All @@ -438,10 +438,10 @@
if (it.wearOut) {
if (item->getSubType() == 0) {
msg.add<uint32_t>(it.charges);
msg.addByte(0x01); // Brand-new

Check warning on line 441 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else {
msg.add<uint32_t>(static_cast<uint32_t>(item->getSubType()));
msg.addByte(item->getSubType() == it.charges ? 0x01 : 0x00); // Brand-new

Check warning on line 444 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

Expand Down Expand Up @@ -476,8 +476,8 @@
if (operatingSystem >= CLIENTOS_OTCLIENT_LINUX) {
isOTC = true;
NetworkMessage opcodeMessage;
opcodeMessage.addByte(0x32);

Check warning on line 479 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
opcodeMessage.addByte(0x00);

Check warning on line 480 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
opcodeMessage.add<uint16_t>(0x00);
writeToOutputBuffer(opcodeMessage);
}
Expand Down Expand Up @@ -567,7 +567,7 @@
<< currentSlot << " on the waiting list.";

auto output = OutputMessagePool::getOutputMessage();
output->addByte(0x16);

Check warning on line 570 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
output->addString(ss.str(), "ProtocolGame::login - ss.str()");
output->addByte(retryTime);
send(output);
Expand Down Expand Up @@ -698,7 +698,7 @@

sendSessionEndInformation(forced ? SESSION_END_FORCECLOSE : SESSION_END_LOGOUT);

g_game().removeCreature(player, true);

Check warning on line 701 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

err33-c

the value returned by this function should not be disregarded; neglecting it may lead to errors
}

void ProtocolGame::onRecvFirstMessage(NetworkMessage &msg) {
Expand Down Expand Up @@ -850,7 +850,7 @@
}

auto output = OutputMessagePool::getOutputMessage();
output->addByte(0x14);

Check warning on line 853 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
output->addString(ss.str(), "ProtocolGame::onRecvFirstMessage - ss.str()");
send(output);
g_dispatcher().scheduleEvent(
Expand All @@ -873,7 +873,7 @@

// Packet length & type
output->add<uint16_t>(0x0006);
output->addByte(0x1F);

Check warning on line 876 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

// Add timestamp & random number
challengeTimestamp = static_cast<uint32_t>(time(nullptr));
Expand All @@ -892,7 +892,7 @@

void ProtocolGame::disconnectClient(const std::string &message) const {
auto output = OutputMessagePool::getOutputMessage();
output->addByte(0x14);

Check warning on line 895 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
output->addString(message, "ProtocolGame::disconnectClient - message");
send(output);
disconnect();
Expand Down Expand Up @@ -958,7 +958,7 @@

if (!player->spawn()) {
disconnect();
g_game().removeCreature(player, true);

Check warning on line 961 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

err33-c

the value returned by this function should not be disregarded; neglecting it may lead to errors
return;
}

Expand Down Expand Up @@ -1472,7 +1472,7 @@

if (skip >= 0) {
msg.addByte(skip);
msg.addByte(0xFF);

Check warning on line 1475 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

Expand All @@ -1482,15 +1482,15 @@
std::shared_ptr<Tile> tile = g_game().map.getTile(static_cast<uint16_t>(x + nx + offset), static_cast<uint16_t>(y + ny + offset), static_cast<uint8_t>(z));
if (tile) {
if (skip >= 0) {
msg.addByte(skip);

Check warning on line 1485 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0xFF);

Check warning on line 1486 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

skip = 0;
GetTileDescription(tile, msg);
} else if (skip == 0xFE) {
msg.addByte(0xFF);

Check warning on line 1492 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0xFF);

Check warning on line 1493 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
skip = -1;
} else {
++skip;
Expand Down Expand Up @@ -1578,7 +1578,7 @@
}

// negative offset means that the action taken place is on a lower floor than ourself
const int8_t offsetz = myPos.getZ() - z;

Check warning on line 1581 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
return (x >= myPos.getX() - MAP_MAX_CLIENT_VIEW_PORT_X + offsetz) && (x <= myPos.getX() + (MAP_MAX_CLIENT_VIEW_PORT_X + 1) + offsetz) && (y >= myPos.getY() - MAP_MAX_CLIENT_VIEW_PORT_Y + offsetz) && (y <= myPos.getY() + (MAP_MAX_CLIENT_VIEW_PORT_Y + 1) + offsetz);
}

Expand Down Expand Up @@ -1661,7 +1661,7 @@
}

uint16_t startBufferPosition = msg.getBufferPosition();
Module* outfitModule = g_modules().getEventByRecvbyte(0xD3, false);

Check warning on line 1664 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (outfitModule) {
outfitModule->executeOnRecvbyte(player, msg);
}
Expand All @@ -1670,15 +1670,15 @@
uint8_t outfitType = !oldProtocol ? msg.getByte() : 0;
Outfit_t newOutfit;
newOutfit.lookType = msg.get<uint16_t>();
newOutfit.lookHead = std::min<uint8_t>(132, msg.getByte());

Check warning on line 1673 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newOutfit.lookBody = std::min<uint8_t>(132, msg.getByte());

Check warning on line 1674 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newOutfit.lookLegs = std::min<uint8_t>(132, msg.getByte());

Check warning on line 1675 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newOutfit.lookFeet = std::min<uint8_t>(132, msg.getByte());

Check warning on line 1676 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newOutfit.lookAddons = msg.getByte();
if (outfitType == 0) {
newOutfit.lookMount = msg.get<uint16_t>();
if (!oldProtocol) {
newOutfit.lookMountHead = std::min<uint8_t>(132, msg.getByte());

Check warning on line 1681 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newOutfit.lookMountBody = std::min<uint8_t>(132, msg.getByte());
newOutfit.lookMountLegs = std::min<uint8_t>(132, msg.getByte());
newOutfit.lookMountFeet = std::min<uint8_t>(132, msg.getByte());
Expand All @@ -1699,11 +1699,11 @@
uint16_t itemId = msg.get<uint16_t>();
uint8_t stackpos = msg.getByte();
newOutfit.lookMount = msg.get<uint16_t>();
newOutfit.lookMountHead = std::min<uint8_t>(132, msg.getByte());

Check warning on line 1702 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newOutfit.lookMountBody = std::min<uint8_t>(132, msg.getByte());

Check warning on line 1703 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newOutfit.lookMountLegs = std::min<uint8_t>(132, msg.getByte());
newOutfit.lookMountFeet = std::min<uint8_t>(132, msg.getByte());
uint8_t direction = std::max<uint8_t>(DIRECTION_NORTH, std::min<uint8_t>(DIRECTION_WEST, msg.getByte()));

Check warning on line 1706 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

Check warning on line 1706 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
uint8_t podiumVisible = msg.getByte();
g_game().playerSetShowOffSocket(player->getID(), newOutfit, pos, stackpos, itemId, podiumVisible, direction);
}
Expand Down Expand Up @@ -2011,7 +2011,7 @@
uint32_t icon = std::min<uint32_t>(10, msg.get<uint32_t>()); // 10 is max icon in 9.63
bool notify = msg.getByte() != 0;
uint8_t groupsAmount = msg.getByte();
for (uint8_t i = 0; i < groupsAmount; ++i) {

Check warning on line 2014 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
uint8_t groupId = msg.getByte();
vipGroupsId.emplace_back(groupId);
}
Expand Down Expand Up @@ -2082,8 +2082,8 @@
void ProtocolGame::sendSessionEndInformation(SessionEndInformations information) {
if (!oldProtocol) {
auto output = OutputMessagePool::getOutputMessage();
output->addByte(0x18);

Check warning on line 2085 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
output->addByte(information);

Check warning on line 2086 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
send(output);
}
disconnect();
Expand All @@ -2095,9 +2095,9 @@
}

NetworkMessage msg;
msg.addByte(0x76);

Check warning on line 2098 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x00);

Check warning on line 2099 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(cyclopedia ? 0x01 : 0x00);

Check warning on line 2100 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(player->getID()); // 13.00 Creature ID
msg.addByte(0x01);

Expand All @@ -2108,12 +2108,12 @@
AddItem(msg, item);
} else {
msg.addString(it.name, "ProtocolGame::sendItemInspection - it.name");
AddItem(msg, it.id, itemCount, 0);

Check warning on line 2111 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
msg.addByte(0);

Check warning on line 2113 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

auto descriptions = Item::getDescriptions(it, item);
msg.addByte(descriptions.size());

Check warning on line 2116 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (const auto &description : descriptions) {
msg.addString(description.first, "ProtocolGame::sendItemInspection - description.first");
msg.addString(description.second, "ProtocolGame::sendItemInspection - description.second");
Expand Down Expand Up @@ -2164,7 +2164,7 @@
if (type == HIGHSCORE_GETENTRIES) {
page = std::max<uint16_t>(1, msg.get<uint16_t>());
}
uint8_t entriesPerPage = std::min<uint8_t>(30, std::max<uint8_t>(5, msg.getByte()));

Check warning on line 2167 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

Check warning on line 2167 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
g_game().playerHighscores(player, type, category, vocation, worldName, page, entriesPerPage);
}

Expand Down Expand Up @@ -2202,19 +2202,19 @@
}

NetworkMessage msg;
msg.addByte(0xB1);

Check warning on line 2205 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x00); // All data available

msg.addByte(1); // Worlds

Check warning on line 2208 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
auto serverName = g_configManager().getString(SERVER_NAME, __FUNCTION__);
msg.addString(serverName, "ProtocolGame::sendHighscores - g_configManager().getString(SERVER_NAME)"); // First World
msg.addString(serverName, "ProtocolGame::sendHighscores - g_configManager().getString(SERVER_NAME)"); // Selected World

msg.addByte(0); // Game World Category: 0xFF(-1) - Selected World

Check warning on line 2213 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0); // BattlEye World Type

Check warning on line 2214 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

auto vocationPosition = msg.getBufferPosition();
uint8_t vocations = 1;

Check warning on line 2217 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

msg.skipBytes(1); // Vocation Count
msg.add<uint32_t>(0xFFFFFFFF); // All Vocations - hardcoded
Expand All @@ -2235,9 +2235,9 @@
}
msg.add<uint32_t>(selectedVocation); // Selected Vocation

uint8_t selectedCategory = 0;

Check warning on line 2238 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
const auto &highscoreCategories = g_game().getHighscoreCategories();
msg.addByte(highscoreCategories.size()); // Category Count

Check warning on line 2240 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
g_logger().debug("[ProtocolGame::sendHighscores] - Category Count: {}", highscoreCategories.size());
for (const HighscoreCategory &category : highscoreCategories) {
g_logger().debug("[ProtocolGame::sendHighscores] - Category: {} - Name: {}", category.m_id, category.m_name);
Expand All @@ -2260,13 +2260,13 @@
msg.addByte(character.vocation); // Vocation Id
msg.addString(serverName, "ProtocolGame::sendHighscores - g_configManager().getString(SERVER_NAME)"); // World
msg.add<uint16_t>(character.level); // Level
msg.addByte((player->getGUID() == character.id)); // Player Indicator Boolean

Check warning on line 2263 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint64_t>(character.points); // Points
}

msg.addByte(0xFF); // ??

Check warning on line 2267 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0); // ??

Check warning on line 2268 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(1); // ??

Check warning on line 2269 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(updateTimer); // Last Update
msg.setBufferPosition(vocationPosition);
msg.addByte(vocations);
Expand Down Expand Up @@ -2306,10 +2306,10 @@
}

NetworkMessage msg;
msg.addByte(0xd5);

Check warning on line 2309 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint16_t>(BESTY_RACE_LAST);
std::map<uint16_t, std::string> mtype_list = g_game().getBestiaryList();
for (uint8_t i = BESTY_RACE_FIRST; i <= BESTY_RACE_LAST; i++) {

Check warning on line 2312 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
std::string BestClass = "";
uint16_t count = 0;
for (const auto &rit : mtype_list) {
Expand Down Expand Up @@ -2372,7 +2372,7 @@
uint8_t currentLevel = g_iobestiary().getKillStatus(mtype, killCounter);

NetworkMessage newmsg;
newmsg.addByte(0xd7);

Check warning on line 2375 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newmsg.add<uint16_t>(raceId);
newmsg.addString(Class, "ProtocolGame::parseBestiarysendMonsterData - Class");

Expand All @@ -2391,7 +2391,7 @@
newmsg.addByte(mtype->info.bestiaryOccurrence);

std::vector<LootBlock> lootList = mtype->info.lootItems;
newmsg.addByte(lootList.size());

Check warning on line 2394 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (const LootBlock &loot : lootList) {
int8_t difficult = g_iobestiary().calculateDifficult(loot.chance);
bool shouldAddItem = false;
Expand All @@ -2417,10 +2417,10 @@

newmsg.add<uint16_t>(g_configManager().getBoolean(SHOW_LOOTS_IN_BESTIARY, __FUNCTION__) || shouldAddItem == true ? loot.id : 0);
newmsg.addByte(difficult);
newmsg.addByte(0); // 1 if special event - 0 if regular loot (?)

Check warning on line 2420 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (g_configManager().getBoolean(SHOW_LOOTS_IN_BESTIARY, __FUNCTION__) || shouldAddItem == true) {
newmsg.addString(loot.name, "ProtocolGame::parseBestiarysendMonsterData - loot.name");
newmsg.addByte(loot.countmax > 0 ? 0x1 : 0x0);

Check warning on line 2423 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

Expand All @@ -2430,11 +2430,11 @@
if (!mtype->info.isHostile) {
attackmode = 2;
} else if (mtype->info.targetDistance) {
attackmode = 1;

Check warning on line 2433 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

newmsg.addByte(attackmode);
newmsg.addByte(0x2);

Check warning on line 2437 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newmsg.add<uint32_t>(mtype->info.healthMax);
newmsg.add<uint32_t>(mtype->info.experience);
newmsg.add<uint16_t>(mtype->getBaseSpeed());
Expand All @@ -2445,7 +2445,7 @@
if (currentLevel > 2) {
std::map<uint8_t, int16_t> elements = g_iobestiary().getMonsterElements(mtype);

newmsg.addByte(elements.size());

Check warning on line 2448 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (auto it = std::begin(elements), end = std::end(elements); it != end; it++) {
newmsg.addByte(it->first);
newmsg.add<uint16_t>(it->second);
Expand All @@ -2458,11 +2458,11 @@
if (currentLevel > 3) {
charmRune_t mType_c = g_iobestiary().getCharmFromTarget(player, mtype);
if (mType_c != CHARM_NONE) {
newmsg.addByte(1);

Check warning on line 2461 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newmsg.addByte(mType_c);

Check warning on line 2462 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newmsg.add<uint32_t>(player->getLevel() * 100);
} else {
newmsg.addByte(0);

Check warning on line 2465 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newmsg.addByte(1);
}
}
Expand Down Expand Up @@ -2512,8 +2512,8 @@
}

NetworkMessage msg;
msg.addByte(0x2D);

Check warning on line 2515 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x00); // Bool value, with 'true' the player exceed packets for second.

Check warning on line 2516 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
const auto &teamFinder = g_game().getTeamFinderList();
msg.add<uint16_t>(teamFinder.size());
for (const auto &it : teamFinder) {
Expand All @@ -2527,7 +2527,7 @@
return;
}

uint8_t status = 0;

Check warning on line 2530 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
uint16_t membersSize = 0;
msg.add<uint32_t>(leader->getGUID());
msg.addString(leader->getName(), "ProtocolGame::sendTeamFinderList - leader->getName()");
Expand Down Expand Up @@ -2588,7 +2588,7 @@

NetworkMessage msg;
msg.addByte(0x2C);
msg.addByte(reset ? 1 : 0);

Check warning on line 2591 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (reset) {
g_game().removeTeamFinderListed(player->getGUID());
return;
Expand Down Expand Up @@ -2639,7 +2639,7 @@
msg.addString(leader->getName(), "ProtocolGame::sendLeaderTeamFinder - leader->getName()");
msg.add<uint16_t>(leader->getLevel());
msg.addByte(leader->getVocation()->getClientId());
msg.addByte(3);

Check warning on line 2642 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

for (auto memberPair : teamAssemble->membersMap) {
std::shared_ptr<Player> member = g_game().getPlayerByGUID(memberPair.first);
Expand Down Expand Up @@ -2861,8 +2861,8 @@

NetworkMessage msg;
msg.addByte(0xB9);
msg.addByte(isBoss ? 0x01 : 0x00);

Check warning on line 2864 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(trackerSet.size());

Check warning on line 2865 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (const auto &mtype : trackerSet) {
auto raceId = mtype->info.raceid;
const auto stages = g_ioBosstiary().getBossRaceKillStages(mtype->info.bosstiaryRace);
Expand All @@ -2887,9 +2887,9 @@
}

if (completed) {
msg.addByte(4);

Check warning on line 2890 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else {
msg.addByte(0);

Check warning on line 2892 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

Expand All @@ -2906,33 +2906,33 @@
removeRuneCost = (removeRuneCost * 75) / 100;
}
NetworkMessage msg;
msg.addByte(0xd8);

Check warning on line 2909 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(player->getCharmPoints());

const auto charmList = g_game().getCharmList();
msg.addByte(charmList.size());

Check warning on line 2913 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (const auto &c_type : charmList) {
msg.addByte(c_type->id);
msg.addString(c_type->name, "ProtocolGame::BestiarysendCharms - c_type->name");
msg.addString(c_type->description, "ProtocolGame::BestiarysendCharms - c_type->description");
msg.addByte(0); // Unknown

Check warning on line 2918 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint16_t>(c_type->points);
if (g_iobestiary().hasCharmUnlockedRuneBit(c_type, player->getUnlockedRunesBit())) {
msg.addByte(1);

Check warning on line 2921 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
uint16_t raceid = player->parseRacebyCharm(c_type->id, false, 0);
if (raceid > 0) {
msg.addByte(1);

Check warning on line 2924 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint16_t>(raceid);
msg.add<uint32_t>(removeRuneCost);
} else {
msg.addByte(0);
}
} else {
msg.addByte(0);

Check warning on line 2931 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0);

Check warning on line 2932 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}
msg.addByte(4); // Unknown

Check warning on line 2935 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

auto finishedMonstersSet = g_iobestiary().getBestiaryFinished(player);
for (charmRune_t charmRune : g_iobestiary().getCharmUsedRuneBitAll(player)) {
Expand Down Expand Up @@ -2985,7 +2985,7 @@
text = raceName;
}
NetworkMessage newmsg;
newmsg.addByte(0xd6);

Check warning on line 2988 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newmsg.addString(text, "ProtocolGame::parseBestiarysendCreatures - text");
newmsg.add<uint16_t>(race.size());
std::map<uint16_t, uint32_t> creaturesKilled = g_iobestiary().getBestiaryKillCountByMonsterIDs(player, race);
Expand All @@ -2994,8 +2994,8 @@
uint16_t raceid_ = it_.first;
newmsg.add<uint16_t>(raceid_);

uint8_t progress = 0;

Check warning on line 2997 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
uint8_t occurrence = 0;

Check warning on line 2998 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (const auto &_it : creaturesKilled) {
if (_it.first == raceid_) {
const auto tmpType = g_monsters().getMonsterType(it_.second);
Expand Down Expand Up @@ -3054,10 +3054,10 @@
}

void ProtocolGame::parsePreyAction(NetworkMessage &msg) {
int8_t index = -1;

Check warning on line 3057 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
uint8_t slot = msg.getByte();
uint8_t action = msg.getByte();
uint8_t option = 0;

Check warning on line 3060 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
uint16_t raceId = 0;
if (action == static_cast<uint8_t>(PreyAction_MonsterSelection)) {
index = msg.getByte();
Expand Down Expand Up @@ -3135,7 +3135,7 @@
player->sendMarketEnter(player->getLastDepotId());
g_game().playerBrowseMarket(player->getID(), itemId, tier);
} else {
g_game().playerBrowseMarket(player->getID(), browseId, 0);

Check warning on line 3138 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

Expand Down Expand Up @@ -3224,7 +3224,7 @@
}

NetworkMessage msg;
msg.addByte(0xAF);

Check warning on line 3227 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<int64_t>(rawExp);
msg.add<int64_t>(finalExp);
writeToOutputBuffer(msg);
Expand All @@ -3246,7 +3246,7 @@

Outfit_t newOutfit = outfit;
if (player->isWearingSupportOutfit()) {
player->setCurrentMount(0);

Check warning on line 3249 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
newOutfit.lookMount = 0;
}

Expand Down Expand Up @@ -3282,8 +3282,8 @@
const auto icons = creature->getIcons();
// client only supports 3 icons, otherwise it will crash
const auto count = icons.size() > 3 ? 3 : icons.size();
msg.addByte(count);

Check warning on line 3285 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (uint8_t i = 0; i < count; ++i) {

Check warning on line 3286 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

Check warning on line 3286 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

too-small-loop-variable

loop variable has narrower type 'uint8_t' than iteration's upper bound 'const size_type'
const auto icon = icons[i];
msg.addByte(icon.serialize());
msg.addByte(static_cast<uint8_t>(icon.category));
Expand All @@ -3297,7 +3297,7 @@
}

NetworkMessage msg;
msg.addByte(0x8B);

Check warning on line 3300 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(creature->getID());
// Type 14 for this
msg.addByte(14);
Expand All @@ -3319,7 +3319,7 @@
NetworkMessage msg;
msg.addByte(0xEF);
msg.addByte(time / 60);
msg.addByte(time % 60);

Check warning on line 3322 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
writeToOutputBuffer(msg);
}

Expand All @@ -3331,7 +3331,7 @@
NetworkMessage msg;
msg.addByte(0x92);
msg.add<uint32_t>(creature->getID());
msg.addByte(walkthrough ? 0x00 : 0x01);

Check warning on line 3334 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
writeToOutputBuffer(msg);
}

Expand All @@ -3341,9 +3341,9 @@
}

NetworkMessage msg;
msg.addByte(0x91);

Check warning on line 3344 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(creature->getID());
msg.addByte(player->getPartyShield(creature->getPlayer()));

Check warning on line 3346 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
writeToOutputBuffer(msg);
}

Expand All @@ -3362,7 +3362,7 @@
int32_t stackpos = tile->getClientIndexOfCreature(player, creature);
sendRemoveTileThing(pos, stackpos);
NetworkMessage msg;
msg.addByte(0x6A);

Check warning on line 3365 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addPosition(pos);
msg.addByte(static_cast<uint8_t>(stackpos));
AddCreature(msg, creature, false, creature->getID());
Expand Down Expand Up @@ -3411,16 +3411,16 @@
}

NetworkMessage msg;
msg.addByte(0x93);

Check warning on line 3414 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(creature->getID());
msg.addByte(0x01);

Check warning on line 3416 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(color);
writeToOutputBuffer(msg);
}

void ProtocolGame::sendTutorial(uint8_t tutorialId) {
NetworkMessage msg;
msg.addByte(0xDC);

Check warning on line 3423 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(tutorialId);
writeToOutputBuffer(msg);
}
Expand Down Expand Up @@ -3457,8 +3457,8 @@
}

NetworkMessage msg;
msg.addByte(0xDA);

Check warning on line 3460 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(CYCLOPEDIA_CHARACTERINFO_BASEINFORMATION);

Check warning on line 3461 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x00);
msg.addString(player->getName(), "ProtocolGame::sendCyclopediaCharacterBaseInformation - player->getName()");
msg.addString(player->getVocation()->getVocName(), "ProtocolGame::sendCyclopediaCharacterBaseInformation - player->getVocation()->getVocName()");
Expand All @@ -3476,13 +3476,13 @@
}

NetworkMessage msg;
msg.addByte(0xDA);

Check warning on line 3479 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(CYCLOPEDIA_CHARACTERINFO_GENERALSTATS);

Check warning on line 3480 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
// Send no error
// 1: No data available at the moment.
// 2: You are not allowed to see this character's data.
// 3: You are not allowed to inspect this character.
msg.addByte(0x00); // 0x00 Here means 'no error'

Check warning on line 3485 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

msg.add<uint64_t>(player->getExperience());
msg.add<uint16_t>(player->getLevel());
Expand All @@ -3509,14 +3509,14 @@
msg.add<uint32_t>(player->getBaseCapacity());
msg.add<uint32_t>(player->hasFlag(PlayerFlags_t::HasInfiniteCapacity) ? 1000000 : player->getFreeCapacity());
msg.addByte(8);
msg.addByte(1);

Check warning on line 3512 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint16_t>(player->getMagicLevel());
msg.add<uint16_t>(player->getBaseMagicLevel());
msg.add<uint16_t>(player->getLoyaltyMagicLevel());
msg.add<uint16_t>(player->getMagicLevelPercent() * 100);

for (uint8_t i = SKILL_FIRST; i < SKILL_CRITICAL_HIT_CHANCE; ++i) {

Check warning on line 3518 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
static const uint8_t HardcodedSkillIds[] = { 11, 9, 8, 10, 7, 6, 13 };

Check warning on line 3519 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

Check warning on line 3519 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

Check warning on line 3519 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

Check warning on line 3519 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
const auto skill = static_cast<skills_t>(i);
msg.addByte(HardcodedSkillIds[i]);
msg.add<uint16_t>(std::min<int32_t>(player->getSkillLevel(skill), std::numeric_limits<uint16_t>::max()));
Expand All @@ -3532,7 +3532,7 @@
auto specializedMagicLevel = player->getSpecializedMagicLevel(indexToCombatType(i));
if (specializedMagicLevel > 0) {
++total;
msg.addByte(getCipbiaElement(indexToCombatType(i)));

Check warning on line 3535 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint16_t>(specializedMagicLevel);
}
}
Expand All @@ -3547,10 +3547,10 @@
}

NetworkMessage msg;
msg.addByte(0xDA);

Check warning on line 3550 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(CYCLOPEDIA_CHARACTERINFO_COMBATSTATS);
msg.addByte(0x00);
for (uint8_t i = SKILL_CRITICAL_HIT_CHANCE; i <= SKILL_LAST; ++i) {

Check warning on line 3553 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (i == SKILL_LIFE_LEECH_CHANCE || i == SKILL_MANA_LEECH_CHANCE) {
continue;
}
Expand All @@ -3569,14 +3569,14 @@
msg.add<uint16_t>(static_cast<uint16_t>(player->getMagicShieldCapacityPercent())); // Percentage bonus

// Perfect shot range (12.70)
for (uint8_t range = 1; range <= 5; range++) {

Check warning on line 3572 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint16_t>(static_cast<uint16_t>(player->getPerfectShotDamage(range)));
}

// Damage reflection (12.70)
msg.add<uint16_t>(static_cast<uint16_t>(player->getReflectFlat(COMBAT_PHYSICALDAMAGE)));

uint8_t haveBlesses = 0;

Check warning on line 3579 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (auto bless : magic_enum::enum_values<Blessings>()) {
if (player->hasBlessing(enumToValue(bless))) {
++haveBlesses;
Expand All @@ -3592,7 +3592,7 @@
if (it.weaponType == WEAPON_WAND) {
msg.add<uint16_t>(it.maxHitChance);
msg.addByte(getCipbiaElement(it.combatType));
msg.addByte(0);

Check warning on line 3595 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0);
} else if (it.weaponType == WEAPON_DISTANCE || it.weaponType == WEAPON_AMMO || it.weaponType == WEAPON_MISSILE) {
int32_t attackValue = weapon->getAttack();
Expand All @@ -3613,11 +3613,11 @@
msg.addByte(CIPBIA_ELEMENTAL_PHYSICAL);
if (it.abilities && it.abilities->elementType != COMBAT_NONE) {
if (attackValue) {
msg.addByte(static_cast<uint32_t>(it.abilities->elementDamage) * 100 / attackValue);

Check warning on line 3616 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else {
msg.addByte(0);

Check warning on line 3618 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
msg.addByte(getCipbiaElement(it.abilities->elementType));

Check warning on line 3620 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else {
handleImbuementDamage(msg, player);
}
Expand All @@ -3637,7 +3637,7 @@
} else {
msg.addByte(0);
}
msg.addByte(getCipbiaElement(it.abilities->elementType));

Check warning on line 3640 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else {
handleImbuementDamage(msg, player);
}
Expand All @@ -3649,9 +3649,9 @@

int32_t maxDamage = Weapons::getMaxWeaponDamage(player->getLevel(), attackSkill, attackValue, attackFactor, true);
msg.add<uint16_t>(maxDamage >> 1);
msg.addByte(CIPBIA_ELEMENTAL_PHYSICAL);

Check warning on line 3652 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0);
msg.addByte(0);

Check warning on line 3654 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

msg.add<uint16_t>(player->getArmor());
Expand All @@ -3664,7 +3664,7 @@
}

// Store the "combats" to increase in absorb values function and send to client later
uint8_t combats = 0;

Check warning on line 3667 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
auto startCombats = msg.getBufferPosition();
msg.skipBytes(1);

Expand All @@ -3681,7 +3681,7 @@
auto startConcoctions = msg.getBufferPosition();
msg.skipBytes(1);
auto activeConcoctions = player->getActiveConcoctions();
uint8_t concoctions = 0;

Check warning on line 3684 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (const auto &concoction : activeConcoctions) {
if (concoction.second == 0) {
continue;
Expand All @@ -3703,7 +3703,7 @@
}

NetworkMessage msg;
msg.addByte(0xDA);

Check warning on line 3706 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(CYCLOPEDIA_CHARACTERINFO_RECENTDEATHS);
msg.addByte(0x00); // 0x00 Here means 'no error'
msg.add<uint16_t>(page);
Expand All @@ -3724,8 +3724,8 @@

NetworkMessage msg;
msg.addByte(0xDA);
msg.addByte(CYCLOPEDIA_CHARACTERINFO_RECENTPVPKILLS);

Check warning on line 3727 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x00); // 0x00 Here means 'no error'

Check warning on line 3728 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint16_t>(page);
msg.add<uint16_t>(pages);
msg.add<uint16_t>(entries.size());
Expand All @@ -3744,9 +3744,9 @@
}

NetworkMessage msg;
msg.addByte(0xDA);

Check warning on line 3747 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(CYCLOPEDIA_CHARACTERINFO_ACHIEVEMENTS);

Check warning on line 3748 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x00); // 0x00 Here means 'no error'

Check warning on line 3749 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint16_t>(player->achiev()->getPoints());
msg.add<uint16_t>(secretsUnlocked);
msg.add<uint16_t>(static_cast<uint16_t>(achievementsUnlocked.size()));
Expand All @@ -3773,7 +3773,7 @@
}

NetworkMessage msg;
msg.addByte(0xDA);

Check warning on line 3776 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(CYCLOPEDIA_CHARACTERINFO_ITEMSUMMARY);
msg.addByte(0x00); // 0x00 Here means 'no error'

Expand Down Expand Up @@ -3886,8 +3886,8 @@

NetworkMessage msg;
msg.addByte(0xDA);
msg.addByte(CYCLOPEDIA_CHARACTERINFO_OUTFITSMOUNTS);

Check warning on line 3889 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x00);

Check warning on line 3890 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
Outfit_t currentOutfit = player->getDefaultOutfit();

uint16_t outfitSize = 0;
Expand All @@ -3911,7 +3911,7 @@
} else if (from == "quest") {
msg.addByte(CYCLOPEDIA_CHARACTERINFO_OUTFITTYPE_QUEST);
} else {
msg.addByte(CYCLOPEDIA_CHARACTERINFO_OUTFITTYPE_NONE);

Check warning on line 3914 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
if (outfit->lookType == currentOutfit.lookType) {
msg.add<uint32_t>(1000);
Expand Down Expand Up @@ -3941,7 +3941,7 @@
} else if (type == "quest") {
msg.addByte(CYCLOPEDIA_CHARACTERINFO_OUTFITTYPE_QUEST);
} else {
msg.addByte(CYCLOPEDIA_CHARACTERINFO_OUTFITTYPE_NONE);

Check warning on line 3944 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
msg.add<uint32_t>(1000);
}
Expand Down Expand Up @@ -4005,11 +4005,11 @@
if (player->hasBlessing(blessValue)) {
msg.addByte(static_cast<uint16_t>(player->blessings[blessValue - 1]));
} else {
msg.addByte(0x00);

Check warning on line 4008 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
}

uint8_t preySlotsUnlocked = 0;

Check warning on line 4012 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
// Prey third slot unlocked
if (const auto &slotP = player->getPreySlotById(PreySlot_Three);
slotP && slotP->state != PreyDataState_Locked) {
Expand All @@ -4022,8 +4022,8 @@
}
msg.addByte(preySlotsUnlocked); // getPreySlotById + getTaskHuntingSlotById

msg.addByte(cyclopediaSummary.m_preyWildcards); // getPreyCardsObtained

Check warning on line 4025 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(cyclopediaSummary.m_instantRewards); // getRewardCollectionObtained

Check warning on line 4026 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(player->hasCharmExpansion() ? 0x01 : 0x00);
msg.addByte(cyclopediaSummary.m_hirelings); // getHirelingsObtained

Expand All @@ -4036,7 +4036,7 @@
}
msg.addByte(m_hSkills.size());
for (const auto &id : m_hSkills) {
msg.addByte(id - 1000);

Check warning on line 4039 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

/*std::vector<uint16_t> m_hOutfits;
Expand Down Expand Up @@ -4153,7 +4153,7 @@
}

// Prey description
for (uint8_t slotId = PreySlot_First; slotId <= PreySlot_Last; slotId++) {

Check warning on line 4156 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (const auto &slot = player->getPreySlotById(static_cast<PreySlot_t>(slotId));
slot && slot->isOccupied()) {
playerDescriptionSize++;
Expand Down Expand Up @@ -4211,7 +4211,7 @@
msg.addByte(0xDA);
msg.addByte(CYCLOPEDIA_CHARACTERINFO_BADGES);
msg.addByte(0x00);
msg.addByte(0x01); // ShowAccountInformation, if 0x01 will show IsOnline, IsPremium, character title, badges

Check warning on line 4214 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

const auto loggedPlayer = g_game().getPlayerUniqueLogin(player->getName());
msg.addByte(loggedPlayer ? 0x01 : 0x00); // IsOnline
Expand Down Expand Up @@ -4245,7 +4245,7 @@

NetworkMessage msg;
msg.addByte(0xDA);
msg.addByte(CYCLOPEDIA_CHARACTERINFO_TITLES);

Check warning on line 4248 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x00); // 0x00 Here means 'no error'
msg.addByte(player->title()->getCurrentTitle());
msg.addByte(static_cast<uint8_t>(titles.size()));
Expand All @@ -4254,7 +4254,7 @@
std::string messageTitleDesc = "ProtocolGame::sendCyclopediaCharacterTitles - title.description";
for (const auto &title : titles) {
msg.addByte(title.m_id);
auto titleName = player->title()->getNameBySex(player->getSex(), title.m_maleName, title.m_femaleName);

Check warning on line 4257 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

static-accessed-through-instance

static member accessed through instance
msg.addString(titleName, messageTitleName);
msg.addString(title.m_description, messageTitleDesc);
msg.addByte(title.m_permanent ? 0x01 : 0x00);
Expand All @@ -4268,10 +4268,10 @@
void ProtocolGame::sendReLoginWindow(uint8_t unfairFightReduction) {
NetworkMessage msg;
msg.addByte(0x28);
msg.addByte(0x00);

Check warning on line 4271 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(unfairFightReduction);
if (!oldProtocol) {
msg.addByte(0x00); // use death redemption (boolean)

Check warning on line 4274 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
writeToOutputBuffer(msg);
}
Expand All @@ -4293,16 +4293,16 @@
msg.addByte(1);
msg.add<uint32_t>(getTimeNow() + ((player->getPremiumDays() + 1) * 86400));
} else {
msg.addByte(0);

Check warning on line 4296 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(0);
}
msg.addByte(player->getVocation()->getClientId());

// Prey window
if (player->getVocation()->getId() == 0 && player->getGroup()->id < GROUP_TYPE_GAMEMASTER) {
msg.addByte(0);

Check warning on line 4303 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else {
msg.addByte(1); // has reached Main (allow player to open Prey window)

Check warning on line 4305 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

// Filter only valid ids
Expand Down Expand Up @@ -4345,7 +4345,7 @@
}

if (!oldProtocol) {
msg.addByte(player->getVocation()->getMagicShield()); // bool - determine whether magic shield is active or not

Check warning on line 4348 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

writeToOutputBuffer(msg);
Expand All @@ -4359,7 +4359,7 @@
NetworkMessage msg;
// uint8_t maxClientBlessings = (player->operatingSystem == CLIENTOS_NEW_WINDOWS) ? 8 : 6; (compartability for the client 10)
// Ignore ToF (bless 1)
uint8_t blessCount = 0;

Check warning on line 4362 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
uint16_t flag = 0;
uint16_t pow2 = 2;
for (int i = 1; i <= 8; i++) {
Expand All @@ -4372,7 +4372,7 @@
}
}

msg.addByte(0x9C);

Check warning on line 4375 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (oldProtocol) {
msg.add<uint16_t>(blessCount >= 5 ? 0x01 : 0x00);
} else {
Expand All @@ -4388,7 +4388,7 @@
if (!g_configManager().getBoolean(FREE_PREMIUM, __FUNCTION__) && !g_configManager().getBoolean(VIP_SYSTEM_ENABLED, __FUNCTION__)) {
NetworkMessage msg;
msg.addByte(0x9E);
msg.addByte(16);

Check warning on line 4391 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (uint16_t i = 0; i <= 15; i++) {
// PREMIUM_TRIGGER_TRAIN_OFFLINE = false, PREMIUM_TRIGGER_XP_BOOST = false, PREMIUM_TRIGGER_MARKET = false, PREMIUM_TRIGGER_VIP_LIST = false, PREMIUM_TRIGGER_DEPOT_SPACE = false, PREMIUM_TRIGGER_INVITE_PRIVCHAT = false
msg.addByte(0x01);
Expand Down Expand Up @@ -4492,7 +4492,7 @@
} else {
msg.add<uint32_t>(message.primary.value);
}
msg.addByte(message.primary.color);

Check warning on line 4495 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
break;
}
case MESSAGE_GUILD:
Expand All @@ -4509,7 +4509,7 @@

void ProtocolGame::sendClosePrivate(uint16_t channelId) {
NetworkMessage msg;
msg.addByte(0xB3);

Check warning on line 4512 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint16_t>(channelId);
writeToOutputBuffer(msg);
}
Expand All @@ -4527,10 +4527,10 @@

void ProtocolGame::sendChannelsDialog() {
NetworkMessage msg;
msg.addByte(0xAB);

Check warning on line 4530 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

const ChannelList &list = g_chat().getChannelList(player);
msg.addByte(list.size());

Check warning on line 4533 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (const auto &channel : list) {
msg.add<uint16_t>(channel->getId());
msg.addString(channel->getName(), "ProtocolGame::sendChannelsDialog - channel->getName()");
Expand Down Expand Up @@ -4603,7 +4603,7 @@

void ProtocolGame::sendIconBakragore(const IconBakragore icon) {
NetworkMessage msg;
msg.addByte(0xA2);

Check warning on line 4606 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(0); // Send empty normal icons
msg.addByte(enumToValue(icon));
writeToOutputBuffer(msg);
Expand Down Expand Up @@ -4644,14 +4644,14 @@

msg.addByte(container->capacity());

msg.addByte(hasParent ? 0x01 : 0x00);

Check warning on line 4647 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

// Depot search
if (!oldProtocol) {
msg.addByte((player->isDepotSearchAvailable() && container->isInsideDepot(true)) ? 0x01 : 0x00);
}

msg.addByte(container->isUnlocked() ? 0x01 : 0x00); // Drag and drop

Check warning on line 4654 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(container->hasPagination() ? 0x01 : 0x00); // Pagination

uint32_t containerSize = container->size();
Expand All @@ -4673,7 +4673,7 @@
if (firstIndex >= containerSize) {
msg.addByte(0x00);
} else if (container->getID() == ITEM_STORE_INBOX && !itemsStoreInboxToSend.empty()) {
msg.addByte(std::min<uint32_t>(maxItemsToSend, containerSize));

Check warning on line 4676 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (const auto &item : itemsStoreInboxToSend) {
AddItem(msg, item);
}
Expand Down Expand Up @@ -4717,19 +4717,19 @@
sendContainerCategory<ContainerCategory_t>(msg, categories);
}
} else {
msg.addByte(0x00);

Check warning on line 4720 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x00);

Check warning on line 4721 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

// New container menu options
if (container->isMovable()) { // Pickupable/Moveable (?)
msg.addByte(1);

Check warning on line 4726 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else {
msg.addByte(0);
}

if (container->getHoldingPlayer()) { // Player holding the item (?)
msg.addByte(1);

Check warning on line 4732 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else {
msg.addByte(0);
}
Expand All @@ -4744,7 +4744,7 @@

NetworkMessage msg;
msg.addByte(0xC0);
msg.addByte(player->quickLootFallbackToMainContainer ? 1 : 0);

Check warning on line 4747 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

std::map<ObjectCategory_t, std::pair<std::shared_ptr<Container>, std::shared_ptr<Container>>> managedContainersMap;
for (auto [category, containersPair] : player->m_managedContainers) {
Expand Down Expand Up @@ -4844,7 +4844,7 @@

void ProtocolGame::sendCloseShop() {
NetworkMessage msg;
msg.addByte(0x7C);

Check warning on line 4847 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
writeToOutputBuffer(msg);
}

Expand All @@ -4854,7 +4854,7 @@
}

NetworkMessage msg;
msg.addByte(0x63);

Check warning on line 4857 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(1);
msg.addByte(1);
writeToOutputBuffer(msg);
Expand All @@ -4868,7 +4868,7 @@
NetworkMessage msg;
msg.addByte(0x98);
msg.add<uint32_t>(1); // unknown
msg.addByte(1); //(0 = open | 1 = highlight)

Check warning on line 4871 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
writeToOutputBuffer(msg);
}

Expand All @@ -4894,7 +4894,7 @@
writeToOutputBuffer(msg);
}

void ProtocolGame::sendSaleItemList(const std::vector<ShopBlock> &shopVector, const std::map<uint16_t, uint16_t> &inventoryMap) {

Check warning on line 4897 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

function-cognitive-complexity

function 'sendSaleItemList' has cognitive complexity of 30 (threshold 25)
sendResourceBalance(RESOURCE_BANK, player->getBankBalance());

uint16_t currency = player->getShopOwner() ? player->getShopOwner()->getCurrency() : static_cast<uint16_t>(ITEM_GOLD_COIN);
Expand Down Expand Up @@ -5015,14 +5015,14 @@
// send is updating
// TODO: export this to it own function
NetworkMessage msg;
msg.addByte(0xF2);

Check warning on line 5018 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x01);
writeToOutputBuffer(msg);

msg.reset();

// send update
msg.addByte(0xDF);

Check warning on line 5025 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0x01);

msg.add<uint32_t>(player->coinBalance); // Normal Coins
Expand Down Expand Up @@ -5065,7 +5065,7 @@
void ProtocolGame::sendMarketBrowseItem(uint16_t itemId, const MarketOfferList &buyOffers, const MarketOfferList &sellOffers, uint8_t tier) {
NetworkMessage msg;

msg.addByte(0xF9);

Check warning on line 5068 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (!oldProtocol) {
msg.addByte(MARKETREQUEST_ITEM_BROWSE);
}
Expand Down Expand Up @@ -5109,7 +5109,7 @@
NetworkMessage msg;
msg.addByte(0xF9);
if (!oldProtocol) {
msg.addByte(MARKETREQUEST_ITEM_BROWSE);

Check warning on line 5112 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

msg.add<uint16_t>(offer.itemId);
Expand Down Expand Up @@ -5148,7 +5148,7 @@

void ProtocolGame::sendMarketBrowseOwnOffers(const MarketOfferList &buyOffers, const MarketOfferList &sellOffers) {
NetworkMessage msg;
msg.addByte(0xF9);

Check warning on line 5151 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (oldProtocol) {
msg.add<uint16_t>(MARKETREQUEST_OWN_OFFERS_OLD);
} else {
Expand Down Expand Up @@ -5196,7 +5196,7 @@
if (oldProtocol) {
msg.add<uint16_t>(MARKETREQUEST_OWN_OFFERS_OLD);
} else {
msg.addByte(MARKETREQUEST_OWN_OFFERS);

Check warning on line 5199 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (offer.type == MARKETACTION_BUY) {
Expand Down Expand Up @@ -5323,7 +5323,7 @@
// Convergence fusion prices per tier
msg.addByte(static_cast<uint8_t>(convergenceFusionPrices.size()));
for (const auto &[tier, price] : convergenceFusionPrices) {
msg.addByte(tier - 1);

Check warning on line 5326 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint64_t>(price);
}

Expand All @@ -5341,7 +5341,7 @@
// (conversion) (middle column top) Cost to make 1 - 50
msg.addByte(static_cast<uint8_t>(g_configManager().getNumber(FORGE_CORE_COST, __FUNCTION__)));
// (conversion) (right column top) Current stored dust limit minus this number = cost to increase stored dust limit - 75
msg.addByte(75);

Check warning on line 5344 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
// (conversion) (right column bottom) Starting stored dust limit
msg.add<uint16_t>(player->getForgeDustLevel());
// (conversion) (right column bottom) Max stored dust limit - 325
Expand All @@ -5367,10 +5367,11 @@
writeToOutputBuffer(msg);
}

void ProtocolGame::sendOpenForge() {

Check warning on line 5370 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

function-cognitive-complexity

function 'sendOpenForge' has cognitive complexity of 119 (threshold 25)
// We will use it when sending the bytes to send the item information to the client
std::map<uint16_t, std::map<uint8_t, uint16_t>> fusionItemsMap;
std::map<int32_t, std::map<uint16_t, std::map<uint8_t, uint16_t>>> convergenceItemsMap;
std::map<int32_t, std::map<uint16_t, std::map<uint8_t, uint16_t>>> convergenceFusionItemsMap;
std::map<int32_t, std::map<uint16_t, std::map<uint8_t, uint16_t>>> convergenceTransferItemsMap;
std::map<uint16_t, std::map<uint8_t, uint16_t>> donorTierItemMap;
std::map<uint16_t, std::map<uint8_t, uint16_t>> receiveTierItemMap;

Expand Down Expand Up @@ -5405,15 +5406,20 @@
getForgeInfoMap(item, receiveTierItemMap);
}
if (itemClassification == 4) {
getForgeInfoMap(item, convergenceItemsMap[item->getClassification()]);
auto slotPosition = item->getSlotPosition();
if ((slotPosition & SLOTP_TWO_HAND) != 0) {
slotPosition = SLOTP_HAND;
}
getForgeInfoMap(item, convergenceFusionItemsMap[slotPosition]);
getForgeInfoMap(item, convergenceTransferItemsMap[item->getClassification()]);
}
}
}

// Checking size of map to send in the addByte (total fusion items count)
uint8_t fusionTotalItemsCount = 0;

Check warning on line 5420 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
for (const auto &[itemId, tierAndCountMap] : fusionItemsMap) {
for (const auto [itemTier, itemCount] : tierAndCountMap) {
for (const auto &[itemTier, itemCount] : tierAndCountMap) {
if (itemCount >= 2) {
fusionTotalItemsCount++;
}
Expand All @@ -5426,11 +5432,11 @@
NetworkMessage msg;

// Header byte (135)
msg.addByte(0x87);

Check warning on line 5435 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

msg.add<uint16_t>(fusionTotalItemsCount);
for (const auto &[itemId, tierAndCountMap] : fusionItemsMap) {
for (const auto [itemTier, itemCount] : tierAndCountMap) {
for (const auto &[itemTier, itemCount] : tierAndCountMap) {
if (itemCount >= 2) {
msg.addByte(0x01); // Number of friend items?
msg.add<uint16_t>(itemId);
Expand All @@ -5452,12 +5458,12 @@
1 byte: tier
2 bytes: count
*/
for (const auto &[slot, itemMap] : convergenceItemsMap) {
for (const auto &[slot, itemMap] : convergenceFusionItemsMap) {
uint8_t totalItemsCount = 0;
auto totalItemsCountPosition = msg.getBufferPosition();
msg.skipBytes(1); // Total items count
for (const auto &[itemId, tierAndCountMap] : itemMap) {
for (const auto [tier, itemCount] : tierAndCountMap) {
for (const auto &[tier, itemCount] : tierAndCountMap) {
if (tier >= maxConfigTier) {
continue;
}
Expand Down Expand Up @@ -5488,11 +5494,15 @@
// Let's access the itemType to check the item's (donator of tier) classification level
// Must be the same as the item that will receive the tier
const ItemType &donorType = Item::items[itemId];
auto donorSlotPosition = donorType.slotPosition;
if ((donorSlotPosition & SLOTP_TWO_HAND) != 0) {

Check warning on line 5498 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-4-5-2

MISRA 4-5-2: Expressions with type enum shall not be used as operands to built-in operators other than the subscript operator [ ], the assignment operator =, the equality operators == and !=, the unary & operator, and the relational operators <, <=, >, >=
donorSlotPosition = SLOTP_HAND;

Check warning on line 5499 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-6

MISRA 5-0-6: An implicit integral or floating-point conversion shall not reduce the size of the underlying type
}

// Total count of item (donator of tier)
auto donorTierTotalItemsCount = getIterationIncreaseCount(tierAndCountMap);
msg.add<uint16_t>(donorTierTotalItemsCount);
for (const auto [donorItemTier, donorItemCount] : tierAndCountMap) {
for (const auto &[donorItemTier, donorItemCount] : tierAndCountMap) {
msg.add<uint16_t>(itemId);
msg.addByte(donorItemTier);
msg.add<uint16_t>(donorItemCount);
Expand All @@ -5502,7 +5512,11 @@
for (const auto &[iteratorItemId, unusedTierAndCountMap] : receiveTierItemMap) {
// Let's access the itemType to check the item's (receiver of tier) classification level
const ItemType &receiveType = Item::items[iteratorItemId];
if (donorType.upgradeClassification == receiveType.upgradeClassification) {
auto receiveSlotPosition = receiveType.slotPosition;
if ((receiveSlotPosition & SLOTP_TWO_HAND) != 0) {

Check warning on line 5516 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-4-5-2

MISRA 4-5-2: Expressions with type enum shall not be used as operands to built-in operators other than the subscript operator [ ], the assignment operator =, the equality operators == and !=, the unary & operator, and the relational operators <, <=, >, >=
receiveSlotPosition = SLOTP_HAND;

Check warning on line 5517 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-6

MISRA 5-0-6: An implicit integral or floating-point conversion shall not reduce the size of the underlying type
}
if (donorType.upgradeClassification == receiveType.upgradeClassification && donorSlotPosition == receiveSlotPosition) {
receiveTierTotalItemCount++;
}
}
Expand All @@ -5513,8 +5527,12 @@
for (const auto &[receiveItemId, receiveTierAndCountMap] : receiveTierItemMap) {
// Let's access the itemType to check the item's (receiver of tier) classification level
const ItemType &receiveType = Item::items[receiveItemId];
if (donorType.upgradeClassification == receiveType.upgradeClassification) {
for (const auto [receiveItemTier, receiveItemCount] : receiveTierAndCountMap) {
auto receiveSlotPosition = receiveType.slotPosition;
if ((receiveSlotPosition & SLOTP_TWO_HAND) != 0) {

Check warning on line 5531 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-4-5-2

MISRA 4-5-2: Expressions with type enum shall not be used as operands to built-in operators other than the subscript operator [ ], the assignment operator =, the equality operators == and !=, the unary & operator, and the relational operators <, <=, >, >=
receiveSlotPosition = SLOTP_HAND;
}
if (donorType.upgradeClassification == receiveType.upgradeClassification && donorSlotPosition == receiveSlotPosition) {
for (const auto &[receiveItemTier, receiveItemCount] : receiveTierAndCountMap) {
msg.add<uint16_t>(receiveItemId);
msg.add<uint16_t>(receiveItemCount);
}
Expand All @@ -5540,7 +5558,7 @@
2 bytes: item id
2 bytes: count
*/
for (const auto &[slot, itemMap] : convergenceItemsMap) {
for (const auto &[slot, itemMap] : convergenceTransferItemsMap) {
uint16_t donorCount = 0;
uint16_t receiverCount = 0;
auto donorCountPosition = msg.getBufferPosition();
Expand Down Expand Up @@ -5619,7 +5637,7 @@

void ProtocolGame::sendForgeResult(ForgeAction_t actionType, uint16_t leftItemId, uint8_t leftTier, uint16_t rightItemId, uint8_t rightTier, bool success, uint8_t bonus, uint8_t coreCount, bool convergence) {
NetworkMessage msg;
msg.addByte(0x8A);

Check warning on line 5640 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

// 0 = fusion | 1 = transfer
msg.addByte(static_cast<uint8_t>(actionType));
Expand Down Expand Up @@ -5833,7 +5851,7 @@
std::ostringstream ss;
bool separator = false;

for (uint8_t i = SKILL_FIRST; i <= SKILL_FISHING; i++) {

Check warning on line 5854 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (!it.abilities->skills[i]) {
continue;
}
Expand Down Expand Up @@ -5873,7 +5891,7 @@
}

// Version 12.72 (Specialized magic level modifier)
for (uint8_t i = 1; i <= 11; i++) {

Check warning on line 5894 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (it.abilities->specializedMagicLevel[i]) {
if (separator) {
ss << ", ";
Expand Down Expand Up @@ -5906,7 +5924,7 @@

std::string weaponName = getWeaponName(it.weaponType);

if (it.slotPosition & SLOTP_TWO_HAND) {

Check warning on line 5927 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-4-5-2

MISRA 4-5-2: Expressions with type enum shall not be used as operands to built-in operators other than the subscript operator [ ], the assignment operator =, the equality operators == and !=, the unary & operator, and the relational operators <, <=, >, >=
if (!weaponName.empty()) {
weaponName += ", two-handed";
} else {
Expand Down Expand Up @@ -6040,7 +6058,7 @@
msg.add<uint64_t>(purchaseStatistics.lowestPrice);
}
} else {
msg.addByte(0x00);

Check warning on line 6061 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
} else {
msg.addByte(0x00); // send to old protocol ?
Expand Down Expand Up @@ -6164,7 +6182,7 @@
if (oldProtocol && type >= TALKTYPE_MONSTER_LAST_OLDPROTOCOL && type != TALKTYPE_CHANNEL_R2) {
msg.addByte(TALKTYPE_MONSTER_SAY);
} else {
msg.addByte(type);

Check warning on line 6185 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

if (pos) {
Expand All @@ -6186,12 +6204,12 @@
if (!creature) {
msg.add<uint32_t>(0x00);
if (!oldProtocol && statementId != 0) {
msg.addByte(0x00); // Show (Traded)

Check warning on line 6207 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
} else if (type == TALKTYPE_CHANNEL_R2) {
msg.add<uint32_t>(0x00);
if (!oldProtocol && statementId != 0) {
msg.addByte(0x00); // Show (Traded)

Check warning on line 6212 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
type = TALKTYPE_CHANNEL_R1;
} else {
Expand Down Expand Up @@ -6281,7 +6299,7 @@
void ProtocolGame::sendPing() {
if (player) {
NetworkMessage msg;
msg.addByte(0x1D);

Check warning on line 6302 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
writeToOutputBuffer(msg);
}
}
Expand Down Expand Up @@ -6329,7 +6347,7 @@
dailyStreak = static_cast<uint8_t>(dailyRewardKV->getNumber());
}

msg.addByte(dailyStreak < 2 ? 0 : 1);

Check warning on line 6350 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
if (dailyStreak < 2) {
msg.addString("Resting Area (no active bonus)", "ProtocolGame::sendRestingStatus - Resting Area (no active bonus)");
} else {
Expand Down Expand Up @@ -6384,7 +6402,7 @@
return;
}
NetworkMessage msg;
msg.addByte(0x84);

Check warning on line 6405 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addPosition(pos);
if (oldProtocol) {
msg.addByte(static_cast<uint8_t>(type));
Expand Down Expand Up @@ -6437,7 +6455,7 @@
}

NetworkMessage msg;
msg.addByte(0x91);

Check warning on line 6458 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(cid);
msg.addByte(player->getPartyShield(target->getPlayer()));
writeToOutputBuffer(msg);
Expand All @@ -6457,7 +6475,7 @@
NetworkMessage msg;
msg.addByte(0x90);
msg.add<uint32_t>(cid);
msg.addByte(player->getSkullClient(target));

Check warning on line 6478 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
writeToOutputBuffer(msg);
}

Expand Down Expand Up @@ -6488,7 +6506,7 @@
NetworkMessage msg;
msg.addByte(0x8B);
msg.add<uint32_t>(cid);
msg.addByte(11); // mana percent

Check warning on line 6509 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(std::min<uint8_t>(100, manaPercent));
writeToOutputBuffer(msg);
}
Expand All @@ -6506,7 +6524,7 @@
NetworkMessage msg;
msg.addByte(0x8B);
msg.add<uint32_t>(cid);
msg.addByte(12); // show status

Check warning on line 6527 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte((showStatus ? 0x01 : 0x00));
writeToOutputBuffer(msg);
}
Expand All @@ -6529,7 +6547,7 @@
NetworkMessage msg;
msg.addByte(0x8B);
msg.add<uint32_t>(cid);
msg.addByte(13); // vocation

Check warning on line 6550 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(target->getVocation()->getClientId());
writeToOutputBuffer(msg);
}
Expand All @@ -6540,7 +6558,7 @@
}

NetworkMessage msg;
msg.addByte(0x8B);

Check warning on line 6561 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(target->getID());
msg.addByte(13); // vocation
msg.addByte(target->getVocation()->getClientId());
Expand All @@ -6557,7 +6575,7 @@
// tile
void ProtocolGame::sendMapDescription(const Position &pos) {
NetworkMessage msg;
msg.addByte(0x64);

Check warning on line 6578 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addPosition(player->getPosition());
GetMapDescription(pos.x - MAP_MAX_CLIENT_VIEW_PORT_X, pos.y - MAP_MAX_CLIENT_VIEW_PORT_Y, pos.z, (MAP_MAX_CLIENT_VIEW_PORT_X + 1) * 2, (MAP_MAX_CLIENT_VIEW_PORT_Y + 1) * 2, msg);
writeToOutputBuffer(msg);
Expand Down Expand Up @@ -6622,7 +6640,7 @@
}

NetworkMessage msg;
msg.addByte(0x69);

Check warning on line 6643 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addPosition(pos);

if (tile) {
Expand Down Expand Up @@ -6655,8 +6673,8 @@

void ProtocolGame::sendFightModes() {
NetworkMessage msg;
msg.addByte(0xA7);

Check warning on line 6676 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(player->fightMode);

Check warning on line 6677 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(player->chaseMode);
msg.addByte(player->secureMode);
msg.addByte(PVP_MODE_DOVE);
Expand Down Expand Up @@ -6716,7 +6734,7 @@

msg.addDouble(Creature::speedA, 3);
msg.addDouble(Creature::speedB, 3);
msg.addDouble(Creature::speedC, 3);

Check warning on line 6737 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

// Allow bug report (Ctrl + Z)
if (oldProtocol) {
Expand All @@ -6734,7 +6752,7 @@
msg.add<uint16_t>(static_cast<uint16_t>(g_configManager().getNumber(STORE_COIN_PACKET, __FUNCTION__)));

if (!oldProtocol) {
msg.addByte(shouldAddExivaRestrictions ? 0x01 : 0x00); // exiva button enabled

Check warning on line 6755 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

writeToOutputBuffer(msg);
Expand Down Expand Up @@ -6856,7 +6874,7 @@
}

if (oldPos.y > newPos.y) { // north, for old x
msg.addByte(0x65);

Check warning on line 6877 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
GetMapDescription(oldPos.x - MAP_MAX_CLIENT_VIEW_PORT_X, newPos.y - MAP_MAX_CLIENT_VIEW_PORT_Y, newPos.z, (MAP_MAX_CLIENT_VIEW_PORT_X + 1) * 2, 1, msg);
} else if (oldPos.y < newPos.y) { // south, for old x
msg.addByte(0x67);
Expand Down Expand Up @@ -6894,7 +6912,7 @@
void ProtocolGame::sendInventoryItem(Slots_t slot, std::shared_ptr<Item> item) {
NetworkMessage msg;
if (item) {
msg.addByte(0x78);

Check warning on line 6915 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(slot);
AddItem(msg, item);
} else {
Expand Down Expand Up @@ -6966,7 +6984,7 @@

void ProtocolGame::sendTextWindow(uint32_t windowTextId, std::shared_ptr<Item> item, uint16_t maxlen, bool canWrite) {
NetworkMessage msg;
msg.addByte(0x96);

Check warning on line 6987 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(windowTextId);
AddItem(msg, item);

Expand Down Expand Up @@ -7134,7 +7152,7 @@
msg.add<uint16_t>(outfit->lookType);
msg.addString(outfit->name, "ProtocolGame::sendOutfitWindow - outfit->name");
msg.addByte(3);
msg.addByte(0x02);

Check warning on line 7155 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
++outfitSize;
}
} else if (outfit->lookType == 1456 || outfit->lookType == 1457) {
Expand Down Expand Up @@ -7179,7 +7197,7 @@
} else if (mount->type == "store") {
msg.add<uint16_t>(mount->clientId);
msg.addString(mount->name, "ProtocolGame::sendOutfitWindow - mount->name");
msg.addByte(0x01);

Check warning on line 7200 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(0x00);
++mountSize;
}
Expand Down Expand Up @@ -7440,7 +7458,7 @@
}

NetworkMessage msg;
msg.addByte(0xE8);

Check warning on line 7461 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
std::vector<uint16_t> validRaceIds;
for (auto raceId : slot->raceIdList) {
if (g_monsters().getMonsterTypeByRaceId(raceId)) {
Expand Down Expand Up @@ -7645,7 +7663,7 @@
if (creature->isHealthHidden()) {
msg.addByte(0x00);
} else {
msg.addByte(std::ceil((static_cast<double>(creature->getHealth()) / std::max<int32_t>(creature->getMaxHealth(), 1)) * 100));

Check warning on line 7666 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}

msg.addByte(creature->getDirection());
Expand Down Expand Up @@ -7726,7 +7744,7 @@
}

void ProtocolGame::AddPlayerStats(NetworkMessage &msg) {
msg.addByte(0xA0);

Check warning on line 7747 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

if (oldProtocol) {
msg.add<uint16_t>(std::min<int32_t>(player->getHealth(), std::numeric_limits<uint16_t>::max()));
Expand Down Expand Up @@ -7796,7 +7814,7 @@
skills_t skill = static_cast<skills_t>(i);
msg.add<uint16_t>(std::min<int32_t>(player->getSkillLevel(skill), std::numeric_limits<uint16_t>::max()));
msg.add<uint16_t>(player->getBaseSkill(skill));
msg.addByte(std::min<uint8_t>(100, static_cast<uint8_t>(player->getSkillPercent(skill))));

Check warning on line 7817 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
}
} else {
msg.add<uint16_t>(player->getMagicLevel());
Expand Down Expand Up @@ -8093,10 +8111,10 @@
NetworkMessage msg;
msg.addByte(0xCC);
if (type == COMBAT_HEALING) {
msg.addByte(ANALYZER_HEAL);

Check warning on line 8114 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(amount);
} else {
msg.addByte(ANALYZER_DAMAGE_DEALT);

Check warning on line 8117 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(amount);
msg.addByte(clientElement);
}
Expand Down Expand Up @@ -8132,7 +8150,7 @@
msg.addByte(static_cast<uint8_t>(slot->id));
msg.addByte(static_cast<uint8_t>(slot->state));
if (slot->state == PreyTaskDataState_Locked) {
msg.addByte(player->isPremium() ? 0x01 : 0x00);

Check warning on line 8153 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
} else if (slot->state == PreyTaskDataState_Inactive) {
// Empty
} else if (slot->state == PreyTaskDataState_Selection) {
Expand Down Expand Up @@ -8263,7 +8281,7 @@
GetFloorDescription(msg, oldPos.x - MAP_MAX_CLIENT_VIEW_PORT_X, oldPos.y - MAP_MAX_CLIENT_VIEW_PORT_Y, newPos.z + MAP_LAYER_VIEW_LIMIT, (MAP_MAX_CLIENT_VIEW_PORT_X + 1) * 2, (MAP_MAX_CLIENT_VIEW_PORT_Y + 1) * 2, -3, skip);

if (skip >= 0) {
msg.addByte(skip);

Check warning on line 8284 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(0xFF);
}
}
Expand Down Expand Up @@ -8792,7 +8810,7 @@
sendBosstiaryData();

NetworkMessage msg;
msg.addByte(0x73);

Check warning on line 8813 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

auto mtype_map = g_ioBosstiary().getBosstiaryMap();
auto bossesBuffer = msg.getBufferPosition();
Expand Down Expand Up @@ -8864,7 +8882,7 @@
sendBosstiaryData();

NetworkMessage msg;
msg.addByte(0x62);

Check warning on line 8885 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values

uint32_t playerBossPoints = player->getBossPoints();
uint16_t currentBonus = g_ioBosstiary().calculateLootBonus(playerBossPoints);
Expand Down Expand Up @@ -9033,7 +9051,7 @@
auto lookLegs = podium->getCustomAttribute("LookLegs");
auto lookFeet = podium->getCustomAttribute("LookFeet");

msg.addByte(lookHead ? static_cast<uint8_t>(lookHead->getInteger()) : 0);

Check warning on line 9054 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.addByte(lookBody ? static_cast<uint8_t>(lookBody->getInteger()) : 0);
msg.addByte(lookLegs ? static_cast<uint8_t>(lookLegs->getInteger()) : 0);
msg.addByte(lookFeet ? static_cast<uint8_t>(lookFeet->getInteger()) : 0);
Expand Down Expand Up @@ -9230,7 +9248,7 @@
auto vocation = g_vocations().getVocation(player->getVocation()->getBaseId());
if (vocation) {
NetworkMessage msg;
msg.addByte(0x9D);

Check warning on line 9251 in src/server/network/protocol/protocolgame.cpp

View workflow job for this annotation

GitHub Actions / Qodana for C/C++

misra-cpp2008-5-0-11

MISRA 5-0-11: The plain char type shall only be used for the storage and use of character values
msg.add<uint32_t>(vocation->getClientId());
writeToOutputBuffer(msg);
}
Expand Down
Loading