From ed4bf13c44c87da3dedc17a5453f7b3185787ffc Mon Sep 17 00:00:00 2001 From: thesensei Date: Wed, 5 Dec 2012 23:34:50 +0200 Subject: Core/Creature: Update template - reinitialize spell bar for vehicles * update template didn't change spell bar for players if on vehicle that updates it's template, initialize spells was needed * combined with faction changing, since when update is called player faction is ignored and it should be changed to his (based on sniffs) * the idea of this automated check inside fix SAI problems mainly, because there you have nothing to use to reinitialize the bar - closes #5254 --- src/server/game/Entities/Creature/Creature.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src') diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 4600caa63e3..b28295d47ef 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -411,6 +411,16 @@ bool Creature::UpdateEntry(uint32 Entry, uint32 team, const CreatureData* data) SetPvP(false); } + // updates spell bars for vehicles and set player's faction - should be called here, to overwrite faction that is set from the new template + if (IsVehicle()) + { + if (Player* owner = Creature::GetCharmerOrOwnerPlayerOrPlayerItself()) // this check comes in case we don't have a player + { + setFaction(owner->getFaction()); // vehicles should have same as owner faction + owner->VehicleSpellInitialize(); + } + } + // trigger creature is always not selectable and can not be attacked if (isTrigger()) SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); -- cgit v1.2.3