[9867] Prevent another potion drink until combat end.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
This commit is contained in:
zhenya 2010-05-11 11:19:10 +04:00 committed by VladimirMangos
parent 3a2c28ca68
commit fd131fb408
4 changed files with 10 additions and 2 deletions

View file

@ -18746,7 +18746,7 @@ void Player::SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId, Spell
void Player::UpdatePotionCooldown(Spell* spell) void Player::UpdatePotionCooldown(Spell* spell)
{ {
// no potion used i combat or still in combat // no potion used in combat or still in combat
if(!m_lastPotionId || isInCombat()) if(!m_lastPotionId || isInCombat())
return; return;

View file

@ -1642,6 +1642,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void _LoadSpellCooldowns(QueryResult *result); void _LoadSpellCooldowns(QueryResult *result);
void _SaveSpellCooldowns(); void _SaveSpellCooldowns();
void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; } void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
uint32 GetLastPotionId() { return m_lastPotionId; }
void UpdatePotionCooldown(Spell* spell = NULL); void UpdatePotionCooldown(Spell* spell = NULL);
void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana) void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)

View file

@ -112,6 +112,13 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
} }
} }
} }
// Prevent potion drink if another potion in processing (client have potions disabled in like case)
if (pItem->IsPotion() && pUser->GetLastPotionId())
{
pUser->SendEquipError(EQUIP_ERR_OBJECT_IS_BUSY,pItem,NULL);
return;
}
} }
// check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory) // check also BIND_WHEN_PICKED_UP and BIND_QUEST_ITEM for .additem or .additemset case by GM (not binded at adding to inventory)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "9866" #define REVISION_NR "9867"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__