Show
Ignore:
Timestamp:
11/19/08 13:41:55 (17 years ago)
Author:
yumileroy
Message:

[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.

Original author: megamage
Date: 2008-11-04 09:23:06-06:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/SpellEffects.cpp

    r160 r161  
    1111 * This program is distributed in the hope that it will be useful, 
    1212 * but WITHOUT ANY WARRANTY; without even the implied warranty of 
    13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
     13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
    1414 * GNU General Public License for more details. 
    1515 * 
    1616 * You should have received a copy of the GNU General Public License 
    1717 * along with this program; if not, write to the Free Software 
    18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 
     18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA 
    1919 */ 
    2020 
     
    39193919        return; 
    39203920 
    3921     if(m_caster->getClass() == CLASS_HUNTER) 
    3922     { 
    3923         // cast finish successfully 
    3924         //SendChannelUpdate(0); 
    3925         finish(); 
    3926  
    3927         Pet* pet = new Pet(HUNTER_PET); 
    3928  
    3929         if(!pet->CreateBaseAtCreature(creatureTarget)) 
    3930         { 
    3931             delete pet; 
    3932             return; 
    3933         } 
    3934  
    3935         creatureTarget->setDeathState(JUST_DIED); 
    3936         creatureTarget->RemoveCorpse(); 
    3937         creatureTarget->SetHealth(0);                       // just for nice GM-mode view 
    3938  
    3939         pet->SetUInt64Value(UNIT_FIELD_SUMMONEDBY, m_caster->GetGUID()); 
    3940         pet->SetUInt64Value(UNIT_FIELD_CREATEDBY, m_caster->GetGUID()); 
    3941         pet->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction()); 
    3942         pet->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id); 
    3943  
    3944         if(!pet->InitStatsForLevel(creatureTarget->getLevel())) 
    3945         { 
    3946             sLog.outError("ERROR: InitStatsForLevel() in EffectTameCreature failed! Pet deleted."); 
    3947             delete pet; 
    3948             return; 
    3949         } 
    3950  
    3951         // prepare visual effect for levelup 
    3952         pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1); 
    3953  
    3954         pet->GetCharmInfo()->SetPetNumber(objmgr.GeneratePetNumber(), true); 
    3955                                                             // this enables pet details window (Shift+P) 
    3956         pet->AIM_Initialize(); 
    3957         pet->InitPetCreateSpells(); 
    3958         pet->SetHealth(pet->GetMaxHealth()); 
    3959  
    3960         MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet); 
    3961  
    3962         // visual effect for levelup 
    3963         pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()); 
    3964  
    3965         if(m_caster->GetTypeId() == TYPEID_PLAYER) 
    3966         { 
    3967             m_caster->SetPet(pet); 
    3968             pet->SavePetToDB(PET_SAVE_AS_CURRENT); 
    3969             ((Player*)m_caster)->PetSpellInitialize(); 
    3970         } 
     3921    if(m_caster->getClass() != CLASS_HUNTER) 
     3922        return; 
     3923 
     3924    // cast finish successfully 
     3925    //SendChannelUpdate(0); 
     3926    finish(); 
     3927 
     3928    Pet* pet = m_caster->CreateTamedPetFrom(creatureTarget,m_spellInfo->Id); 
     3929 
     3930    // kill original creature 
     3931    creatureTarget->setDeathState(JUST_DIED); 
     3932    creatureTarget->RemoveCorpse(); 
     3933    creatureTarget->SetHealth(0);                       // just for nice GM-mode view 
     3934 
     3935    // prepare visual effect for levelup 
     3936    pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()-1); 
     3937 
     3938    // add to world 
     3939    MapManager::Instance().GetMap(pet->GetMapId(), pet)->Add((Creature*)pet); 
     3940 
     3941    // visual effect for levelup 
     3942    pet->SetUInt32Value(UNIT_FIELD_LEVEL,creatureTarget->getLevel()); 
     3943 
     3944    // caster have pet now 
     3945    m_caster->SetPet(pet); 
     3946 
     3947    if(m_caster->GetTypeId() == TYPEID_PLAYER) 
     3948    { 
     3949        pet->SavePetToDB(PET_SAVE_AS_CURRENT); 
     3950        ((Player*)m_caster)->PetSpellInitialize(); 
    39713951    } 
    39723952}