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

[svn] Fix broken spell target 38 (script target).
Implement linked spells, but will not enable it before testing.

Original author: megamage
Date: 2008-10-29 14:19:31-05:00

Files:
1 modified

Legend:

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

    r122 r131  
    20522052    uint32 count = 0; 
    20532053 
    2054     //                                                0       1 
    2055     QueryResult *result = WorldDatabase.Query("SELECT spell0, spell1 FROM spell_linked_spell"); 
     2054    //                                                0              1             2 
     2055    QueryResult *result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell"); 
    20562056    if( !result ) 
    20572057    { 
     
    20592059        bar.step(); 
    20602060        sLog.outString(); 
    2061         sLog.outString( ">> Loaded %u spell pet auras", count ); 
     2061        sLog.outString( ">> Loaded %u linked spells", count ); 
    20622062        return; 
    20632063    } 
     
    20712071        bar.step(); 
    20722072 
    2073         uint16 spell = fields[0].GetUInt16(); 
    2074         uint16 pet = fields[1].GetUInt16(); 
    2075         uint16 aura = fields[2].GetUInt16(); 
    2076  
    2077         SpellPetAuraMap::iterator itr = mSpellPetAuraMap.find(spell); 
    2078         if(itr != mSpellPetAuraMap.end()) 
    2079         { 
    2080             itr->second.AddAura(pet, aura); 
    2081         } 
    2082         else 
    2083         { 
    2084             SpellEntry const* spellInfo = sSpellStore.LookupEntry(spell); 
    2085             if (!spellInfo) 
    2086             { 
    2087                 sLog.outErrorDb("Spell %u listed in `spell_pet_auras` does not exist", spell); 
    2088                 continue; 
    2089             } 
    2090             int i = 0; 
    2091             for(; i < 3; ++i) 
    2092                 if((spellInfo->Effect[i] == SPELL_EFFECT_APPLY_AURA && 
    2093                     spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DUMMY) || 
    2094                     spellInfo->Effect[i] == SPELL_EFFECT_DUMMY) 
    2095                     break; 
    2096  
    2097             if(i == 3) 
    2098             { 
    2099                 sLog.outError("Spell %u listed in `spell_pet_auras` does not have dummy aura or dummy effect", spell); 
    2100                 continue; 
    2101             } 
    2102  
    2103             SpellEntry const* spellInfo2 = sSpellStore.LookupEntry(aura); 
    2104             if (!spellInfo2) 
    2105             { 
    2106                 sLog.outErrorDb("Aura %u listed in `spell_pet_auras` does not exist", aura); 
    2107                 continue; 
    2108             } 
    2109  
    2110             PetAura pa(pet, aura, spellInfo->EffectImplicitTargetA[i] == TARGET_PET, spellInfo->EffectBasePoints[i] + spellInfo->EffectBaseDice[i]); 
    2111             mSpellPetAuraMap[spell] = pa; 
    2112         } 
     2073        int32 trigger = fields[0].GetInt32(); 
     2074        int32 effect = fields[1].GetInt32(); 
     2075        int32 type = fields[2].GetInt32(); 
     2076 
     2077        SpellEntry const* spellInfo = sSpellStore.LookupEntry(abs(trigger)); 
     2078        if (!spellInfo) 
     2079        { 
     2080            sLog.outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(trigger)); 
     2081            continue; 
     2082        } 
     2083        spellInfo = sSpellStore.LookupEntry(abs(effect)); 
     2084        if (!spellInfo) 
     2085        { 
     2086            sLog.outErrorDb("Spell %u listed in `spell_linked_spell` does not exist", abs(effect)); 
     2087            continue; 
     2088        } 
     2089 
     2090        SpellLinkedSpell linkedSpell; 
     2091        linkedSpell.spell = effect; 
     2092        linkedSpell.type = type; 
     2093        mSpellLinkedMap[trigger] = linkedSpell; 
    21132094 
    21142095        ++count; 
     
    21182099 
    21192100    sLog.outString(); 
    2120     sLog.outString( ">> Loaded %u spell pet auras", count ); 
     2101    sLog.outString( ">> Loaded %u linked spells", count ); 
    21212102} 
    21222103