aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp54
1 files changed, 26 insertions, 28 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 1afbcbc652b..b19c88ba376 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -4109,6 +4109,10 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
++m_removedAurasCount;
+ if(Aur->IsPersistent())
+ if(DynamicObject *dynObj = ObjectAccessor::GetObjectInWorld(Aur->GetSourceGUID(), (DynamicObject*)NULL))
+ dynObj->RemoveAffected(this);
+
Aur->UnregisterSingleCastAura();
if(Aur->GetSpellProto()->AuraInterruptFlags)
@@ -4428,24 +4432,6 @@ void Unit::RemoveAllDynObjects()
}
}
-DynamicObject * Unit::GetDynObject(uint32 spellId, uint32 effIndex)
-{
- for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
- {
- DynamicObject* dynObj = GetMap()->GetDynamicObject(*i);
- if(!dynObj)
- {
- i = m_dynObjGUIDs.erase(i);
- continue;
- }
-
- if (dynObj->GetSpellId() == spellId && dynObj->GetEffIndex() == effIndex)
- return dynObj;
- ++i;
- }
- return NULL;
-}
-
DynamicObject * Unit::GetDynObject(uint32 spellId)
{
for (DynObjectGUIDs::iterator i = m_dynObjGUIDs.begin(); i != m_dynObjGUIDs.end();)
@@ -14489,17 +14475,12 @@ void Unit::HandleAuraEffect(AuraEffect * aureff, bool apply)
{
if (!aureff->IsApplied())
return;
+
aureff->SetApplied(false);
// remove from list before mods removing (prevent cyclic calls, mods added before including to aura list - use reverse order)
m_modAuras[aureff->GetAuraName()].remove(aureff);
aureff->ApplyModifier(false, true);
- Unit * caster = aureff->GetParentAura()->GetCaster();
- if(caster && aureff->IsPersistent())
- {
- DynamicObject *dynObj = caster->GetDynObject(aureff->GetId(), aureff->GetEffIndex());
- if (dynObj)
- dynObj->RemoveAffected(this);
- }
+
// Remove all triggered by aura spells vs unlimited duration
aureff->CleanupTriggeredSpells();
}
@@ -14844,8 +14825,9 @@ void Unit::ExitVehicle()
BuildHeartBeatMsg(&data);
SendMessageToSet(&data, false);
- if(vehicle->GetBase()->GetOwnerGUID() == GetGUID())
- vehicle->Dismiss();
+ if(vehicle->GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
+ if(((Minion*)vehicle->GetBase())->GetOwner() == this)
+ vehicle->Dismiss();
}
void Unit::BuildMovementPacket(ByteBuffer *data) const
@@ -15069,22 +15051,38 @@ void Unit::RewardRage( uint32 damage, uint32 weaponSpeedHitFactor, bool attacker
ModifyPower(POWER_RAGE, uint32(addRage*10));
}
-void Unit::OutDebugInfo()
+void Unit::OutDebugInfo() const
{
sLog.outError("Unit::OutDebugInfo");
sLog.outString("GUID "UI64FMTD", entry %u, type %u, name %s", GetGUID(), GetEntry(), (uint32)GetTypeId(), GetName());
sLog.outString("OwnerGUID "UI64FMTD", MinionGUID "UI64FMTD", CharmerGUID "UI64FMTD", CharmedGUID "UI64FMTD, GetOwnerGUID(), GetMinionGUID(), GetCharmerGUID(), GetCharmGUID());
+ sLog.outString("In world %u, unit type mask %u", (uint32)(IsInWorld() ? 1 : 0), m_unitTypeMask);
+
sLog.outStringInLine("Summon Slot: ");
for(uint32 i = 0; i < MAX_SUMMON_SLOT; ++i)
sLog.outStringInLine(UI64FMTD", ", m_SummonSlot[i]);
sLog.outString();
+
sLog.outStringInLine("Controlled List: ");
for(ControlList::const_iterator itr = m_Controlled.begin(); itr != m_Controlled.end(); ++itr)
sLog.outStringInLine(UI64FMTD", ", (*itr)->GetGUID());
sLog.outString();
+
sLog.outStringInLine("Aura List: ");
for(AuraMap::const_iterator itr = m_Auras.begin(); itr != m_Auras.end(); ++itr)
sLog.outStringInLine("%u, ", itr->first);
sLog.outString();
+
+ if(IsVehicle())
+ {
+ sLog.outStringInLine("Passenger List: ");
+ for(SeatMap::iterator itr = GetVehicleKit()->m_Seats.begin(); itr != GetVehicleKit()->m_Seats.end(); ++itr)
+ if(Unit *passenger = itr->second.passenger)
+ sLog.outStringInLine(UI64FMTD", ", passenger->GetGUID());
+ sLog.outString();
+ }
+
+ if(GetVehicle())
+ sLog.outString("On vehicle %u.", GetVehicleBase()->GetEntry());
}