[12697] Improve alcohol handling

Fixes client crash when using Barbershop Chair while drunk

Also allow .mod drunk to modify the drunk state of the targeted player (original author @Shauren)
This commit is contained in:
sanctum32 2013-10-21 08:48:15 +03:00 committed by Antz
parent 4cebb3880c
commit 7ae2fd2a6e
8 changed files with 60 additions and 55 deletions

View file

@ -9346,13 +9346,12 @@ void Spell::EffectInebriate(SpellEffectEntry const* /*effect*/)
return;
Player* player = (Player*)unitTarget;
uint16 currentDrunk = player->GetDrunkValue();
uint16 drunkMod = damage * 256;
if (currentDrunk + drunkMod > 0xFFFF)
currentDrunk = 0xFFFF;
else
currentDrunk += drunkMod;
player->SetDrunkValue(currentDrunk, m_CastItem ? m_CastItem->GetEntry() : 0);
uint8 drunkValue = player->GetDrunkValue() + (uint8)damage;
if (drunkValue > 100)
drunkValue = 100;
player->SetDrunkValue(drunkValue, m_CastItem ? m_CastItem->GetEntry() : 0);
}
void Spell::EffectFeedPet(SpellEffectEntry const* effect)