Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Core/Pets: no longer restore the command state after re-enabling pet …
Browse files Browse the repository at this point in the history
…actions
  • Loading branch information
Ovahlord committed Oct 19, 2023
1 parent 0913328 commit 23f05b3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
20 changes: 5 additions & 15 deletions src/server/game/Entities/Creature/TemporarySummon/NewPet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ void NewPet::UpdatePlayerPetData(PlayerPetData* petData)
petData->SavedHealth = GetHealth();
petData->SavedPower = GetPower(GetPowerType());
petData->LastSaveTime = static_cast<uint32>(GameTime::GetGameTime());
petData->ReactState = _disableActionSettings.has_value() ? _disableActionSettings->OriginalReactState : GetReactState();
petData->ReactState = _disableActionsOriginalReactState.value_or(GetReactState());
petData->Slot = _playerPetDataKey->first;
petData->Name = GetName();
petData->ActionBar = GenerateActionBarDataString();
Expand Down Expand Up @@ -435,22 +435,12 @@ void NewPet::DisablePetActions(bool disable)

ASSERT(GetCharmInfo());

// Store the original settings before we change them
// Store the original react state before we change it
if (disable)
{
PetDisableActionSettings& settings = _disableActionSettings.emplace();
settings.OriginalReactState = GetReactState();
settings.OriginalCommandState = GetCharmInfo()->GetCommandState();
}
_disableActionsOriginalReactState = GetReactState();
else
{
// Restore the settings
if (_disableActionSettings.has_value())
{
SetReactState(_disableActionSettings->OriginalReactState);
GetCharmInfo()->SetCommandState(_disableActionSettings->OriginalCommandState);
}
}
if (_disableActionsOriginalReactState.has_value())
SetReactState(*_disableActionsOriginalReactState);

if (IsInWorld())
{
Expand Down
2 changes: 1 addition & 1 deletion src/server/game/Entities/Creature/TemporarySummon/NewPet.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class TC_GAME_API NewPet final : public NewGuardian
bool _isClassPet;
PetSpellMap _spells;
Optional<PlayerPetDataKey> _playerPetDataKey;
Optional<PetDisableActionSettings> _disableActionSettings;
Optional<ReactStates> _disableActionsOriginalReactState;
PetTalentMap _talents;
std::unique_ptr<DeclinedName> _declinedNames;
EnumFlag<PetModeFlags> _petModeFlags;
Expand Down

0 comments on commit 23f05b3

Please sign in to comment.