*Fix a bug that player takes fall damage when finishing taxi path.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-20 20:39:55 -05:00
parent 1cc1adbc8b
commit 33c24110dd
4 changed files with 21 additions and 32 deletions
-10
View File
@@ -175,15 +175,5 @@ struct AISpellInfoType
TRINITY_DLL_SPEC AISpellInfoType * GetAISpellInfo(uint32 i); TRINITY_DLL_SPEC AISpellInfoType * GetAISpellInfo(uint32 i);
//Selection method used by SelectTarget
enum SelectAggroTarget
{
SELECT_TARGET_RANDOM = 0, //Just selects a random target
SELECT_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom
SELECT_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top
SELECT_TARGET_NEAREST,
SELECT_TARGET_FARTHEST,
};
#endif #endif
+10 -3
View File
@@ -249,12 +249,19 @@ void WorldSession::HandleTaxiNextDestinationOpcode(WorldPacket& /*recv_data*/)
objmgr.GetTaxiPath( sourcenode, destinationnode, path, cost); objmgr.GetTaxiPath( sourcenode, destinationnode, path, cost);
if(path && MountId) if(path && MountId)
{
SendDoFlight( MountId, path, 1 ); // skip start fly node SendDoFlight( MountId, path, 1 ); // skip start fly node
else return;
GetPlayer()->m_taxi.ClearTaxiDestinations(); // clear problematic path and next
} }
else }
GetPlayer()->m_taxi.ClearTaxiDestinations(); // not destinations, clear source node GetPlayer()->m_taxi.ClearTaxiDestinations(); // not destinations, clear source node
GetPlayer()->Unmount();
GetPlayer()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
GetPlayer()->SetFallInformation(0, GetPlayer()->GetPositionZ());
GetPlayer()->getHostilRefManager().setOnlineOfflineState(true);
if(GetPlayer()->pvpInfo.inHostileArea)
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
} }
void WorldSession::HandleActivateTaxiOpcode( WorldPacket & recv_data ) void WorldSession::HandleActivateTaxiOpcode( WorldPacket & recv_data )
+10 -2
View File
@@ -22,12 +22,20 @@
#define TRINITY_UNITAI_H #define TRINITY_UNITAI_H
#include "Platform/Define.h" #include "Platform/Define.h"
#include "CreatureAIImpl.h"
class Unit; class Unit;
class Player; class Player;
struct AISpellInfoType; struct AISpellInfoType;
enum SelectAggroTarget;
//Selection method used by SelectTarget
enum SelectAggroTarget
{
SELECT_TARGET_RANDOM = 0, //Just selects a random target
SELECT_TARGET_TOPAGGRO, //Selects targes from top aggro to bottom
SELECT_TARGET_BOTTOMAGGRO, //Selects targets from bottom aggro to top
SELECT_TARGET_NEAREST,
SELECT_TARGET_FARTHEST,
};
class TRINITY_DLL_SPEC UnitAI class TRINITY_DLL_SPEC UnitAI
{ {
-16
View File
@@ -251,7 +251,6 @@ void FlightPathMovementGenerator::Initialize(Player &player)
player.getHostilRefManager().setOnlineOfflineState(false); player.getHostilRefManager().setOnlineOfflineState(false);
player.addUnitState(UNIT_STAT_IN_FLIGHT); player.addUnitState(UNIT_STAT_IN_FLIGHT);
player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT); player.SetFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
player.AddUnitMovementFlag(MOVEMENTFLAG_FLYING2);
SetWaypointPathId(player); SetWaypointPathId(player);
Traveller<Player> traveller(player); Traveller<Player> traveller(player);
// do not send movement, it was sent already // do not send movement, it was sent already
@@ -262,26 +261,11 @@ void FlightPathMovementGenerator::Initialize(Player &player)
void FlightPathMovementGenerator::Finalize(Player & player) void FlightPathMovementGenerator::Finalize(Player & player)
{ {
// remove flag to prevent send object build movement packets for flight state and crash (movement generator already not at top of stack)
player.clearUnitState(UNIT_STAT_IN_FLIGHT); player.clearUnitState(UNIT_STAT_IN_FLIGHT);
float x, y, z; float x, y, z;
i_destinationHolder.GetLocationNow(player.GetMapId(), x, y, z); i_destinationHolder.GetLocationNow(player.GetMapId(), x, y, z);
player.SetPosition(x, y, z, player.GetOrientation()); player.SetPosition(x, y, z, player.GetOrientation());
player.Unmount();
player.RemoveFlag(UNIT_FIELD_FLAGS,UNIT_FLAG_DISABLE_MOVE | UNIT_FLAG_TAXI_FLIGHT);
player.RemoveUnitMovementFlag(MOVEMENTFLAG_FLYING2);
if(player.m_taxi.empty())
{
player.getHostilRefManager().setOnlineOfflineState(true);
if(player.pvpInfo.inHostileArea)
player.CastSpell(&player, 2479, true);
player.SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);
player.StopMoving();
}
} }
bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff) bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)