Skip to content

Commit

Permalink
[6905] Fixed items with both healing and energizing effects
Browse files Browse the repository at this point in the history
Store fall information also at MSG_MOVE_FALL_LAND
  • Loading branch information
arrai committed Dec 13, 2008
1 parent 0347d61 commit 94348b4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/game/MovementHandler.cpp
Expand Up @@ -362,7 +362,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )

GetPlayer()->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
GetPlayer()->m_movementInfo = movementInfo;
if (GetPlayer()->m_lastFallTime >= movementInfo.fallTime || GetPlayer()->m_lastFallZ <=movementInfo.z)
if (GetPlayer()->m_lastFallTime >= movementInfo.fallTime || GetPlayer()->m_lastFallZ <=movementInfo.z || recv_data.GetOpcode() == MSG_MOVE_FALL_LAND)
GetPlayer()->SetFallInformation(movementInfo.fallTime, movementInfo.z);

if(GetPlayer()->isMovingOrTurning())
Expand Down
32 changes: 28 additions & 4 deletions src/game/Spell.cpp
Expand Up @@ -4405,28 +4405,52 @@ uint8 Spell::CheckItems()
uint32 ItemClass = proto->Class;
if (ItemClass == ITEM_CLASS_CONSUMABLE && m_targets.getUnitTarget())
{
// such items should only fail if there is no suitable effect at all - see Rejuvenation Potions for example
uint8 failReason = 0;
for (int i = 0; i < 3; i++)
{
// skip check, pet not required like checks, and for TARGET_PET m_targets.getUnitTarget() is not the real target but the caster
if (m_spellInfo->EffectImplicitTargetA[i] == TARGET_PET)
continue;

if (m_spellInfo->Effect[i] == SPELL_EFFECT_HEAL)
{
if (m_targets.getUnitTarget()->GetHealth() == m_targets.getUnitTarget()->GetMaxHealth())
return (uint8)SPELL_FAILED_ALREADY_AT_FULL_HEALTH;
{
failReason = (uint8)SPELL_FAILED_ALREADY_AT_FULL_HEALTH;
continue;
}
else
{
failReason = 0;
break;
}
}

// Mana Potion, Rage Potion, Thistle Tea(Rogue), ...
if (m_spellInfo->Effect[i] == SPELL_EFFECT_ENERGIZE)
{
if(m_spellInfo->EffectMiscValue[i] < 0 || m_spellInfo->EffectMiscValue[i] >= MAX_POWERS)
return (uint8)SPELL_FAILED_ALREADY_AT_FULL_POWER;
{
failReason = (uint8)SPELL_FAILED_ALREADY_AT_FULL_POWER;
continue;
}

Powers power = Powers(m_spellInfo->EffectMiscValue[i]);

if (m_targets.getUnitTarget()->GetPower(power) == m_targets.getUnitTarget()->GetMaxPower(power))
return (uint8)SPELL_FAILED_ALREADY_AT_FULL_POWER;
{
failReason = (uint8)SPELL_FAILED_ALREADY_AT_FULL_POWER;
continue;
}
else
{
failReason = 0;
break;
}
}
}
if (failReason)
return failReason;
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "6904"
#define REVISION_NR "6905"
#endif // __REVISION_NR_H__

0 comments on commit 94348b4

Please sign in to comment.