Implemented function CheckPlayerCondition, it will be used before the player enters in vehicles. Now vehicles Argent Warhorse and Argent Battleworg can't be used if the player dosen't have Argent Lance eqquiped.

--HG--
branch : trunk
This commit is contained in:
_manuel_
2009-12-31 17:59:56 -03:00
parent 6cd8d1286f
commit ebe7b29987
3 changed files with 22 additions and 5 deletions

View File

@@ -556,7 +556,10 @@ void WorldSession::HandleSpellClick( WorldPacket & recv_data )
}
if(unit->IsVehicle())
_player->EnterVehicle(unit);
{
if (unit->CheckPlayerCondition(_player))
_player->EnterVehicle(unit);
}
unit->AI()->DoAction(EVENT_SPELLCLICK);
}

View File

@@ -15420,6 +15420,19 @@ void Unit::JumpTo(WorldObject *obj, float speedZ)
GetMotionMaster()->MoveJump(x, y, z, speedXY, speedZ);
}
bool Unit::CheckPlayerCondition(Player* pPlayer)
{
switch(GetEntry())
{
case 35644: //Argent Warhorse
case 36558: //Argent Battleworg
if (!pPlayer->HasItemOrGemWithIdEquipped(46106,1)) //Check item Argent Lance
return false;
default:
return true;
}
}
void Unit::EnterVehicle(Vehicle *vehicle, int8 seatId)
{
if (!isAlive() || GetVehicleKit() == vehicle)

View File

@@ -1291,17 +1291,17 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
void CalculateSpellDamageTaken(SpellNonMeleeDamage *damageInfo, int32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType = BASE_ATTACK, bool crit = false);
void DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss);
// player or player's pet resilience (-1%)
float GetMeleeCritChanceReduction() const { return GetCombatRatingReduction(CR_CRIT_TAKEN_MELEE); }
float GetRangedCritChanceReduction() const { return GetCombatRatingReduction(CR_CRIT_TAKEN_RANGED); }
float GetSpellCritChanceReduction() const { return GetCombatRatingReduction(CR_CRIT_TAKEN_SPELL); }
// player or player's pet resilience (-1%)
uint32 GetMeleeCritDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 2.2f, 33.0f, damage); }
uint32 GetRangedCritDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_RANGED, 2.2f, 33.0f, damage); }
uint32 GetSpellCritDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_SPELL, 2.2f, 33.0f, damage); }
// player or player's pet resilience (-1%), cap 100%
uint32 GetMeleeDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 1.0f, 100.0f, damage); }
uint32 GetRangedDamageReduction(uint32 damage) const { return GetCombatRatingDamageReduction(CR_CRIT_TAKEN_MELEE, 1.0f, 100.0f, damage); }
@@ -1783,7 +1783,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool IsImmunedToDamage(SpellSchoolMask meleeSchoolMask);
bool IsImmunedToDamage(SpellEntry const* spellInfo);
virtual bool IsImmunedToSpellEffect(SpellEntry const* spellInfo, uint32 index) const;
// redefined in Creature
// redefined in Creature
uint32 CalcNotIgnoreDamageRedunction( uint32 damage, SpellSchoolMask damageSchoolMask);
uint32 CalcArmorReducedDamage(Unit* pVictim, const uint32 damage, SpellEntry const *spellInfo, WeaponAttackType attackType=MAX_ATTACK);
void CalcAbsorbResist(Unit *pVictim, SpellSchoolMask schoolMask, DamageEffectType damagetype, const uint32 damage, uint32 *absorb, uint32 *resist, SpellEntry const *spellInfo = NULL);
@@ -1898,6 +1898,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
bool m_ControlledByPlayer;
bool CheckPlayerCondition(Player* pPlayer);
void EnterVehicle(Unit *base, int8 seatId = -1) { EnterVehicle(base->GetVehicleKit(), seatId); }
void EnterVehicle(Vehicle *vehicle, int8 seatId = -1);
void ExitVehicle();