Skip to content

Commit

Permalink
fix: packet interpretation parseSetOutfit for otcv8/old protocol (#3162)
Browse files Browse the repository at this point in the history
Resolves #3155
  • Loading branch information
kokekanon authored Dec 9, 2024
1 parent fbd6228 commit 8891f3a
Showing 1 changed file with 13 additions and 17 deletions.
30 changes: 13 additions & 17 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1689,7 +1689,7 @@ void ProtocolGame::parseSetOutfit(NetworkMessage &msg) {
g_logger().debug("Bool isMounted: {}", isMounted);
}

uint8_t isMountRandomized = msg.getByte();
uint8_t isMountRandomized = !oldProtocol ? msg.getByte() : 0;
g_game().playerChangeOutfit(player->getID(), newOutfit, isMountRandomized);
} else if (outfitType == 1) {
// This value probably has something to do with try outfit variable inside outfit window dialog
Expand Down Expand Up @@ -3247,12 +3247,6 @@ void ProtocolGame::sendCreatureOutfit(const std::shared_ptr<Creature> &creature,
msg.add<uint32_t>(creature->getID());
AddOutfit(msg, newOutfit);

if (!oldProtocol && newOutfit.lookMount != 0) {
msg.addByte(newOutfit.lookMountHead);
msg.addByte(newOutfit.lookMountBody);
msg.addByte(newOutfit.lookMountLegs);
msg.addByte(newOutfit.lookMountFeet);
}
writeToOutputBuffer(msg);
}

Expand Down Expand Up @@ -7184,10 +7178,12 @@ void ProtocolGame::sendOutfitWindow() {
return;
}

msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountHead);
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountBody);
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountLegs);
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountFeet);
if (currentOutfit.lookMount == 0) {
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountHead);
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountBody);
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountLegs);
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountFeet);
}
msg.add<uint16_t>(currentOutfit.lookFamiliarsType);

auto startOutfits = msg.getBufferPosition();
Expand Down Expand Up @@ -7750,12 +7746,6 @@ void ProtocolGame::AddCreature(NetworkMessage &msg, const std::shared_ptr<Creatu
if (!creature->isInGhostMode() && !creature->isInvisible()) {
const Outfit_t &outfit = creature->getCurrentOutfit();
AddOutfit(msg, outfit);
if (!oldProtocol && outfit.lookMount != 0) {
msg.addByte(outfit.lookMountHead);
msg.addByte(outfit.lookMountBody);
msg.addByte(outfit.lookMountLegs);
msg.addByte(outfit.lookMountFeet);
}
} else {
static Outfit_t outfit;
AddOutfit(msg, outfit);
Expand Down Expand Up @@ -7945,6 +7935,12 @@ void ProtocolGame::AddOutfit(NetworkMessage &msg, const Outfit_t &outfit, bool a

if (addMount) {
msg.add<uint16_t>(outfit.lookMount);
if (!oldProtocol && outfit.lookMount != 0) {
msg.addByte(outfit.lookMountHead);
msg.addByte(outfit.lookMountBody);
msg.addByte(outfit.lookMountLegs);
msg.addByte(outfit.lookMountFeet);
}
}
}

Expand Down

0 comments on commit 8891f3a

Please sign in to comment.