*Update vehicle code.
*Show correct visual effects to other players. *Do not allow attack players on vehicle. *Only dismiss vehicle when it is summoned. --HG-- branch : trunk
This commit is contained in:
+1
-1
@@ -723,7 +723,7 @@ void Map::Update(const uint32 &t_diff)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(plr->m_seer != plr)
|
if(plr->m_seer != plr && !plr->hasUnitState(UNIT_STAT_ONVEHICLE))
|
||||||
{
|
{
|
||||||
Trinity::PlayerVisibilityNotifier notifier(*plr);
|
Trinity::PlayerVisibilityNotifier notifier(*plr);
|
||||||
VisitAll(plr->m_seer->GetPositionX(), plr->m_seer->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
VisitAll(plr->m_seer->GetPositionX(), plr->m_seer->GetPositionY(), World::GetMaxVisibleDistance(), notifier);
|
||||||
|
|||||||
@@ -294,7 +294,12 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
|||||||
else // creature charmed
|
else // creature charmed
|
||||||
{
|
{
|
||||||
if(Map *map = mover->GetMap())
|
if(Map *map = mover->GetMap())
|
||||||
|
{
|
||||||
|
//if(GetPlayer()->m_seer != mover)
|
||||||
|
if(((Creature*)mover)->isVehicle())
|
||||||
|
map->PlayerRelocation(GetPlayer(), movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
|
||||||
map->CreatureRelocation((Creature*)mover, movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
|
map->CreatureRelocation((Creature*)mover, movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
|
||||||
|
}
|
||||||
mover->SetUnitMovementFlags(movementInfo.flags);
|
mover->SetUnitMovementFlags(movementInfo.flags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -435,8 +440,6 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
|
|||||||
if(Vehicle *vehicle = ObjectAccessor::GetVehicle(vehicleGUID))
|
if(Vehicle *vehicle = ObjectAccessor::GetVehicle(vehicleGUID))
|
||||||
{
|
{
|
||||||
_player->ExitVehicle(vehicle);
|
_player->ExitVehicle(vehicle);
|
||||||
if(!vehicle->GetDBTableGUIDLow())
|
|
||||||
vehicle->Dismiss();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+25
-2
@@ -286,7 +286,7 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
|
|||||||
{
|
{
|
||||||
flags2 = ((Player*)this)->GetUnitMovementFlags();
|
flags2 = ((Player*)this)->GetUnitMovementFlags();
|
||||||
|
|
||||||
if(((Player*)this)->GetTransport())
|
if(((Player*)this)->GetTransport() || ((Player*)this)->hasUnitState(UNIT_STAT_ONVEHICLE))
|
||||||
flags2 |= MOVEMENTFLAG_ONTRANSPORT;
|
flags2 |= MOVEMENTFLAG_ONTRANSPORT;
|
||||||
else
|
else
|
||||||
flags2 &= ~MOVEMENTFLAG_ONTRANSPORT;
|
flags2 &= ~MOVEMENTFLAG_ONTRANSPORT;
|
||||||
@@ -336,6 +336,9 @@ void Object::_BuildMovementUpdate(ByteBuffer * data, uint8 flags, uint32 flags2)
|
|||||||
{
|
{
|
||||||
if(GetTypeId() == TYPEID_PLAYER)
|
if(GetTypeId() == TYPEID_PLAYER)
|
||||||
{
|
{
|
||||||
|
if(((Player*)this)->hasUnitState(UNIT_STAT_ONVEHICLE))
|
||||||
|
*data << (uint64)((Player*)this)->GetCharmGUID();
|
||||||
|
else
|
||||||
*data << (uint64)((Player*)this)->GetTransport()->GetGUID();
|
*data << (uint64)((Player*)this)->GetTransport()->GetGUID();
|
||||||
*data << (float)((Player*)this)->GetTransOffsetX();
|
*data << (float)((Player*)this)->GetTransOffsetX();
|
||||||
*data << (float)((Player*)this)->GetTransOffsetY();
|
*data << (float)((Player*)this)->GetTransOffsetY();
|
||||||
@@ -1619,7 +1622,17 @@ void WorldObject::BuildHeartBeatMsg(WorldPacket *data) const
|
|||||||
*data << m_positionY;
|
*data << m_positionY;
|
||||||
*data << m_positionZ;
|
*data << m_positionZ;
|
||||||
*data << m_orientation;
|
*data << m_orientation;
|
||||||
*data << uint32(0);
|
if(GetTypeId() == TYPEID_PLAYER && ((Unit*)this)->hasUnitState(UNIT_STAT_ONVEHICLE))
|
||||||
|
{
|
||||||
|
*data << uint64(((Unit*)this)->GetCharmGUID());
|
||||||
|
*data << float(((Player*)this)->GetTransOffsetX());
|
||||||
|
*data << float(((Player*)this)->GetTransOffsetY());
|
||||||
|
*data << float(((Player*)this)->GetTransOffsetZ());
|
||||||
|
*data << float(((Player*)this)->GetTransOffsetO());
|
||||||
|
*data << uint32(((Player*)this)->GetTransTime());
|
||||||
|
*data << uint8(((Player*)this)->GetTransSeat());
|
||||||
|
}
|
||||||
|
*data << uint32(0); //fall time
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float z, float ang) const
|
void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float z, float ang) const
|
||||||
@@ -1638,6 +1651,16 @@ void WorldObject::BuildTeleportAckMsg(WorldPacket *data, float x, float y, float
|
|||||||
*data << y;
|
*data << y;
|
||||||
*data << z;
|
*data << z;
|
||||||
*data << ang;
|
*data << ang;
|
||||||
|
if(GetTypeId() == TYPEID_PLAYER && ((Unit*)this)->hasUnitState(UNIT_STAT_ONVEHICLE))
|
||||||
|
{
|
||||||
|
*data << uint64(((Unit*)this)->GetCharmGUID());
|
||||||
|
*data << float(((Player*)this)->GetTransOffsetX());
|
||||||
|
*data << float(((Player*)this)->GetTransOffsetY());
|
||||||
|
*data << float(((Player*)this)->GetTransOffsetZ());
|
||||||
|
*data << float(((Player*)this)->GetTransOffsetO());
|
||||||
|
*data << uint32(((Player*)this)->GetTransTime());
|
||||||
|
*data << uint8(((Player*)this)->GetTransSeat());
|
||||||
|
}
|
||||||
*data << uint32(0);
|
*data << uint32(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+35
-34
@@ -19750,37 +19750,31 @@ void Player::EnterVehicle(Vehicle *vehicle)
|
|||||||
|
|
||||||
StopCastingCharm();
|
StopCastingCharm();
|
||||||
StopCastingBindSight();
|
StopCastingBindSight();
|
||||||
|
|
||||||
SetCharm(vehicle, true);
|
SetCharm(vehicle, true);
|
||||||
SetViewpoint(vehicle, true);
|
SetViewpoint(vehicle, true);
|
||||||
SetMover(vehicle);
|
SetMover(vehicle);
|
||||||
|
|
||||||
SetClientControl(vehicle, 1); // redirect controls to vehicle
|
SetClientControl(vehicle, 1); // redirect controls to vehicle
|
||||||
|
|
||||||
|
addUnitState(UNIT_STAT_ONVEHICLE);
|
||||||
|
Relocate(vehicle->GetPositionX(), vehicle->GetPositionY(), vehicle->GetPositionZ(), vehicle->GetOrientation());
|
||||||
|
AddUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
|
||||||
|
m_movementInfo.t_x = veSeat->m_attachmentOffsetX;
|
||||||
|
m_movementInfo.t_y = veSeat->m_attachmentOffsetY;
|
||||||
|
m_movementInfo.t_z = veSeat->m_attachmentOffsetZ;
|
||||||
|
m_movementInfo.t_o = 0;
|
||||||
|
m_movementInfo.t_time = getMSTime();
|
||||||
|
m_movementInfo.t_seat = 0;
|
||||||
|
|
||||||
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
|
||||||
GetSession()->SendPacket(&data);
|
GetSession()->SendPacket(&data);
|
||||||
|
|
||||||
data.Initialize(MSG_MOVE_TELEPORT_ACK, 30);
|
BuildTeleportAckMsg(&data, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
|
||||||
data.append(GetPackGUID());
|
|
||||||
data << uint32(0); // counter?
|
|
||||||
data << uint32(MOVEMENTFLAG_ONTRANSPORT); // transport
|
|
||||||
data << uint16(0); // special flags
|
|
||||||
data << uint32(getMSTime()); // time
|
|
||||||
data << vehicle->GetPositionX(); // x
|
|
||||||
data << vehicle->GetPositionY(); // y
|
|
||||||
data << vehicle->GetPositionZ(); // z
|
|
||||||
data << vehicle->GetOrientation(); // o
|
|
||||||
// transport part, TODO: load/calculate seat offsets
|
|
||||||
data << uint64(vehicle->GetGUID()); // transport guid
|
|
||||||
data << float(veSeat->m_attachmentOffsetX); // transport offsetX
|
|
||||||
data << float(veSeat->m_attachmentOffsetY); // transport offsetY
|
|
||||||
data << float(veSeat->m_attachmentOffsetZ); // transport offsetZ
|
|
||||||
data << float(0); // transport orientation
|
|
||||||
data << uint32(getMSTime()); // transport time
|
|
||||||
data << uint8(0); // seat
|
|
||||||
// end of transport part
|
|
||||||
data << uint32(0); // fall time
|
|
||||||
GetSession()->SendPacket(&data);
|
GetSession()->SendPacket(&data);
|
||||||
|
|
||||||
|
BuildHeartBeatMsg(&data);
|
||||||
|
SendMessageToSet(&data, false);
|
||||||
|
|
||||||
VehicleSpellInitialize();
|
VehicleSpellInitialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -19793,29 +19787,36 @@ void Player::ExitVehicle(Vehicle *vehicle)
|
|||||||
SetCharm(vehicle, false);
|
SetCharm(vehicle, false);
|
||||||
SetViewpoint(vehicle, false);
|
SetViewpoint(vehicle, false);
|
||||||
SetMover(this);
|
SetMover(this);
|
||||||
|
|
||||||
SetClientControl(vehicle, 0);
|
SetClientControl(vehicle, 0);
|
||||||
|
|
||||||
WorldPacket data(MSG_MOVE_TELEPORT_ACK, 30);
|
clearUnitState(UNIT_STAT_ONVEHICLE);
|
||||||
data.append(GetPackGUID());
|
Relocate(vehicle->GetPositionX(), vehicle->GetPositionY(), vehicle->GetPositionZ(), vehicle->GetOrientation());
|
||||||
data << uint32(0); // counter?
|
RemoveUnitMovementFlag(MOVEMENTFLAG_ONTRANSPORT);
|
||||||
data << uint32(MOVEMENTFLAG_FLY_UNK1); // fly unk
|
m_movementInfo.t_x = 0;
|
||||||
data << uint16(0x40); // special flags
|
m_movementInfo.t_y = 0;
|
||||||
data << uint32(getMSTime()); // time
|
m_movementInfo.t_z = 0;
|
||||||
data << vehicle->GetPositionX(); // x
|
m_movementInfo.t_o = 0;
|
||||||
data << vehicle->GetPositionY(); // y
|
m_movementInfo.t_time = 0;
|
||||||
data << vehicle->GetPositionZ(); // z
|
m_movementInfo.t_seat = 0;
|
||||||
data << vehicle->GetOrientation(); // o
|
|
||||||
data << uint32(0); // fall time
|
WorldPacket data;
|
||||||
|
BuildTeleportAckMsg(&data, GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
|
||||||
GetSession()->SendPacket(&data);
|
GetSession()->SendPacket(&data);
|
||||||
|
|
||||||
|
BuildHeartBeatMsg(&data);
|
||||||
|
SendMessageToSet(&data, false);
|
||||||
|
|
||||||
data.Initialize(SMSG_PET_SPELLS, 8+4);
|
data.Initialize(SMSG_PET_SPELLS, 8+4);
|
||||||
data << uint64(0);
|
data << uint64(0);
|
||||||
data << uint32(0);
|
data << uint32(0);
|
||||||
GetSession()->SendPacket(&data);
|
GetSession()->SendPacket(&data);
|
||||||
|
|
||||||
// only for flyable vehicles?
|
// only for flyable vehicles?
|
||||||
CastSpell(this, 45472, true); // Parachute
|
//CastSpell(this, 45472, true); // Parachute
|
||||||
|
|
||||||
|
//if(!vehicle->GetDBTableGUIDLow())
|
||||||
|
if(vehicle->GetOwnerGUID() == GetGUID())
|
||||||
|
vehicle->Dismiss();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::isTotalImmune()
|
bool Player::isTotalImmune()
|
||||||
|
|||||||
+1
-1
@@ -3704,7 +3704,7 @@ SpellCastResult Spell::CheckCast(bool strict)
|
|||||||
return SPELL_FAILED_TARGET_AURASTATE;
|
return SPELL_FAILED_TARGET_AURASTATE;
|
||||||
|
|
||||||
// Not allow casting on flying player
|
// Not allow casting on flying player
|
||||||
if (target->isInFlight())
|
if (target->hasUnitState(UNIT_STAT_UNATTACKABLE))
|
||||||
return SPELL_FAILED_BAD_TARGETS;
|
return SPELL_FAILED_BAD_TARGETS;
|
||||||
|
|
||||||
if(!m_IsTriggeredSpell && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target))
|
if(!m_IsTriggeredSpell && VMAP::VMapFactory::checkSpellForLoS(m_spellInfo->Id) && !m_caster->IsWithinLOSInMap(target))
|
||||||
|
|||||||
@@ -6437,6 +6437,7 @@ void Spell::SummonVehicle(uint32 entry, SummonPropertiesEntry const *properties)
|
|||||||
if(!vehicle)
|
if(!vehicle)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
vehicle->SetOwnerGUID(m_caster->GetGUID());
|
||||||
vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
vehicle->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
|
||||||
|
|
||||||
if(damage)
|
if(damage)
|
||||||
|
|||||||
+5
-5
@@ -517,7 +517,7 @@ void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell)
|
|||||||
|
|
||||||
uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss)
|
uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDamage, DamageEffectType damagetype, SpellSchoolMask damageSchoolMask, SpellEntry const *spellProto, bool durabilityLoss)
|
||||||
{
|
{
|
||||||
if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
//You don't lose health from damage taken from another player while in a sanctuary
|
//You don't lose health from damage taken from another player while in a sanctuary
|
||||||
@@ -1320,7 +1320,7 @@ void Unit::DealSpellDamage(SpellNonMeleeDamage *damageInfo, bool durabilityLoss)
|
|||||||
if(!this || !pVictim)
|
if(!this || !pVictim)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SpellEntry const *spellProto = sSpellStore.LookupEntry(damageInfo->SpellID);
|
SpellEntry const *spellProto = sSpellStore.LookupEntry(damageInfo->SpellID);
|
||||||
@@ -1563,7 +1563,7 @@ void Unit::DealMeleeDamage(CalcDamageInfo *damageInfo, bool durabilityLoss)
|
|||||||
if(!this || !pVictim)
|
if(!this || !pVictim)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!pVictim->isAlive() || pVictim->isInFlight() || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
if (!pVictim->isAlive() || pVictim->hasUnitState(UNIT_STAT_UNATTACKABLE) || pVictim->GetTypeId() == TYPEID_UNIT && ((Creature*)pVictim)->IsInEvadeMode())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//You don't lose health from damage taken from another player while in a sanctuary
|
//You don't lose health from damage taken from another player while in a sanctuary
|
||||||
@@ -9665,7 +9665,7 @@ bool Unit::isAttackableByAOE() const
|
|||||||
if(GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster())
|
if(GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return !isInFlight();
|
return !hasUnitState(UNIT_STAT_UNATTACKABLE);
|
||||||
}
|
}
|
||||||
|
|
||||||
int32 Unit::ModifyHealth(int32 dVal)
|
int32 Unit::ModifyHealth(int32 dVal)
|
||||||
@@ -12784,7 +12784,7 @@ void Unit::SetCharmedOrPossessedBy(Unit* charmer, bool possess)
|
|||||||
if(this == charmer)
|
if(this == charmer)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(isInFlight())
|
if(hasUnitState(UNIT_STAT_UNATTACKABLE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if(GetTypeId() == TYPEID_PLAYER && ((Player*)this)->GetTransport())
|
if(GetTypeId() == TYPEID_PLAYER && ((Player*)this)->GetTransport())
|
||||||
|
|||||||
@@ -422,6 +422,8 @@ enum UnitState
|
|||||||
UNIT_STAT_POSSESSED = 0x00010000,
|
UNIT_STAT_POSSESSED = 0x00010000,
|
||||||
UNIT_STAT_CHARGING = 0x00020000,
|
UNIT_STAT_CHARGING = 0x00020000,
|
||||||
UNIT_STAT_JUMPING = 0x00040000,
|
UNIT_STAT_JUMPING = 0x00040000,
|
||||||
|
UNIT_STAT_ONVEHICLE = 0x00080000,
|
||||||
|
UNIT_STAT_UNATTACKABLE = (UNIT_STAT_IN_FLIGHT | UNIT_STAT_ONVEHICLE),
|
||||||
UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE),
|
UNIT_STAT_MOVING = (UNIT_STAT_ROAMING | UNIT_STAT_CHASE),
|
||||||
UNIT_STAT_CONTROLLED = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING),
|
UNIT_STAT_CONTROLLED = (UNIT_STAT_CONFUSED | UNIT_STAT_STUNNED | UNIT_STAT_FLEEING),
|
||||||
UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONTROLLED | UNIT_STAT_JUMPING | UNIT_STAT_CHARGING),
|
UNIT_STAT_LOST_CONTROL = (UNIT_STAT_CONTROLLED | UNIT_STAT_JUMPING | UNIT_STAT_CHARGING),
|
||||||
|
|||||||
Reference in New Issue
Block a user