Fix code style for commit 9af47a5582b46b1678387c2e58f3b8e4de5ac2fa

This commit is contained in:
H0zen 2016-12-12 08:20:37 +02:00
parent 0b718b6543
commit 96026b6d42
5 changed files with 45 additions and 51 deletions

View File

@ -589,18 +589,17 @@ void Creature::Update(uint32 update_diff, uint32 diff)
} }
case ALIVE: case ALIVE:
{ {
// unsummon pet that lost owner Unit* charmer = GetCharmer();
Unit* charmer = GetCharmer(); if (GetCharmerGuid() && (!charmer || (!IsWithinDistInMap(charmer, GetMap()->GetVisibilityDistance()) &&
if (GetCharmerGuid() && (!charmer || (charmer->GetCharmGuid() == GetObjectGuid()))))
(!IsWithinDistInMap(charmer, GetMap()->GetVisibilityDistance()) && {
(charmer->GetCharmGuid() == GetObjectGuid())))) if (charmer)
{ { charmer->Uncharm(); }
if (charmer) ForcedDespawn();
charmer->Uncharm(); return;
ForcedDespawn(); }
return;
} if (m_aggroDelay <= update_diff)
if (m_aggroDelay <= update_diff)
m_aggroDelay = 0; m_aggroDelay = 0;
else else
m_aggroDelay -= update_diff; m_aggroDelay -= update_diff;
@ -674,10 +673,8 @@ void Creature::RegenerateAll(uint32 update_diff)
if (m_regenTimer != 0) if (m_regenTimer != 0)
{ return; } { return; }
if (!IsInCombat() || IsPolymorphed()) if (!IsInCombat() || IsPolymorphed())
{ { RegenerateHealth(); }
RegenerateHealth();
}
RegeneratePower(); RegeneratePower();
@ -763,15 +760,15 @@ void Creature::RegenerateHealth()
if (GetCharmerOrOwnerGuid()) if (GetCharmerOrOwnerGuid())
{ {
float HealthIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_HEALTH); float HealthIncreaseRate = sWorld.getConfig(CONFIG_FLOAT_RATE_HEALTH);
float Spirit = GetStat(STAT_SPIRIT); float Spirit = GetStat(STAT_SPIRIT); //for charmed creatures, spirit = 0!
if (GetPower(POWER_MANA) > 0) if (GetPower(POWER_MANA) > 0)
{ addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); } { addvalue = uint32(Spirit * 0.25 * HealthIncreaseRate); }
else else
{ addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); } { addvalue = uint32(Spirit * 0.80 * HealthIncreaseRate); }
} }
if (addvalue == 0) if (addvalue == 0)
{ addvalue = maxValue / 3; } { addvalue = maxValue / 3; }
ModifyHealth(addvalue); ModifyHealth(addvalue);
} }

View File

@ -1326,25 +1326,22 @@ void Player::Update(uint32 update_diff, uint32 p_time)
UpdateEnchantTime(update_diff); UpdateEnchantTime(update_diff);
UpdateHomebindTime(update_diff); UpdateHomebindTime(update_diff);
// unsummon pet/charmed that lost owner // unsummon pet/charmed that lost owner
Pet* pet = GetPet(); Pet* pet = GetPet();
if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGuid() && (pet->GetObjectGuid() != GetCharmGuid()))) if (pet && !pet->IsWithinDistInMap(this, GetMap()->GetVisibilityDistance()) && (GetCharmGuid() && (pet->GetObjectGuid() != GetCharmGuid())))
{ { pet->Unsummon(PET_SAVE_REAGENTS, this); }
pet->Unsummon(PET_SAVE_REAGENTS, this);
}
Unit* charmed = GetCharm(); Unit* charmed = GetCharm();
if (charmed && (GetCharmGuid() == charmed->GetObjectGuid()) && if (charmed && (GetCharmGuid() == charmed->GetObjectGuid()) && !IsWithinDistInMap(charmed, GetMap()->GetVisibilityDistance()))
!IsWithinDistInMap(charmed, GetMap()->GetVisibilityDistance())) {
{ Uncharm();
Uncharm(); if(charmed->GetTypeId() == TYPEID_UNIT)
if(charmed->GetTypeId()==TYPEID_UNIT) { ((Creature*)charmed)->ForcedDespawn(); }
((Creature*)charmed)->ForcedDespawn(); }
}
// Group update // Group update
SendUpdateToOutOfRangeGroupMembers(); SendUpdateToOutOfRangeGroupMembers();
if (IsHasDelayedTeleport()) if (IsHasDelayedTeleport())
{ TeleportTo(m_teleport_dest, m_teleport_options); } { TeleportTo(m_teleport_dest, m_teleport_options); }
#ifdef ENABLE_PLAYERBOTS #ifdef ENABLE_PLAYERBOTS

