diff --git a/src/server/game/Entities/Creature/Creature.cpp b/src/server/game/Entities/Creature/Creature.cpp index 374a3c5001..de14e8641b 100644 --- a/src/server/game/Entities/Creature/Creature.cpp +++ b/src/server/game/Entities/Creature/Creature.cpp @@ -239,6 +239,8 @@ void Creature::AddToWorld() TC_LOG_DEBUG("entities.unit", "Adding creature %u with entry %u and DBGUID %u to world in map %u", GetGUID().GetCounter(), GetEntry(), m_spawnId, GetMap()->GetId()); + UpdatePowerRegeneration(GetPowerType()); + Unit::AddToWorld(); SearchFormation(); AIM_Initialize(); @@ -247,8 +249,6 @@ void Creature::AddToWorld() if (GetZoneScript()) GetZoneScript()->OnCreatureCreate(this); - - UpdatePowerRegeneration(GetPowerType()); } } diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp index 106c1f89e3..9b57a2b071 100644 --- a/src/server/game/Entities/Creature/TemporarySummon.cpp +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp @@ -194,7 +194,7 @@ void TempSummon::InitStats(uint32 duration) owner->m_SummonSlot[slot] = GetGUID(); } - if (m_Properties->Control == SUMMON_CATEGORY_ALLY || m_Properties->Control == SUMMON_CATEGORY_PET || m_Properties->Control == SUMMON_CATEGORY_VEHICLE) + if (m_Properties->Control != SUMMON_CATEGORY_WILD) { if (!m_Properties->Faction) SetFaction(owner->GetFaction()); @@ -317,10 +317,10 @@ void Minion::InitStats(uint32 duration) TempSummon::InitStats(duration); SetReactState(REACT_PASSIVE); - // Only controlable guardians and companions get a owner guid - if (HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) || (m_Properties && m_Properties->Title == AsUnderlyingType(SummonTitle::Companion))) + // Controlable guardians and minions shall receive a summoner guid + if ((IsMinion() || IsControlableGuardian()) && !IsTotem() && !IsVehicle()) GetOwner()->SetMinion(this, true); - else if (!HasUnitTypeMask(UNIT_MASK_PET | UNIT_MASK_HUNTER_PET)) + else if (!IsPet() && !IsHunterPet()) { GetOwner()->m_Controlled.insert(this); @@ -345,9 +345,9 @@ void Minion::RemoveFromWorld() Unit* owner = GetOwner(); - if (HasUnitTypeMask(UNIT_MASK_CONTROLABLE_GUARDIAN) || (m_Properties && m_Properties->Title == AsUnderlyingType(SummonTitle::Companion))) + if ((IsMinion() || IsControlableGuardian()) && !IsTotem() && !IsVehicle()) owner->SetMinion(this, false); - else if (!HasUnitTypeMask(UNIT_MASK_PET | UNIT_MASK_HUNTER_PET)) + else if (!IsPet() && !IsHunterPet()) { if (owner->m_Controlled.find(this) != owner->m_Controlled.end()) owner->m_Controlled.erase(this); diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp index 4f24f5cb62..38a38ea55a 100644 --- a/src/server/game/Entities/Unit/Unit.cpp +++ b/src/server/game/Entities/Unit/Unit.cpp @@ -6226,7 +6226,7 @@ void Unit::SetMinion(Minion* minion, bool apply) continue; //ASSERT((*itr)->GetOwnerGUID() == GetGUID()); - if (controlled->GetOwnerGUID() != GetGUID()) + if (controlled->GetOwnerOrCreatorGUID() != GetGUID()) { OutDebugInfo(); controlled->OutDebugInfo(); diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h index 4a3d0d7d28..5b2653f631 100644 --- a/src/server/game/Entities/Unit/Unit.h +++ b/src/server/game/Entities/Unit/Unit.h @@ -1068,6 +1068,7 @@ class TC_GAME_API Unit : public WorldObject bool IsHunterPet() const{ return (m_unitTypeMask & UNIT_MASK_HUNTER_PET) != 0; } bool IsTotem() const { return (m_unitTypeMask & UNIT_MASK_TOTEM) != 0; } bool IsVehicle() const { return (m_unitTypeMask & UNIT_MASK_VEHICLE) != 0; } + bool IsControlableGuardian() const { return (m_unitTypeMask & UNIT_MASK_CONTROLABLE_GUARDIAN) != 0; } uint8 getLevel() const { return uint8(GetUInt32Value(UNIT_FIELD_LEVEL)); } uint8 getLevelForTarget(WorldObject const* /*target*/) const override { return getLevel(); } diff --git a/src/server/game/Entities/Vehicle/Vehicle.cpp b/src/server/game/Entities/Vehicle/Vehicle.cpp index 8b73fbad41..fc7bbb282d 100644 --- a/src/server/game/Entities/Vehicle/Vehicle.cpp +++ b/src/server/game/Entities/Vehicle/Vehicle.cpp @@ -93,7 +93,6 @@ void Vehicle::Install() case POWER_ELECTRICAL_ENERGY: case POWER_ARCANE_ENERGY_2: case POWER_FUEL: - case POWER_SUN_POWER: case POWER_TWILIGHT_ENERGY: case POWER_PYRITE: _me->SetFullPower(POWER_ENERGY); diff --git a/src/server/scripts/EasternKingdoms/zone_hillsbrad_foothills.cpp b/src/server/scripts/EasternKingdoms/zone_hillsbrad_foothills.cpp index d5696745d8..e303122101 100644 --- a/src/server/scripts/EasternKingdoms/zone_hillsbrad_foothills.cpp +++ b/src/server/scripts/EasternKingdoms/zone_hillsbrad_foothills.cpp @@ -293,7 +293,6 @@ struct npc_brazie_the_bonatist_vehicle : public VehicleAI { PhasingHandler::AddPhase(passenger, PHASE_ID_QUEST, true); passenger->CastSpell(passenger, SPELL_PROGRESS_BAR, true); - me->SetPower(POWER_ENERGY, 0); SetupSpawns(); } else