diff options
author | megamage <none@none> | 2009-05-08 18:52:12 -0500 |
---|---|---|
committer | megamage <none@none> | 2009-05-08 18:52:12 -0500 |
commit | 29921b5bea032c1f701dda5f4fe64e10dc0b067a (patch) | |
tree | b9d1c3fc9aac4dd9bc1984ea8f8e82982c4b20bd /src | |
parent | 7277ddd1140d388939ae135f135d5bf58871dacf (diff) |
[7798] More Player::ActivateTaxiPathTo use improvements Author: VladimirMangos
* Provide more explicit way about spell that cast taxi flight if any
* Remove incorrect states instead error reporting in case non-taximaster flight start (cast/script)
* Remove mount_id arg from ActivateTaxiPathTo and implement support for 0 mount_id case (spell 32474)
* Implement spell 32474 (except finilize part)
* Provided Player::ActivateTaxiPathTo(uint32 taxi_path_id) function version for simplify one node to node paths use by id.
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/game/Player.cpp | 91 | ||||
-rw-r--r-- | src/game/Player.h | 3 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 11 | ||||
-rw-r--r-- | src/game/SpellAuras.h | 1 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 13 | ||||
-rw-r--r-- | src/game/TaxiHandler.cpp | 7 |
6 files changed, 83 insertions, 43 deletions
diff --git a/src/game/Player.cpp b/src/game/Player.cpp index 07b5a71cf83..a1ec4606d2a 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -17114,43 +17114,68 @@ void Player::HandleStealthedUnitsDetection() } } -bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_id, Creature* npc) +bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc /*= NULL*/, uint32 spellid /*= 0*/) { if(nodes.size() < 2) return false; - // not let cheating with start flight mounted - if(IsMounted()) + // not let cheating with start flight in time of logout process || if casting not finished || while in combat || if not use Spell's with EffectSendTaxi + if(GetSession()->isLogingOut() || isInCombat()) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); - data << uint32(ERR_TAXIPLAYERALREADYMOUNTED); + data << uint32(ERR_TAXIPLAYERBUSY); GetSession()->SendPacket(&data); return false; } - if( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW ) - { - WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); - data << uint32(ERR_TAXIPLAYERSHAPESHIFTED); - GetSession()->SendPacket(&data); + if(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) return false; - } - // not let cheating with start flight in time of logout process || if casting not finished || while in combat || if not use Spell's with EffectSendTaxi - if(GetSession()->isLogingOut() || - (!m_currentSpells[CURRENT_GENERIC_SPELL] || - m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Effect[0] != SPELL_EFFECT_SEND_TAXI)&& - IsNonMeleeSpellCasted(false) || - isInCombat()) + // taximaster case + if(npc) { - WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); - data << uint32(ERR_TAXIPLAYERBUSY); - GetSession()->SendPacket(&data); - return false; + // not let cheating with start flight mounted + if(IsMounted()) + { + WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); + data << uint32(ERR_TAXIPLAYERALREADYMOUNTED); + GetSession()->SendPacket(&data); + return false; + } + + if( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW ) + { + WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); + data << uint32(ERR_TAXIPLAYERSHAPESHIFTED); + GetSession()->SendPacket(&data); + return false; + } + + // not let cheating with start flight in time of logout process || if casting not finished || while in combat || if not use Spell's with EffectSendTaxi + if(IsNonMeleeSpellCasted(false)) + { + WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); + data << uint32(ERR_TAXIPLAYERBUSY); + GetSession()->SendPacket(&data); + return false; + } } + // cast case or scripted call case + else + { + RemoveSpellsCausingAura(SPELL_AURA_MOUNTED); - if(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE)) - return false; + if( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW ) + RemoveAurasDueToSpell(m_ShapeShiftFormSpellId); + + if(m_currentSpells[CURRENT_GENERIC_SPELL] && m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id != spellid) + InterruptSpell(CURRENT_GENERIC_SPELL,false); + + InterruptSpell(CURRENT_AUTOREPEAT_SPELL,false); + + if(m_currentSpells[CURRENT_CHANNELED_SPELL] && m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id != spellid) + InterruptSpell(CURRENT_CHANNELED_SPELL,true); + } uint32 sourcenode = nodes[0]; @@ -17180,7 +17205,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_i } } // node must have pos if not spell case (npc!=0) - else if(npc) + else if(!spellid) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR); @@ -17232,10 +17257,9 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_i prevnode = lastnode; } - if(!mount_id) // if not provide then attempt use default, allow seelct alt team mount creature model but for proper team in spell case. - mount_id = objmgr.GetTaxiMount(sourcenode, GetTeam(), npc == NULL); + uint16 mount_id = objmgr.GetTaxiMount(sourcenode, GetTeam(), spellid != 0); - if (mount_id == 0 || sourcepath == 0) + if (mount_id == 0 && spellid == 0 || sourcepath == 0) { WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); data << uint32(ERR_TAXIUNSPECIFIEDSERVERERROR); @@ -17277,6 +17301,21 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_i return true; } +bool Player::ActivateTaxiPathTo( uint32 taxi_path_id, uint32 spellid /*= 0*/ ) +{ + TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(taxi_path_id); + if(!entry) + return false; + + std::vector<uint32> nodes; + + nodes.resize(2); + nodes[0] = entry->from; + nodes[1] = entry->to; + + return ActivateTaxiPathTo(nodes,NULL,spellid); +} + void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs ) { // last check 2.0.10 diff --git a/src/game/Player.h b/src/game/Player.h index ecab25122bf..be509972e71 100644 --- a/src/game/Player.h +++ b/src/game/Player.h @@ -867,7 +867,8 @@ class TRINITY_DLL_SPEC Player : public Unit PlayerTaxi m_taxi; void InitTaxiNodesForLevel() { m_taxi.InitTaxiNodesForLevel(getRace(), getClass(), getLevel()); } - bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_id = 0 , Creature* npc = NULL); + bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = NULL, uint32 spellid = 0); + bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0); // mount_id can be used in scripting calls bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; } void SetAcceptWhispers(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; } diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index f7f13acc3f8..3885be1c517 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -196,7 +196,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]= &AuraEffect::HandleRangedAmmoHaste, //141 SPELL_AURA_MOD_RANGED_AMMO_HASTE &AuraEffect::HandleAuraModBaseResistancePCT, //142 SPELL_AURA_MOD_BASE_RESISTANCE_PCT &AuraEffect::HandleAuraModResistanceExclusive, //143 SPELL_AURA_MOD_RESISTANCE_EXCLUSIVE - &AuraEffect::HandleNoImmediateEffect, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes + &AuraEffect::HandleAuraSafeFall, //144 SPELL_AURA_SAFE_FALL implemented in WorldSession::HandleMovementOpcodes &AuraEffect::HandleAuraModPetTalentsPoints, //145 SPELL_AURA_MOD_PET_TALENT_POINTS &AuraEffect::HandleNoImmediateEffect, //146 SPELL_AURA_ALLOW_TAME_PET_TYPE &AuraEffect::HandleModStateImmunityMask, //147 SPELL_AURA_MECHANIC_IMMUNITY_MASK @@ -6973,3 +6973,12 @@ void Aura::UnregisterSingleCastAura() m_isSingleTargetAura = false; } } + +void Aura::HandleAuraSafeFall( bool Apply, bool Real ) +{ + // implemented in WorldSession::HandleMovementOpcodes + + // only special case + if(Apply && Real && GetId()==32474 && m_target->GetTypeId()==TYPEID_PLAYER) + ((Player*)m_target)->ActivateTaxiPathTo(506,GetId()); +} diff --git a/src/game/SpellAuras.h b/src/game/SpellAuras.h index f0120596ce9..973272a75d2 100644 --- a/src/game/SpellAuras.h +++ b/src/game/SpellAuras.h @@ -217,6 +217,7 @@ class TRINITY_DLL_SPEC AuraEffect void HandlePeriodicTriggerSpellWithValue(bool apply, bool Real); void HandlePeriodicEnergize(bool Apply, bool Real); void HandleAuraModResistanceExclusive(bool Apply, bool Real); + void HandleAuraSafeFall(bool Apply, bool Real); void HandleAuraModPetTalentsPoints(bool Apply, bool Real); void HandleModStealth(bool Apply, bool Real); void HandleInvisibility(bool Apply, bool Real); diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index 63fdf335ad5..3226ccdbec0 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -5891,18 +5891,7 @@ void Spell::EffectSendTaxi(uint32 i) if(!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER) return; - TaxiPathEntry const* entry = sTaxiPathStore.LookupEntry(m_spellInfo->EffectMiscValue[i]); - if(!entry) - return; - - std::vector<uint32> nodes; - - nodes.resize(2); - nodes[0] = entry->from; - nodes[1] = entry->to; - - ((Player*)unitTarget)->ActivateTaxiPathTo(nodes); - + ((Player*)unitTarget)->ActivateTaxiPathTo(m_spellInfo->EffectMiscValue[i],m_spellInfo->Id); } void Spell::EffectPlayerPull(uint32 i) diff --git a/src/game/TaxiHandler.cpp b/src/game/TaxiHandler.cpp index 24c6aca147a..5ba65c00660 100644 --- a/src/game/TaxiHandler.cpp +++ b/src/game/TaxiHandler.cpp @@ -128,7 +128,8 @@ void WorldSession::SendDoFlight( uint16 MountId, uint32 path, uint32 pathNode ) while(GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType()==FLIGHT_MOTION_TYPE) GetPlayer()->GetMotionMaster()->MovementExpired(false); - GetPlayer()->Mount( MountId ); + if (MountId) + GetPlayer()->Mount( MountId ); GetPlayer()->GetMotionMaster()->MoveTaxiFlight(path,pathNode); } @@ -190,7 +191,7 @@ void WorldSession::HandleActivateTaxiFarOpcode ( WorldPacket & recv_data ) sLog.outDebug( "WORLD: Received CMSG_ACTIVATETAXIEXPRESS from %d to %d" ,nodes.front(),nodes.back()); - GetPlayer()->ActivateTaxiPathTo(nodes, 0, npc); + GetPlayer()->ActivateTaxiPathTo(nodes, npc); } void WorldSession::HandleTaxiNextDestinationOpcode(WorldPacket& /*recv_data*/) @@ -275,6 +276,6 @@ void WorldSession::HandleActivateTaxiOpcode( WorldPacket & recv_data ) return; } - GetPlayer()->ActivateTaxiPathTo(nodes, 0, npc); + GetPlayer()->ActivateTaxiPathTo(nodes, npc); } |