View File

@ -2547,7 +2547,7 @@ void Spell::prepare(SpellCastTargets const* targets, Aura* triggeredByAura)
m_caster->m_Events.AddEvent(Event, m_caster->m_Events.CalculateTime(1)); m_caster->m_Events.AddEvent(Event, m_caster->m_Events.CalculateTime(1));
// Prevent casting at cast another spell (ServerSide check) // Prevent casting at cast another spell (ServerSide check)
if (!m_IsTriggeredSpell && m_caster->IsNonMeleeSpellCasted(false,true, true)) if (!m_IsTriggeredSpell && m_caster->IsNonMeleeSpellCasted(false, true, true))
{ {
SendCastResult(SPELL_FAILED_SPELL_IN_PROGRESS); SendCastResult(SPELL_FAILED_SPELL_IN_PROGRESS);
finish(false); finish(false);

View File

@ -1123,12 +1123,12 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
{ {
// spells required only Real aura add/remove // spells required only Real aura add/remove
if (!Real) if (!Real)
{ return; } { return; }
Unit* target = GetTarget(); Unit* target = GetTarget();
if (!target || !target->IsAlive()) if (!target || !target->IsAlive())
{ return; } { return; }
// AT APPLY // AT APPLY
if (apply) if (apply)
@ -2219,11 +2219,11 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
void Aura::HandleModCharm(bool apply, bool Real) void Aura::HandleModCharm(bool apply, bool Real)
{ {
if (!Real) if (!Real)
{ return; } { return; }
Unit* target = GetTarget(); Unit* target = GetTarget();
if (!target || !target->IsAlive()) if (!target || !target->IsAlive())
{ return; } { return; }
// not charm yourself // not charm yourself
if (GetCasterGuid() == target->GetObjectGuid()) if (GetCasterGuid() == target->GetObjectGuid())
@ -2280,10 +2280,10 @@ void Aura::HandleModCharm(bool apply, bool Real)
} }
} }
else if (Player *plTarget = target->ToPlayer()) else if (Player *plTarget = target->ToPlayer())
plTarget->SetClientControl(plTarget, 0); { plTarget->SetClientControl(plTarget, 0); }
if (caster->GetTypeId() == TYPEID_PLAYER) if (caster->GetTypeId() == TYPEID_PLAYER)
{ ((Player*)caster)->CharmSpellInitialize(); } { ((Player*)caster)->CharmSpellInitialize(); }
} }
else else
{ {
@ -5676,13 +5676,13 @@ void SpellAuraHolder::UpdateAuraDuration()
if (GetAuraSlot() >= MAX_AURAS || m_isPassive) if (GetAuraSlot() >= MAX_AURAS || m_isPassive)
{ return; } { return; }
if (m_target->GetTypeId() == TYPEID_PLAYER) if (m_target->GetTypeId() == TYPEID_PLAYER)
{ {
WorldPacket data(SMSG_UPDATE_AURA_DURATION, 5); WorldPacket data(SMSG_UPDATE_AURA_DURATION, 5);
data << uint8(GetAuraSlot()); data << uint8(GetAuraSlot());
data << uint32(GetAuraDuration()); data << uint32(GetAuraDuration());
((Player*)m_target)->SendDirectMessage(&data); ((Player*)m_target)->SendDirectMessage(&data);
} }
// not send in case player loading (will not work anyway until player not added to map), sent in visibility change code // not send in case player loading (will not work anyway until player not added to map), sent in visibility change code
if (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading()) if (m_target->GetTypeId() == TYPEID_PLAYER && ((Player*)m_target)->GetSession()->PlayerLoading())

View File

@ -662,8 +662,8 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)
return; return;
} }
case 15998: // Capture Worg Pup case 15998: // Capture Worg Pup
case 19614: // Despawn Caster case 19614: // Despawn Caster
{ {
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT) if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT)
{ return; } { return; }