diff options
| author | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-12-20 17:39:13 +0100 | 
|---|---|---|
| committer | Vincent_Michael <Vincent_Michael@gmx.de> | 2013-12-20 17:39:13 +0100 | 
| commit | 8658b5338c905c79daf50cb56dbe739f82d25acc (patch) | |
| tree | ebb2c18b6d9618ac9fef1d2c5f8b335f34d3702c /src/server/game/Spells/SpellEffects.cpp | |
| parent | 59fd1a164fc38ddd282707b3221dcd64af284166 (diff) | |
| parent | 9ac96fd702d8ed23491d13eda2238312120cf52f (diff) | |
Merge branch 'master' of github.com:TrinityCore/TrinityCore into mmaps_rw
Conflicts:
	src/server/collision/Management/MMapManager.cpp
	src/server/game/Maps/Map.cpp
	src/server/game/Movement/PathGenerator.cpp
Diffstat (limited to 'src/server/game/Spells/SpellEffects.cpp')
| -rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 143 | 
1 files changed, 83 insertions, 60 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index e580a3d0f2d..6e2bc0c76e1 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -235,7 +235,7 @@ pEffect SpellEffects[TOTAL_SPELL_EFFECTS]=  void Spell::EffectNULL(SpellEffIndex /*effIndex*/)  { -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "WORLD: Spell Effect DUMMY"); +    TC_LOG_DEBUG("spells", "WORLD: Spell Effect DUMMY");  }  void Spell::EffectUnused(SpellEffIndex /*effIndex*/) @@ -767,7 +767,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)          if (!spellInfo)          { -            TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id); +            TC_LOG_ERROR("spells", "EffectDummy of spell %u: triggering unknown spell id %i\n", m_spellInfo->Id, spell_id);              return;          } @@ -785,7 +785,7 @@ void Spell::EffectDummy(SpellEffIndex effIndex)      }      // normal DB scripted effect -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, effIndex); +    TC_LOG_DEBUG("spells", "Spell ScriptStart spellid %u in EffectDummy(%u)", m_spellInfo->Id, effIndex);      m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget);      // Script based implementation. Must be used only for not good for implementation in core spell effects @@ -910,7 +910,7 @@ void Spell::EffectTriggerSpell(SpellEffIndex effIndex)      SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id);      if (!spellInfo)      { -        TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTriggerSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); +        TC_LOG_DEBUG("spells", "Spell::EffectTriggerSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id);          return;      } @@ -962,7 +962,7 @@ void Spell::EffectTriggerMissileSpell(SpellEffIndex effIndex)      SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(triggered_spell_id);      if (!spellInfo)      { -        TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTriggerMissileSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id); +        TC_LOG_DEBUG("spells", "Spell::EffectTriggerMissileSpell spell %u tried to trigger unknown spell %u", m_spellInfo->Id, triggered_spell_id);          return;      } @@ -1018,7 +1018,7 @@ void Spell::EffectForceCast(SpellEffIndex effIndex)      if (!spellInfo)      { -        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); +        TC_LOG_ERROR("spells", "Spell::EffectForceCast of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);          return;      } @@ -1066,7 +1066,7 @@ void Spell::EffectTriggerRitualOfSummoning(SpellEffIndex effIndex)      if (!spellInfo)      { -        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id); +        TC_LOG_ERROR("spells", "EffectTriggerRitualOfSummoning of spell %u: triggering unknown spell id %i", m_spellInfo->Id, triggered_spell_id);          return;      } @@ -1136,7 +1136,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)      // If not exist data for dest location - return      if (!m_targets.HasDst())      { -        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - does not have destination for spellId %u.", m_spellInfo->Id); +        TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - does not have destination for spellId %u.", m_spellInfo->Id);          return;      } @@ -1148,7 +1148,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)      destTarget->GetPosition(x, y, z, orientation);      if (!orientation && m_targets.GetUnitTarget())          orientation = m_targets.GetUnitTarget()->GetOrientation(); -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation); +    TC_LOG_DEBUG("spells", "Spell::EffectTeleportUnits - teleport unit to %u %f %f %f %f\n", mapid, x, y, z, orientation);      if (unitTarget->GetTypeId() == TYPEID_PLAYER)          unitTarget->ToPlayer()->TeleportTo(mapid, x, y, z, orientation, unitTarget == m_caster ? TELE_TO_SPELL : 0); @@ -1156,7 +1156,7 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)          unitTarget->NearTeleportTo(x, y, z, orientation, unitTarget == m_caster);      else      { -        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id); +        TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id);          return;      } @@ -1292,7 +1292,7 @@ void Spell::EffectUnlearnSpecialization(SpellEffIndex effIndex)      player->removeSpell(spellToUnlearn); -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell: Player %u has unlearned spell %u from NpcGUID: %u", player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow()); +    TC_LOG_DEBUG("spells", "Spell: Player %u has unlearned spell %u from NpcGUID: %u", player->GetGUIDLow(), spellToUnlearn, m_caster->GetGUIDLow());  }  void Spell::EffectPowerDrain(SpellEffIndex effIndex) @@ -1364,7 +1364,7 @@ void Spell::EffectSendEvent(SpellEffIndex effIndex)          /// @todo there should be a possibility to pass dest target to event script      } -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id); +    TC_LOG_DEBUG("spells", "Spell ScriptStart %u for spellid %u in EffectSendEvent ", m_spellInfo->Effects[effIndex].MiscValue, m_spellInfo->Id);      if (ZoneScript* zoneScript = m_caster->GetZoneScript())          zoneScript->ProcessEvent(target, m_spellInfo->Effects[effIndex].MiscValue); @@ -1467,7 +1467,7 @@ void Spell::EffectHeal(SpellEffIndex /*effIndex*/)              if (!targetAura)              { -                TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID()); +                TC_LOG_ERROR("spells", "Target(GUID:" UI64FMTD ") has aurastate AURA_STATE_SWIFTMEND but no matching aura.", unitTarget->GetGUID());                  return;              } @@ -1572,7 +1572,7 @@ void Spell::EffectHealthLeech(SpellEffIndex effIndex)      damage = m_caster->SpellDamageBonusDone(unitTarget, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE);      damage = unitTarget->SpellDamageBonusTaken(m_caster, m_spellInfo, uint32(damage), SPELL_DIRECT_DAMAGE); -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "HealthLeech :%i", damage); +    TC_LOG_DEBUG("spells", "HealthLeech :%i", damage);      float healMultiplier = m_spellInfo->Effects[effIndex].CalcValueMultiplier(m_originalCaster, this); @@ -1937,7 +1937,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype)          // Players shouldn't be able to loot gameobjects that are currently despawned          if (!gameObjTarget->isSpawned() && !player->IsGameMaster())          { -            TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!", +            TC_LOG_ERROR("spells", "Possible hacking attempt: Player %s [guid: %u] tried to loot a gameobject [entry: %u id: %u] which is on respawn time without being in GM mode!",                              player->GetName().c_str(), player->GetGUIDLow(), gameObjTarget->GetEntry(), gameObjTarget->GetGUIDLow());              return;          } @@ -1976,7 +1976,7 @@ void Spell::SendLoot(uint64 guid, LootType loottype)                  /// @todo possible must be moved to loot release (in different from linked triggering)                  if (gameObjTarget->GetGOInfo()->chest.eventId)                  { -                    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Chest ScriptStart id %u for GO %u", gameObjTarget->GetGOInfo()->chest.eventId, gameObjTarget->GetDBTableGUIDLow()); +                    TC_LOG_DEBUG("spells", "Chest ScriptStart id %u for GO %u", gameObjTarget->GetGOInfo()->chest.eventId, gameObjTarget->GetDBTableGUIDLow());                      player->GetMap()->ScriptsStart(sEventScripts, gameObjTarget->GetGOInfo()->chest.eventId, player, gameObjTarget);                  } @@ -2001,7 +2001,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)      if (m_caster->GetTypeId() != TYPEID_PLAYER)      { -        TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "WORLD: Open Lock - No Player Caster!"); +        TC_LOG_DEBUG("spells", "WORLD: Open Lock - No Player Caster!");          return;      } @@ -2057,7 +2057,7 @@ void Spell::EffectOpenLock(SpellEffIndex effIndex)      }      else      { -        TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "WORLD: Open Lock - No GameObject/Item Target!"); +        TC_LOG_DEBUG("spells", "WORLD: Open Lock - No GameObject/Item Target!");          return;      } @@ -2236,7 +2236,7 @@ void Spell::EffectSummonType(SpellEffIndex effIndex)      SummonPropertiesEntry const* properties = sSummonPropertiesStore.LookupEntry(m_spellInfo->Effects[effIndex].MiscValueB);      if (!properties)      { -        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB); +        TC_LOG_ERROR("spells", "EffectSummonType: Unhandled summon type %u", m_spellInfo->Effects[effIndex].MiscValueB);          return;      } @@ -2423,7 +2423,7 @@ void Spell::EffectLearnSpell(SpellEffIndex effIndex)      uint32 spellToLearn = (m_spellInfo->Id == 483 || m_spellInfo->Id == 55884) ? damage : m_spellInfo->Effects[effIndex].TriggerSpell;      player->learnSpell(spellToLearn, false); -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow()); +    TC_LOG_DEBUG("spells", "Spell: Player %u has learned spell %u from NpcGUID=%u", player->GetGUIDLow(), spellToLearn, m_caster->GetGUIDLow());  }  typedef std::list< std::pair<uint32, uint64> > DispelList; @@ -2669,7 +2669,7 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)      if (m_CastItem)      {          unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage/10); -        TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUIDLow()); +        TC_LOG_DEBUG("spells", "SpellEffect::AddHonor (spell_id %u) rewards %d honor points (item %u) for player: %u", m_spellInfo->Id, damage/10, m_CastItem->GetEntry(), unitTarget->ToPlayer()->GetGUIDLow());          return;      } @@ -2678,13 +2678,13 @@ void Spell::EffectAddHonor(SpellEffIndex /*effIndex*/)      {          uint32 honor_reward = Trinity::Honor::hk_honor_at_level(unitTarget->getLevel(), float(damage));          unitTarget->ToPlayer()->RewardHonor(NULL, 1, honor_reward); -        TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow()); +        TC_LOG_DEBUG("spells", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (scale) to player: %u", m_spellInfo->Id, honor_reward, unitTarget->ToPlayer()->GetGUIDLow());      }      else      {          //maybe we have correct honor_gain in damage already          unitTarget->ToPlayer()->RewardHonor(NULL, 1, damage); -        TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow()); +        TC_LOG_DEBUG("spells", "SpellEffect::AddHonor (spell_id %u) rewards %u honor points (non scale) for player: %u", m_spellInfo->Id, damage, unitTarget->ToPlayer()->GetGUIDLow());      }  } @@ -2797,7 +2797,7 @@ void Spell::EffectEnchantItemPrismatic(SpellEffIndex effIndex)          }          if (!add_socket)          { -            TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.", +            TC_LOG_ERROR("spells", "Spell::EffectEnchantItemPrismatic: attempt apply enchant spell %u with SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC (%u) but without ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET (%u), not suppoted yet.",                  m_spellInfo->Id, SPELL_EFFECT_ENCHANT_ITEM_PRISMATIC, ITEM_ENCHANTMENT_TYPE_PRISMATIC_SOCKET);              return;          } @@ -2862,14 +2862,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)              case 10: spell_id = 36758; break;               // 14%              case 11: spell_id = 36760; break;               // 20%              default: -                TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage); +                TC_LOG_ERROR("spells", "Spell::EffectEnchantItemTmp: Damage %u not handled in S'RW", damage);                  return;          }          SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spell_id);          if (!spellInfo)          { -            TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id); +            TC_LOG_ERROR("spells", "Spell::EffectEnchantItemTmp: unknown spell id %i", spell_id);              return;          } @@ -2896,14 +2896,14 @@ void Spell::EffectEnchantItemTmp(SpellEffIndex effIndex)      if (!enchant_id)      { -        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex); +        TC_LOG_ERROR("spells", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have 0 as enchanting id", m_spellInfo->Id, effIndex);          return;      }      SpellItemEnchantmentEntry const* pEnchant = sSpellItemEnchantmentStore.LookupEntry(enchant_id);      if (!pEnchant)      { -        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id); +        TC_LOG_ERROR("spells", "Spell %u Effect %u (SPELL_EFFECT_ENCHANT_ITEM_TEMPORARY) have not existed enchanting id %u ", m_spellInfo->Id, effIndex, enchant_id);          return;      } @@ -4023,7 +4023,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)                          case 31893: spell_heal = 48084; break;                          case 31883: spell_heal = 48085; break;                          default: -                            TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Unknown Lightwell spell caster %u", m_caster->GetEntry()); +                            TC_LOG_ERROR("spells", "Unknown Lightwell spell caster %u", m_caster->GetEntry());                              return;                      } @@ -4121,7 +4121,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)                      case 57774: spellId1 = 20185; break;    // Judgement of Light                      case 53408: spellId1 = 20186; break;    // Judgement of Wisdom                      default: -                        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id); +                        TC_LOG_ERROR("spells", "Unsupported Judgement (seal trigger) spell (Id: %u) in Spell::EffectScriptEffect", m_spellInfo->Id);                          return;                  }                  // all seals have aura dummy in 2 effect @@ -4185,7 +4185,7 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)      }      // normal DB scripted effect -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell ScriptStart spellid %u in EffectScriptEffect(%u)", m_spellInfo->Id, effIndex); +    TC_LOG_DEBUG("spells", "Spell ScriptStart spellid %u in EffectScriptEffect(%u)", m_spellInfo->Id, effIndex);      m_caster->GetMap()->ScriptsStart(sSpellScripts, uint32(m_spellInfo->Id | (effIndex << 24)), m_caster, unitTarget);  } @@ -4340,8 +4340,8 @@ void Spell::EffectStuck(SpellEffIndex /*effIndex*/)      if (!player)          return; -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Spell Effect: Stuck"); -    TC_LOG_INFO(LOG_FILTER_SPELLS_AURAS, "Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", player->GetName().c_str(), player->GetGUIDLow(), player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ()); +    TC_LOG_DEBUG("spells", "Spell Effect: Stuck"); +    TC_LOG_INFO("spells", "Player %s (guid %u) used auto-unstuck future at map %u (%f, %f, %f)", player->GetName().c_str(), player->GetGUIDLow(), player->GetMapId(), player->GetPositionX(), player->GetPositionY(), player->GetPositionZ());      if (player->IsInFlight())          return; @@ -5055,28 +5055,43 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/)      if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)          return; -    Player* player = m_caster->ToPlayer(); -    if (!player) +    if (damage < 0)          return; -    Pet* pet = player->GetPet(); -    if (pet && pet->IsAlive()) +    Player* player = m_caster->ToPlayer(); +    if (!player)          return; -    if (damage < 0) -        return; -    float x, y, z; -    player->GetPosition(x, y, z); -    if (!pet) +    // Maybe player dismissed dead pet or pet despawned? +    bool hadPet = true; +    if (!player->GetPet())      { -        player->SummonPet(0, x, y, z, player->GetOrientation(), SUMMON_PET, 0); -        pet = player->GetPet(); +        // Position passed to SummonPet is irrelevant with current implementation, +        // pet will be relocated without using these coords in Pet::LoadPetFromDB +        player->SummonPet(0, 0.0f, 0.0f, 0.0f, 0.0f, SUMMON_PET, 0); +        hadPet = false;      } + +    // TODO: Better to fail Hunter's "Revive Pet" at cast instead of here when casting ends +    Pet* pet = player->GetPet(); // Attempt to get current pet      if (!pet)          return; -    player->GetMap()->CreatureRelocation(pet, x, y, z, player->GetOrientation()); +    // TODO: Better to fail Hunter's "Revive Pet" at cast instead of here when casting ends +    if (pet->IsAlive()) +        return; + +    // If player did have a pet before reviving, teleport it +    if (hadPet) +    { +        // Reposition the pet's corpse before reviving so as not to grab aggro +        // We can use a different, more accurate version of GetClosePoint() since we have a pet +        float x, y, z; // Will be used later to reposition the pet if we have one +        player->GetClosePoint(x, y, z, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle()); +        pet->NearTeleportTo(x, y, z, player->GetOrientation()); +        pet->Relocate(x, y, z, player->GetOrientation()); // This is needed so SaveStayPosition() will get the proper coords. +    }      pet->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_NONE);      pet->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_SKINNABLE); @@ -5084,8 +5099,20 @@ void Spell::EffectSummonDeadPet(SpellEffIndex /*effIndex*/)      pet->ClearUnitState(uint32(UNIT_STATE_ALL_STATE));      pet->SetHealth(pet->CountPctFromMaxHealth(damage)); -    //pet->AIM_Initialize(); -    //player->PetSpellInitialize(); +    // Reset things for when the AI to takes over +    CharmInfo *ci = pet->GetCharmInfo(); +    if (ci) +    { +        // In case the pet was at stay, we don't want it running back +        ci->SaveStayPosition(); +        ci->SetIsAtStay(ci->HasCommandState(COMMAND_STAY)); + +        ci->SetIsFollowing(false); +        ci->SetIsCommandAttack(false); +        ci->SetIsCommandFollow(false); +        ci->SetIsReturning(false); +    } +      pet->SavePetToDB(PET_SAVE_AS_CURRENT);  } @@ -5198,7 +5225,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)      if (!goinfo)      { -        TC_LOG_ERROR(LOG_FILTER_SQL, "Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id); +        TC_LOG_ERROR("sql.sql", "Gameobject (Entry: %u) not exist and not created at spell (ID: %u) cast", name_id, m_spellInfo->Id);          return;      } @@ -5286,7 +5313,7 @@ void Spell::EffectTransmitted(SpellEffIndex effIndex)      ExecuteLogEffectSummonObject(effIndex, pGameObj); -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "AddObject at SpellEfects.cpp EffectTransmitted"); +    TC_LOG_DEBUG("spells", "AddObject at SpellEfects.cpp EffectTransmitted");      //m_caster->AddGameObject(pGameObj);      //m_ObjToDel.push_back(pGameObj); @@ -5371,7 +5398,7 @@ void Spell::EffectSkill(SpellEffIndex /*effIndex*/)      if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT)          return; -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "WORLD: SkillEFFECT"); +    TC_LOG_DEBUG("spells", "WORLD: SkillEFFECT");  }  /* There is currently no need for this effect. We handle it in Battleground.cpp @@ -5402,7 +5429,7 @@ void Spell::EffectSkinPlayerCorpse(SpellEffIndex /*effIndex*/)      if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)          return; -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Effect: SkinPlayerCorpse"); +    TC_LOG_DEBUG("spells", "Effect: SkinPlayerCorpse");      Player* player = m_caster->ToPlayer();      Player* target = unitTarget->ToPlayer(); @@ -5417,7 +5444,7 @@ void Spell::EffectStealBeneficialBuff(SpellEffIndex effIndex)      if (effectHandleMode != SPELL_EFFECT_HANDLE_HIT_TARGET)          return; -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "Effect: StealBeneficialBuff"); +    TC_LOG_DEBUG("spells", "Effect: StealBeneficialBuff");      if (!unitTarget || unitTarget == m_caster)                 // can't steal from self          return; @@ -5568,12 +5595,8 @@ void Spell::EffectQuestStart(SpellEffIndex effIndex)      Player* player = unitTarget->ToPlayer();      if (Quest const* qInfo = sObjectMgr->GetQuestTemplate(m_spellInfo->Effects[effIndex].MiscValue)) -    {          if (player->CanTakeQuest(qInfo, false) && player->CanAddQuest(qInfo, false)) -        { -            player->AddQuest(qInfo, NULL); -        } -    } +            player->AddQuestAndCheckCompletion(qInfo, NULL);  }  void Spell::EffectActivateRune(SpellEffIndex effIndex) @@ -5832,7 +5855,7 @@ void Spell::EffectPlayMusic(SpellEffIndex effIndex)      if (!sSoundEntriesStore.LookupEntry(soundid))      { -        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id); +        TC_LOG_ERROR("spells", "EffectPlayMusic: Sound (Id: %u) not exist in spell %u.", soundid, m_spellInfo->Id);          return;      } @@ -5885,7 +5908,7 @@ void Spell::EffectPlaySound(SpellEffIndex effIndex)      if (!sSoundEntriesStore.LookupEntry(soundId))      { -        TC_LOG_ERROR(LOG_FILTER_SPELLS_AURAS, "EffectPlaySound: Sound (Id: %u) not exist in spell %u.", soundId, m_spellInfo->Id); +        TC_LOG_ERROR("spells", "EffectPlaySound: Sound (Id: %u) not exist in spell %u.", soundId, m_spellInfo->Id);          return;      } @@ -6013,7 +6036,7 @@ void Spell::EffectBind(SpellEffIndex effIndex)      data << uint32(areaId);      player->SendDirectMessage(&data); -    TC_LOG_DEBUG(LOG_FILTER_SPELLS_AURAS, "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u", +    TC_LOG_DEBUG("spells", "EffectBind: New homebind X: %f, Y: %f, Z: %f, MapId: %u, AreaId: %u",          homeLoc.GetPositionX(), homeLoc.GetPositionY(), homeLoc.GetPositionZ(), homeLoc.GetMapId(), areaId);      // zone update  | 
