mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 16:37:06 +00:00
Over 100 camangos Cata commits applied (to c12950)
Over 100 camangos Cata commits applied. up to and inclusing c12950.
This commit is contained in:
parent
b4ec0440aa
commit
eef77eadb9
117 changed files with 4314 additions and 3547 deletions
|
|
@ -115,7 +115,7 @@ VehicleInfo::VehicleInfo(Unit* owner, VehicleEntry const* vehicleEntry, uint32 o
|
|||
if (IsUsableSeatForCreature(seatEntry->m_flags))
|
||||
m_creatureSeats |= 1 << i;
|
||||
|
||||
if (IsUsableSeatForPlayer(seatEntry->m_flags))
|
||||
if (IsUsableSeatForPlayer(seatEntry->m_flags, seatEntry->m_flagsB))
|
||||
m_playerSeats |= 1 << i;
|
||||
}
|
||||
}
|
||||
|
|
@ -146,6 +146,32 @@ void VehicleInfo::Initialize()
|
|||
summoned->CastCustomSpell((Unit*)m_owner, SPELL_RIDE_VEHICLE_HARDCODED, &basepoint0, NULL, NULL, true);
|
||||
}
|
||||
}
|
||||
|
||||
// Initialize movement limitations
|
||||
uint32 vehicleFlags = GetVehicleEntry()->m_flags;
|
||||
Unit* pVehicle = (Unit*)m_owner;
|
||||
|
||||
if (vehicleFlags & VEHICLE_FLAG_NO_STRAFE)
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_NO_STRAFE);
|
||||
if (vehicleFlags & VEHICLE_FLAG_NO_JUMPING)
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_NO_JUMPING);
|
||||
if (vehicleFlags & VEHICLE_FLAG_FULLSPEEDTURNING)
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_FULLSPEEDTURNING);
|
||||
if (vehicleFlags & VEHICLE_FLAG_ALLOW_PITCHING)
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_ALLOW_PITCHING);
|
||||
if (vehicleFlags & VEHICLE_FLAG_FULLSPEEDPITCHING)
|
||||
pVehicle->m_movementInfo.AddMovementFlags2(MOVEFLAG2_FULLSPEEDPITCHING);
|
||||
|
||||
if (vehicleFlags & VEHICLE_FLAG_FIXED_POSITION)
|
||||
pVehicle->SetRoot(true);
|
||||
|
||||
// Initialize power type based on DBC values (creatures only)
|
||||
if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (PowerDisplayEntry const* powerEntry = sPowerDisplayStore.LookupEntry(GetVehicleEntry()->m_powerDisplayID))
|
||||
pVehicle->SetPowerType(Powers(powerEntry->power));
|
||||
}
|
||||
|
||||
m_isInitialized = true;
|
||||
}
|
||||
|
||||
|
|
@ -304,6 +330,7 @@ void VehicleInfo::UnBoard(Unit* passenger, bool changeVehicle)
|
|||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
pPlayer->ResummonPetTemporaryUnSummonedIfAny();
|
||||
pPlayer->SetFallInformation(0, pPlayer->GetPositionZ());
|
||||
|
||||
// SMSG_PET_DISMISS_SOUND (?)
|
||||
}
|
||||
|
|
@ -473,9 +500,13 @@ uint8 VehicleInfo::GetTakenSeatsMask() const
|
|||
return takenSeatsMask;
|
||||
}
|
||||
|
||||
bool VehicleInfo:: IsUsableSeatForPlayer(uint32 seatFlags) const
|
||||
bool VehicleInfo::IsUsableSeatForPlayer(uint32 seatFlags, uint32 seatFlagsB) const
|
||||
{
|
||||
return seatFlags & SEAT_FLAG_USABLE;
|
||||
return seatFlags & SEAT_FLAG_CAN_EXIT ||
|
||||
seatFlags & SEAT_FLAG_UNCONTROLLED ||
|
||||
seatFlagsB &
|
||||
(SEAT_FLAG_B_USABLE_FORCED | SEAT_FLAG_B_USABLE_FORCED_2 |
|
||||
SEAT_FLAG_B_USABLE_FORCED_3 | SEAT_FLAG_B_USABLE_FORCED_4);
|
||||
}
|
||||
|
||||
/// Add control and such modifiers to a passenger if required
|
||||
|
|
@ -483,10 +514,17 @@ void VehicleInfo::ApplySeatMods(Unit* passenger, uint32 seatFlags)
|
|||
{
|
||||
Unit* pVehicle = (Unit*)m_owner; // Vehicles are alawys Unit
|
||||
|
||||
if (seatFlags & SEAT_FLAG_NOT_SELECTABLE)
|
||||
passenger->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
|
||||
// group update
|
||||
if (pPlayer->GetGroup())
|
||||
pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_VEHICLE_SEAT);
|
||||
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
pPlayer->GetCamera().SetView(pVehicle);
|
||||
|
|
@ -511,10 +549,13 @@ void VehicleInfo::ApplySeatMods(Unit* passenger, uint32 seatFlags)
|
|||
{
|
||||
((Creature*)pVehicle)->SetWalk(true, true);
|
||||
}
|
||||
|
||||
// set vehicle faction as per the controller faction
|
||||
((Creature*)pVehicle)->SetFactionTemporary(pPlayer->getFaction(), TEMPFACTION_NONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (seatFlags & (SEAT_FLAG_USABLE | SEAT_FLAG_CAN_CAST))
|
||||
if (seatFlags & SEAT_FLAG_CAN_CAST)
|
||||
{
|
||||
CharmInfo* charmInfo = pVehicle->InitCharmInfo(pVehicle);
|
||||
charmInfo->InitVehicleCreateSpells();
|
||||
|
|
@ -543,35 +584,47 @@ void VehicleInfo::RemoveSeatMods(Unit* passenger, uint32 seatFlags)
|
|||
{
|
||||
Unit* pVehicle = (Unit*)m_owner;
|
||||
|
||||
if (seatFlags & SEAT_FLAG_NOT_SELECTABLE)
|
||||
passenger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
|
||||
if (passenger->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
Player* pPlayer = (Player*)passenger;
|
||||
|
||||
// group update
|
||||
if (pPlayer->GetGroup())
|
||||
pPlayer->SetGroupUpdateFlag(GROUP_UPDATE_FLAG_VEHICLE_SEAT);
|
||||
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
pPlayer->SetCharm(NULL);
|
||||
pPlayer->SetCharm(nullptr);
|
||||
pVehicle->SetCharmerGuid(ObjectGuid());
|
||||
|
||||
pPlayer->SetClientControl(pVehicle, 0);
|
||||
pPlayer->SetMover(NULL);
|
||||
pPlayer->SetMover(nullptr);
|
||||
|
||||
pVehicle->clearUnitState(UNIT_STAT_CONTROLLED);
|
||||
pVehicle->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
|
||||
|
||||
// must be called after movement control unapplying
|
||||
pPlayer->GetCamera().ResetView();
|
||||
|
||||
// reset vehicle faction
|
||||
if (pVehicle->GetTypeId() == TYPEID_UNIT)
|
||||
((Creature*)pVehicle)->ClearTemporaryFaction();
|
||||
}
|
||||
|
||||
if (seatFlags & (SEAT_FLAG_USABLE | SEAT_FLAG_CAN_CAST))
|
||||
if (seatFlags & SEAT_FLAG_CAN_CAST)
|
||||
pPlayer->RemovePetActionBar();
|
||||
}
|
||||
else if (passenger->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
if (seatFlags & SEAT_FLAG_CAN_CONTROL)
|
||||
{
|
||||
passenger->SetCharm(NULL);
|
||||
passenger->SetCharm(nullptr);
|
||||
pVehicle->SetCharmerGuid(ObjectGuid());
|
||||
}
|
||||
|
||||
// Reinitialize movement
|
||||
((Creature*)passenger)->AI()->SetCombatMovement(true, true);
|
||||
if (!passenger->getVictim())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue