[11385] Add support for static vehicle spawns

Signed-off-by: zergtmn <zerg@myisp.com>
This commit is contained in:
zergtmn 2011-04-20 23:23:47 +06:00
parent 75e1e7c3a3
commit 2835aa5f20
32 changed files with 115 additions and 331 deletions

View file

@ -26,7 +26,6 @@
#include "WorldPacket.h"
#include "WorldSession.h"
#include "UpdateMask.h"
#include "Vehicle.h"
#include "SkillDiscovery.h"
#include "QuestDef.h"
#include "GossipDef.h"
@ -8087,6 +8086,7 @@ void Player::SendLoot(ObjectGuid guid, LootType loot_type)
break;
}
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
{
Creature *creature = GetMap()->GetCreature(guid);
@ -14725,7 +14725,7 @@ void Player::KilledMonsterCredit( uint32 entry, ObjectGuid guid )
void Player::CastedCreatureOrGO( uint32 entry, ObjectGuid guid, uint32 spell_id, bool original_caster )
{
bool isCreature = guid.IsCreature();
bool isCreature = guid.IsCreatureOrVehicle();
uint32 addCastCount = 1;
for(int i = 0; i < MAX_QUEST_LOG_SIZE; ++i)
@ -21323,98 +21323,6 @@ void Player::ApplyGlyphs(bool apply)
ApplyGlyph(i,apply);
}
void Player::EnterVehicle(Vehicle *vehicle)
{
VehicleEntry const *ve = sVehicleStore.LookupEntry(vehicle->GetVehicleId());
if(!ve)
return;
VehicleSeatEntry const *veSeat = sVehicleSeatStore.LookupEntry(ve->m_seatID[0]);
if(!veSeat)
return;
vehicle->SetCharmerGuid(GetObjectGuid());
vehicle->RemoveFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
vehicle->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
vehicle->setFaction(getFaction());
SetCharm(vehicle); // charm
m_camera.SetView(vehicle); // set view
SetClientControl(vehicle, 1); // redirect controls to vehicle
SetMover(vehicle);
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
GetSession()->SendPacket(&data);
data.Initialize(MSG_MOVE_TELEPORT_ACK, 30);
data << GetPackGUID();
data << uint32(0); // counter?
data << uint32(MOVEFLAG_ONTRANSPORT); // transport
data << uint16(0); // special flags
data << uint32(WorldTimer::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 << vehicle->GetObjectGuid(); // 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(WorldTimer::getMSTime()); // transport time
data << uint8(0); // seat
// end of transport part
data << uint32(0); // fall time
GetSession()->SendPacket(&data);
data.Initialize(SMSG_PET_SPELLS, 8+2+4+4+4*MAX_UNIT_ACTION_BAR_INDEX+1+1);
data << vehicle->GetObjectGuid();
data << uint16(0);
data << uint32(0);
data << uint32(0x00000101);
for(uint32 i = 0; i < 10; ++i)
data << uint16(0) << uint8(0) << uint8(i+8);
data << uint8(0);
data << uint8(0);
GetSession()->SendPacket(&data);
}
void Player::ExitVehicle(Vehicle *vehicle)
{
vehicle->SetCharmerGuid(ObjectGuid());
vehicle->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
vehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
vehicle->setFaction((GetTeam() == ALLIANCE) ? vehicle->GetCreatureInfo()->faction_A : vehicle->GetCreatureInfo()->faction_H);
SetCharm(NULL);
m_camera.ResetView();
SetClientControl(vehicle, 0);
SetMover(NULL);
WorldPacket data(MSG_MOVE_TELEPORT_ACK, 30);
data << GetPackGUID();
data << uint32(0); // counter?
data << uint32(MOVEFLAG_ROOT); // fly unk
data << uint16(MOVEFLAG2_UNK4); // special flags
data << uint32(WorldTimer::getMSTime()); // time
data << vehicle->GetPositionX(); // x
data << vehicle->GetPositionY(); // y
data << vehicle->GetPositionZ(); // z
data << vehicle->GetOrientation(); // o
data << uint32(0); // fall time
GetSession()->SendPacket(&data);
RemovePetActionBar();
// maybe called at dummy aura remove?
// CastSpell(this, 45472, true); // Parachute
}
bool Player::isTotalImmune()
{
AuraList const& immune = GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);
@ -22795,6 +22703,7 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask)
return GetMap()->GetGameObject(guid);
break;
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
if ((typemask & TYPEMASK_UNIT) && IsInWorld())
return GetMap()->GetCreature(guid);
break;
@ -22802,10 +22711,6 @@ Object* Player::GetObjectByTypeMask(ObjectGuid guid, TypeMask typemask)
if ((typemask & TYPEMASK_UNIT) && IsInWorld())
return GetMap()->GetPet(guid);
break;
case HIGHGUID_VEHICLE:
if ((typemask & TYPEMASK_UNIT) && IsInWorld())
return GetMap()->GetVehicle(guid);
break;
case HIGHGUID_DYNAMICOBJECT:
if ((typemask & TYPEMASK_DYNAMICOBJECT) && IsInWorld())
return GetMap()->GetDynamicObject(guid);