Skip to content

Commit

Permalink
Pet: Simplify bool logic of previous commit and fix logical errors wh…
Browse files Browse the repository at this point in the history
…en in combo with CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT

Closes #483
  • Loading branch information
killerwife committed Jan 8, 2024
1 parent 4a17f69 commit 5995e66
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/game/Entities/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1924,9 +1924,10 @@ bool Player::Mount(uint32 displayid, const Aura* aura/* = nullptr*/)
if (!Unit::Mount(displayid, aura))
return false;

bool keepPetOnMount = !sWorld.getConfig(CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT);
bool keepPetOnFlyingMount = !keepPetOnMount ? false : sWorld.getConfig(CONFIG_BOOL_KEEP_PET_ON_FLYING_MOUNT);
// Custom mount (non-aura such as taxi or command) or in flight: unsummon any pet
if (!sWorld.getConfig(CONFIG_BOOL_KEEP_PET_WHEN_MOUNTED) &&
(!aura || IsFreeFlying() || IsSpellHaveAura(aura->GetSpellProto(), SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED)))
if (!aura || (!keepPetOnFlyingMount && (IsFreeFlying() || IsSpellHaveAura(aura->GetSpellProto(), SPELL_AURA_MOD_FLIGHT_SPEED_MOUNTED))))
{
UnsummonPetTemporaryIfAny();
}
Expand All @@ -1935,8 +1936,7 @@ bool Player::Mount(uint32 displayid, const Aura* aura/* = nullptr*/)
{
if (Pet* pet = GetPet())
{
if (pet->isControlled() && !sWorld.getConfig(CONFIG_BOOL_KEEP_PET_WHEN_MOUNTED) &&(!(pet->isTemporarySummoned() || InArena())
|| sWorld.getConfig(CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT)))
if (pet->isControlled() && (!(pet->isTemporarySummoned() || InArena() || keepPetOnMount)))
UnsummonPetTemporaryIfAny();
else
pet->SetModeFlags(PET_MODE_DISABLE_ACTIONS);
Expand Down
2 changes: 1 addition & 1 deletion src/game/World/World.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -793,7 +793,7 @@ void World::LoadConfigSettings(bool reload)
setConfig(CONFIG_UINT32_INTERACTION_PAUSE_TIMER, "InteractionPauseTimer", 180000);

setConfig(CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT, "PetUnsummonAtMount", false);
setConfig(CONFIG_BOOL_KEEP_PET_WHEN_MOUNTED, "KeepPetWhenMounted", false);
setConfig(CONFIG_BOOL_KEEP_PET_ON_FLYING_MOUNT, "KeepPetOnFlyingMount", false);
setConfig(CONFIG_BOOL_PET_ATTACK_FROM_BEHIND, "PetAttackFromBehind", true);

setConfig(CONFIG_BOOL_AUTO_DOWNRANK, "AutoDownrank", true);
Expand Down
2 changes: 1 addition & 1 deletion src/game/World/World.h
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ enum eConfigBoolValues
CONFIG_BOOL_CLEAN_CHARACTER_DB,
CONFIG_BOOL_VMAP_INDOOR_CHECK,
CONFIG_BOOL_PET_UNSUMMON_AT_MOUNT,
CONFIG_BOOL_KEEP_PET_WHEN_MOUNTED,
CONFIG_BOOL_KEEP_PET_ON_FLYING_MOUNT,
CONFIG_BOOL_PET_ATTACK_FROM_BEHIND,
CONFIG_BOOL_AUTO_DOWNRANK,
CONFIG_BOOL_MMAP_ENABLED,
Expand Down
4 changes: 2 additions & 2 deletions src/mangosd/mangosd.conf.dist.in
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,7 @@ LogColors = ""
# Default: 0 - unsummon only when appropriate (don't unsummon temp summons on ground mounting)
# 1 - always unsummon controlled pets on mounting
#
# KeepPetWhenMounted
# KeepPetOnFlyingMount
# Permanent pet will only be unsummoned when flying
# Default: 0 - unsummon depending on PetUnsummonAtMount
# 1 - permanent pet will remain summoned unless flying
Expand Down Expand Up @@ -942,7 +942,7 @@ SkillChance.Prospecting = 0
SkillChance.Milling = 0
OffhandCheckAtTalentsReset = 0
PetUnsummonAtMount = 0
KeepPetWhenMounted = 0
KeepPetOnFlyingMount = 0
ClientCacheVersion = 0
PetAttackFromBehind = 1
AutoDownrank = 1
Expand Down

0 comments on commit 5995e66

Please sign in to comment.