diff options
author | megamage <none@none> | 2008-11-04 09:23:06 -0600 |
---|---|---|
committer | megamage <none@none> | 2008-11-04 09:23:06 -0600 |
commit | fc9a14a6cf5cff4bf4ba3124e646e09b940729eb (patch) | |
tree | 9605e808e74532072845b7e75510d0f3dbf6e5ee /src/game/SpellEffects.cpp | |
parent | a5045b76849f095929358248d8b51ed8a4fb89bc (diff) |
[svn] Fix 146_world.sql. Do not use default for text. (Ignore this if you have successfully applied 146_world.sql)
Fix HandleAuraModIncreaseHealth, also increase current health.
Merge from Mangos:
2008-11-02 10:53:27 854e0d64e3410b2a1eff6d56705f8e42b4291534 Do not split self caused damage.
(PART) 2008-10-31 12:45:22 e56b671979623570acd358a9b99aa169be22ffba Move tamed pet creating code to new function.
--HG--
branch : trunk
Diffstat (limited to 'src/game/SpellEffects.cpp')
-rw-r--r-- | src/game/SpellEffects.cpp | 68 |
1 files changed, 24 insertions, 44 deletions
diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index d0aa63305c3..db7134c375c 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -10,12 +10,12 @@ * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include "Common.h" @@ -3918,56 +3918,36 @@ void Spell::EffectTameCreature(uint32 /*i*/) if(creatureTarget->isPet()) return; - if(m_caster->getClass() == CLASS_HUNTER) - { - // cast finish successfully - //SendChannelUpdate(0); - finish(); - - Pet* pet = new Pet(HUNTER_PET); - - if(!pet->CreateBaseAtCreature(creatureTarget)) - { - delete pet; - return; - } + if(m_caster->getClass() != CLASS_HUNTER) + return; - creatureTarget->setDeathState(JUST_DIED); - creatureTarget->RemoveCorpse(); - creatureTarget->SetHealth(0); // just for nice GM-mode view + // cast finish successfully + //SendChannelUpdate(0); + finish(); - pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID()); - pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID()); - pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); - pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); + Pet* pet = m_caster->CreateTamedPetFrom(creatureTarget,m_spellInfo->Id); - if(!pet->InitStatsForLevel(creatureTarget->getLevel())) - { - sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); - delete pet; - return; - } + // kill original creature + creatureTarget->setDeathState(JUST_DIED); + creatureTarget->RemoveCorpse(); + creatureTarget->SetHealth(0); // just for nice GM-mode view - // prepare visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1); + // prepare visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1); - pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true); - // this enables pet details window (Shift+P) - pet->AIM_Initialize(); - pet->InitPetCreateSpells(); - pet->SetHealth(pet->GetMaxHealth()); + // add to world + MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet); - MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet); + // visual effect for levelup + pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()); - // visual effect for levelup - pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()); + // caster have pet now + m_caster->SetPet(pet); - if(m_caster->GetTypeId() == TYPEID_PLAYER) - { - m_caster->SetPet(pet); - pet->SavePetToDB(PET_SAVE_AS_CURRENT); - ((Player*)m_caster)->PetSpellInitialize(); - } + if(m_caster->GetTypeId() == TYPEID_PLAYER) + { + pet->SavePetToDB(PET_SAVE_AS_CURRENT); + ((Player*)m_caster)->PetSpellInitialize(); } } |