From e66766970c898c2fa03a76bc982fdf34ae6ce357 Mon Sep 17 00:00:00 2001 From: Karrz1 <127596890+Karrz1@users.noreply.github.com> Date: Fri, 23 Oct 2026 16:39:26 +0100 Subject: [PATCH] Spells: ammo choice no longer asks the session whether it is a bot (#118) Player::AutoSelectAmmo called WorldSession::IsBot(), which the forever branch does not have, so forever failed to compile after the white-box ammo change. The preference is now a plain Player flag, off by default; a module that drives players without a client sets it. --- src/server/game/Entities/Player/Player.cpp | 4 ++-- src/server/game/Entities/Player/Player.h | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ed78d39b6d..78d59ec1a4 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -10230,8 +10230,8 @@ bool Player::SetAmmo(uint32 itemId) void Player::AutoSelectAmmo() { - // A bot has no client to choose its ammo: it takes a stack that is drawn with a model, not the generic white-box display. - bool const preferDrawable = GetSession() && GetSession()->IsBot(); + // Without a client to choose its ammo, a player takes a stack that is drawn with a model, not the generic white-box display. + bool const preferDrawable = m_preferDrawableAmmo; if (uint32 current = GetAmmoId()) if (HasItemCount(current) && IsAmmoUsableWithRangedWeapon(sObjectMgr->GetItemTemplate(current)) && (!preferDrawable || HasDrawableAmmoDisplay(sObjectMgr->GetItemTemplate(current)))) diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h index d4e64b2d55..d87f3ab80e 100644 --- a/src/server/game/Entities/Player/Player.h +++ b/src/server/game/Entities/Player/Player.h @@ -1500,6 +1500,8 @@ class TC_GAME_API Player final : public Unit, public GridObject // has no model: the client draws a white box for it, nocked and in flight. static uint32 GetAmmoDisplayId(ItemTemplate const* proto); static bool HasDrawableAmmoDisplay(ItemTemplate const* proto) { uint32 const id = GetAmmoDisplayId(proto); return id && id < 500000; } + // A player without a client to choose its ammo (a bot) sets this: AutoSelectAmmo then takes a stack that is drawn with a model. + void SetPreferDrawableAmmo(bool on) { m_preferDrawableAmmo = on; } bool NeedsAmmo() const; // bow, gun or crossbow equipped Item* GetShield(bool useable = false) const; Item* GetChildItemByGuid(ObjectGuid guid) const; @@ -3312,6 +3314,7 @@ class TC_GAME_API Player final : public Unit, public GridObject bool m_itemUpdateQueueBlocked; uint32 m_ExtraFlags; + bool m_preferDrawableAmmo = false; QuestStatusMap m_QuestStatus; QuestObjectiveStatusMap m_questObjectiveStatus;