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: packet interpretation parseSetOutfit for otcv8/old protocol #3162

Merged
merged 2 commits into from
Dec 9, 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
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
Loading