Skip to content

Commit 1fc82d8

Browse files
dudantasvllworldbuilding
authored andcommitted
fix: set mount bool (opentibiabr#3371)
Fixes mount change on the set outfit only.
1 parent 5e17e0f commit 1fc82d8

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

src/game/game.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6162,7 +6162,7 @@ void Game::playerToggleMount(uint32_t playerId, bool mount) {
61626162
player->toggleMount(mount);
61636163
}
61646164

6165-
void Game::playerChangeOutfit(uint32_t playerId, Outfit_t outfit, uint8_t isMountRandomized /* = 0*/) {
6165+
void Game::playerChangeOutfit(uint32_t playerId, Outfit_t outfit, bool setMount, uint8_t isMountRandomized /* = 0*/) {
61666166
if (!g_configManager().getBoolean(ALLOW_CHANGEOUTFIT)) {
61676167
return;
61686168
}
@@ -6185,7 +6185,7 @@ void Game::playerChangeOutfit(uint32_t playerId, Outfit_t outfit, uint8_t isMoun
61856185
}
61866186

61876187
const auto playerOutfit = Outfits::getInstance().getOutfitByLookType(player, outfit.lookType);
6188-
if (!playerOutfit) {
6188+
if (!playerOutfit || !setMount) {
61896189
outfit.lookMount = 0;
61906190
}
61916191

src/game/game.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ class Game {
387387
void playerShowQuestLog(uint32_t playerId);
388388
void playerShowQuestLine(uint32_t playerId, uint16_t questId);
389389
void playerSay(uint32_t playerId, uint16_t channelId, SpeakClasses type, const std::string &receiver, const std::string &text);
390-
void playerChangeOutfit(uint32_t playerId, Outfit_t outfit, uint8_t isMountRandomized = 0);
390+
void playerChangeOutfit(uint32_t playerId, Outfit_t outfit, bool setMount, uint8_t isMountRandomized = 0);
391391
void playerInviteToParty(uint32_t playerId, uint32_t invitedId);
392392
void playerJoinParty(uint32_t playerId, uint32_t leaderId);
393393
void playerRevokePartyInvitation(uint32_t playerId, uint32_t invitedId);

src/server/network/protocol/protocolgame.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1683,18 +1683,19 @@ void ProtocolGame::parseSetOutfit(NetworkMessage &msg) {
16831683
newOutfit.lookAddons = msg.getByte();
16841684
if (outfitType == 0) {
16851685
newOutfit.lookMount = msg.get<uint16_t>();
1686+
bool setMount = false;
16861687
if (!oldProtocol) {
16871688
newOutfit.lookMountHead = std::min<uint8_t>(132, msg.getByte());
16881689
newOutfit.lookMountBody = std::min<uint8_t>(132, msg.getByte());
16891690
newOutfit.lookMountLegs = std::min<uint8_t>(132, msg.getByte());
16901691
newOutfit.lookMountFeet = std::min<uint8_t>(132, msg.getByte());
1691-
bool isMounted = msg.getByte();
1692+
setMount = msg.getByte();
16921693
newOutfit.lookFamiliarsType = msg.get<uint16_t>();
1693-
g_logger().debug("Bool isMounted: {}", isMounted);
1694+
g_logger().debug("Bool isMounted: {}", setMount);
16941695
}
16951696

16961697
uint8_t isMountRandomized = !oldProtocol ? msg.getByte() : 0;
1697-
g_game().playerChangeOutfit(player->getID(), newOutfit, isMountRandomized);
1698+
g_game().playerChangeOutfit(player->getID(), newOutfit, setMount, isMountRandomized);
16981699
} else if (outfitType == 1) {
16991700
// This value probably has something to do with try outfit variable inside outfit window dialog
17001701
// if try outfit is set to 2 it expects uint32_t value after mounted and disable mounts from outfit window dialog

0 commit comments

Comments
 (0)