Skip to content

Commit

Permalink
fix: set mount bool (#3371)
Browse files Browse the repository at this point in the history
Fixes mount change on the set outfit only.
  • Loading branch information
dudantas authored Feb 17, 2025
1 parent ff78b2c commit 6a1716b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/game/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6134,7 +6134,7 @@ void Game::playerToggleMount(uint32_t playerId, bool mount) {
player->toggleMount(mount);
}

void Game::playerChangeOutfit(uint32_t playerId, Outfit_t outfit, uint8_t isMountRandomized /* = 0*/) {
void Game::playerChangeOutfit(uint32_t playerId, Outfit_t outfit, bool setMount, uint8_t isMountRandomized /* = 0*/) {
if (!g_configManager().getBoolean(ALLOW_CHANGEOUTFIT)) {
return;
}
Expand All @@ -6157,7 +6157,7 @@ void Game::playerChangeOutfit(uint32_t playerId, Outfit_t outfit, uint8_t isMoun
}

const auto playerOutfit = Outfits::getInstance().getOutfitByLookType(player, outfit.lookType);
if (!playerOutfit) {
if (!playerOutfit || !setMount) {
outfit.lookMount = 0;
}

Expand Down
2 changes: 1 addition & 1 deletion src/game/game.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ class Game {
void playerShowQuestLog(uint32_t playerId);
void playerShowQuestLine(uint32_t playerId, uint16_t questId);
void playerSay(uint32_t playerId, uint16_t channelId, SpeakClasses type, const std::string &receiver, const std::string &text);
void playerChangeOutfit(uint32_t playerId, Outfit_t outfit, uint8_t isMountRandomized = 0);
void playerChangeOutfit(uint32_t playerId, Outfit_t outfit, bool setMount, uint8_t isMountRandomized = 0);
void playerInviteToParty(uint32_t playerId, uint32_t invitedId);
void playerJoinParty(uint32_t playerId, uint32_t leaderId);
void playerRevokePartyInvitation(uint32_t playerId, uint32_t invitedId);
Expand Down
7 changes: 4 additions & 3 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1683,18 +1683,19 @@ void ProtocolGame::parseSetOutfit(NetworkMessage &msg) {
newOutfit.lookAddons = msg.getByte();
if (outfitType == 0) {
newOutfit.lookMount = msg.get<uint16_t>();
bool setMount = false;
if (!oldProtocol) {
newOutfit.lookMountHead = std::min<uint8_t>(132, msg.getByte());
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());
bool isMounted = msg.getByte();
setMount = msg.getByte();
newOutfit.lookFamiliarsType = msg.get<uint16_t>();
g_logger().debug("Bool isMounted: {}", isMounted);
g_logger().debug("Bool isMounted: {}", setMount);
}

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

0 comments on commit 6a1716b

Please # to comment.