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: set mount bool #3371

Merged
merged 1 commit into from
Feb 17, 2025
Merged
Show file tree
Hide file tree
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
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
Loading