Core/Vehicles: Correct usage of npc_spellclick_spells instead of blatant hacks for vehicle entry.

Note: This may break a few vehicles, but only due to the absence of proper, non-hackish data.
This commit is contained in:
Machiavelli
2011-02-26 23:00:09 +01:00
parent 8497fb27e9
commit 3ac80ee3a4
9 changed files with 179 additions and 58 deletions
+9 -1
View File
@@ -282,7 +282,14 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
if (minion)
accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
accessory->EnterVehicle(this, seatId);
if (!me->HandleSpellClick(accessory, seatId))
{
sLog->outErrorDb("Vehicle entry %u in vehicle_accessory does not have a valid record in npc_spellclick_spells! Calling default EnterVehicle()",
me->GetTypeId() == TYPEID_UNIT ? me->GetEntry() : me->GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID));
accessory->EnterVehicle(this, seatId);
}
// This is not good, we have to send update twice
accessory->SendMovementFlagUpdate();
@@ -358,6 +365,7 @@ bool Vehicle::AddPassenger(Unit *unit, int8 seatId)
if (!me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
ASSERT(false);
// hack: should be done by aura system
if (VehicleScalingInfo const *scalingInfo = sObjectMgr->GetVehicleScalingInfo(m_vehicleInfo->m_ID))
{
Player *plr = unit->ToPlayer();