Skip to content

Commit 8891f3a

Browse files
authored
fix: packet interpretation parseSetOutfit for otcv8/old protocol (#3162)
Resolves #3155
1 parent fbd6228 commit 8891f3a

File tree

1 file changed

+13
-17
lines changed

1 file changed

+13
-17
lines changed

src/server/network/protocol/protocolgame.cpp

Lines changed: 13 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ void ProtocolGame::parseSetOutfit(NetworkMessage &msg) {
16891689
g_logger().debug("Bool isMounted: {}", isMounted);
16901690
}
16911691

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

3250-
if (!oldProtocol && newOutfit.lookMount != 0) {
3251-
msg.addByte(newOutfit.lookMountHead);
3252-
msg.addByte(newOutfit.lookMountBody);
3253-
msg.addByte(newOutfit.lookMountLegs);
3254-
msg.addByte(newOutfit.lookMountFeet);
3255-
}
32563250
writeToOutputBuffer(msg);
32573251
}
32583252

@@ -7184,10 +7178,12 @@ void ProtocolGame::sendOutfitWindow() {
71847178
return;
71857179
}
71867180

7187-
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountHead);
7188-
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountBody);
7189-
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountLegs);
7190-
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountFeet);
7181+
if (currentOutfit.lookMount == 0) {
7182+
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountHead);
7183+
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountBody);
7184+
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountLegs);
7185+
msg.addByte(isSupportOutfit ? 0 : currentOutfit.lookMountFeet);
7186+
}
71917187
msg.add<uint16_t>(currentOutfit.lookFamiliarsType);
71927188

71937189
auto startOutfits = msg.getBufferPosition();
@@ -7750,12 +7746,6 @@ void ProtocolGame::AddCreature(NetworkMessage &msg, const std::shared_ptr<Creatu
77507746
if (!creature->isInGhostMode() && !creature->isInvisible()) {
77517747
const Outfit_t &outfit = creature->getCurrentOutfit();
77527748
AddOutfit(msg, outfit);
7753-
if (!oldProtocol && outfit.lookMount != 0) {
7754-
msg.addByte(outfit.lookMountHead);
7755-
msg.addByte(outfit.lookMountBody);
7756-
msg.addByte(outfit.lookMountLegs);
7757-
msg.addByte(outfit.lookMountFeet);
7758-
}
77597749
} else {
77607750
static Outfit_t outfit;
77617751
AddOutfit(msg, outfit);
@@ -7945,6 +7935,12 @@ void ProtocolGame::AddOutfit(NetworkMessage &msg, const Outfit_t &outfit, bool a
79457935

79467936
if (addMount) {
79477937
msg.add<uint16_t>(outfit.lookMount);
7938+
if (!oldProtocol && outfit.lookMount != 0) {
7939+
msg.addByte(outfit.lookMountHead);
7940+
msg.addByte(outfit.lookMountBody);
7941+
msg.addByte(outfit.lookMountLegs);
7942+
msg.addByte(outfit.lookMountFeet);
7943+
}
79487944
}
79497945
}
79507946

0 commit comments

Comments
 (0)