aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author_manuel_ <none@none>2009-12-31 17:59:56 -0300
committer_manuel_ <none@none>2009-12-31 17:59:56 -0300
commitebe7b299877aad8954bb5ab32d4046800c49b293 (patch)
treeecbd1b704d3261da65a424f091583c7c8943640f
parent6cd8d1286f48671cd2e782b3a6803d7e951cb0f5 (diff)
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
-rw-r--r--src/game/SpellHandler.cpp5
-rw-r--r--src/game/Unit.cpp13
-rw-r--r--src/game/Unit.h9
3 files changed, 22 insertions, 5 deletions
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index a9a28511d0c..6a03d13bf6d 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -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);
}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 04214762148..a9dbcab3db6 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -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)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index 0abcbf8f017..d2a713349a1 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -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();