Skip to content

Commit

Permalink
[9867] Prevent another potion drink until combat end.
Browse files Browse the repository at this point in the history
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
zhenya authored and VladimirMangos committed May 11, 2010
1 parent 515fea2 commit 7a07580
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/game/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18746,7 +18746,7 @@ void Player::SendCooldownEvent(SpellEntry const *spellInfo, uint32 itemId, 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())
return;

Expand Down
1 change: 1 addition & 0 deletions src/game/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -1642,6 +1642,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void _LoadSpellCooldowns(QueryResult *result);
void _SaveSpellCooldowns();
void SetLastPotionId(uint32 item_id) { m_lastPotionId = item_id; }
uint32 GetLastPotionId() { return m_lastPotionId; }
void UpdatePotionCooldown(Spell* spell = NULL);

void setResurrectRequestData(uint64 guid, uint32 mapId, float X, float Y, float Z, uint32 health, uint32 mana)
Expand Down
7 changes: 7 additions & 0 deletions src/game/SpellHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9866"
#define REVISION_NR "9867"
#endif // __REVISION_NR_H__

0 comments on commit 7a07580

Please sign in to comment.