diff options
author | thesensei <aconstantgoal@abv.bg> | 2012-12-05 23:34:50 +0200 |
---|---|---|
committer | thesensei <aconstantgoal@abv.bg> | 2012-12-17 02:54:59 +0200 |
commit | ed4bf13c44c87da3dedc17a5453f7b3185787ffc (patch) | |
tree | f920e654ee1a24e73cf069cd8bd729afa42594cd /src | |
parent | 728ee3e13ca0d0a969bdbd3594b50633097bcdf3 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Creature/Creature.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
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); |