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.
This commit is contained in:
@@ -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))))
|
||||
|
||||
@@ -1500,6 +1500,8 @@ class TC_GAME_API Player final : public Unit, public GridObject<Player>
|
||||
// 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<Player>
|
||||
bool m_itemUpdateQueueBlocked;
|
||||
|
||||
uint32 m_ExtraFlags;
|
||||
bool m_preferDrawableAmmo = false;
|
||||
|
||||
QuestStatusMap m_QuestStatus;
|
||||
QuestObjectiveStatusMap m_questObjectiveStatus;
|
||||
|
||||
Reference in New Issue
Block a user