Fix accessories for vehicle player mounts (the vendors on Traveler's Tundra Mammoth for example)

--HG--
branch : trunk
This commit is contained in:
Shocker
2010-08-24 07:19:29 +03:00
parent fcebd3117a
commit 5e92a8e55a
5 changed files with 15 additions and 3 deletions
+5 -1
View File
@@ -11727,7 +11727,7 @@ float Unit::GetPPMProcChance(uint32 WeaponSpeed, float PPM, const SpellEntry * s
return floor((WeaponSpeed * PPM) / 600.0f); // result is chance in percents (probability = Speed_in_sec * (PPM / 60))
}
void Unit::Mount(uint32 mount, uint32 VehicleId)
void Unit::Mount(uint32 mount, uint32 VehicleId, uint32 creatureEntry)
{
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_MOUNT);
@@ -11759,6 +11759,10 @@ void Unit::Mount(uint32 mount, uint32 VehicleId)
{
GetVehicleKit()->Reset();
// mounts can also have accessories
GetVehicleKit()->GetBase()->SetEntry(creatureEntry); // set creature entry so InstallAllAccessories() can read correct accessories
GetVehicleKit()->InstallAllAccessories();
// Send others that we now have a vehicle
WorldPacket data(SMSG_PLAYER_VEHICLE_DATA, GetPackGUID().size()+4);
data.appendPackGUID(GetGUID());
+1 -1
View File
@@ -1284,7 +1284,7 @@ class Unit : public WorldObject
bool IsMounted() const { return HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_MOUNT); }
uint32 GetMountID() const { return GetUInt32Value(UNIT_FIELD_MOUNTDISPLAYID); }
void Mount(uint32 mount, uint32 vehicleId=0);
void Mount(uint32 mount, uint32 vehicleId = 0, uint32 creatureEntry = 0);
void Unmount();
uint16 GetMaxSkillValueForLevel(Unit const* target = NULL) const { return (target ? getLevelForTarget(target) : getLevel()) * 5; }
@@ -187,6 +187,9 @@ void Vehicle::RemoveAllPassengers()
//ASSERT(!itr->second.passenger);
itr->second.passenger = NULL;
}
// creature passengers mounted on player mounts should be despawned at dismount
if (GetBase()->GetTypeId() == TYPEID_PLAYER && passenger->GetEntry())
passenger->ToCreature()->ForcedDespawn();
}
}
@@ -659,6 +659,11 @@ void WorldSession::HandleEjectPasenger(WorldPacket &data)
data >> guid;
if (Player* Pl=ObjectAccessor::FindPlayer(guid))
Pl->ExitVehicle();
else if (Unit* Un = ObjectAccessor::GetUnit(*_player, guid)) // creatures can be ejected too from player mounts
{
Un->ExitVehicle();
Un->ToCreature()->ForcedDespawn(1000);
}
}
}
}
@@ -3717,7 +3717,7 @@ void AuraEffect::HandleAuraMounted(AuraApplication const * aurApp, uint8 mode, b
if (GetSpellProto()->Effect[i] == SPELL_EFFECT_SUMMON
&& GetSpellProto()->EffectMiscValue[i] == GetMiscValue())
display_id = 0;
target->Mount(display_id,ci->VehicleId);
target->Mount(display_id, ci->VehicleId, GetMiscValue());
}
else
{