Changeset 131 for trunk/src/game
- Timestamp:
- 11/19/08 13:38:58 (17 years ago)
- Location:
- trunk/src/game
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Spell.cpp
r122 r131 923 923 if(m_caster->GetTypeId() == TYPEID_UNIT && ((Creature*)m_caster)->AI()) 924 924 ((Creature*)m_caster)->AI()->SpellHitTarget(unit, m_spellInfo); 925 926 if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 1)) 927 { 928 if(spell_triggered > 0) 929 m_caster->CastSpell(unit, spell_triggered, true); 930 else 931 unit->RemoveAurasDueToSpell(-spell_triggered); 932 } 925 933 } 926 934 … … 1287 1295 radius = GetSpellMaxRange(sSpellRangeStore.LookupEntry(m_spellInfo->rangeIndex)); 1288 1296 1297 uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i]; 1298 uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets; 1289 1299 if(m_originalCaster) 1300 { 1290 1301 if(Player* modOwner = m_originalCaster->GetSpellModOwner()) 1302 { 1291 1303 modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius,this); 1292 1293 uint32 EffectChainTarget = m_spellInfo->EffectChainTarget[i];1294 if(m_originalCaster)1295 if(Player* modOwner = m_originalCaster->GetSpellModOwner())1296 1304 modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_JUMP_TARGETS, EffectChainTarget, this); 1297 1298 uint32 unMaxTargets = m_spellInfo->MaxAffectedTargets; 1305 } 1306 } 1307 1299 1308 switch(cur) 1300 1309 { … … 1552 1561 m_targets.setDestination(goScriptTarget->GetPositionX(),goScriptTarget->GetPositionY(),goScriptTarget->GetPositionZ()); 1553 1562 } 1563 else 1564 { 1565 if(creatureScriptTarget) 1566 TagUnitMap.push_back(creatureScriptTarget); 1567 else if(goScriptTarget) 1568 AddGOTarget(goScriptTarget, i); 1569 } 1554 1570 }break; 1555 1556 1571 1557 1572 // dummy … … 2176 2191 } 2177 2192 } 2193 } 2194 2195 if(int32 spell_triggered = spellmgr.GetSpellLinked(m_spellInfo->Id, 0)) 2196 { 2197 if(spell_triggered > 0) 2198 m_caster->CastSpell(m_targets.getUnitTarget() ? m_targets.getUnitTarget() : m_caster, spell_triggered, true); 2199 else 2200 m_caster->RemoveAurasDueToSpell(-spell_triggered); 2178 2201 } 2179 2202 -
trunk/src/game/SpellMgr.cpp
r122 r131 2052 2052 uint32 count = 0; 2053 2053 2054 // 0 12055 QueryResult *result = WorldDatabase.Query("SELECT spell 0, spell1FROM spell_linked_spell");2054 // 0 1 2 2055 QueryResult *result = WorldDatabase.Query("SELECT spell_trigger, spell_effect, type FROM spell_linked_spell"); 2056 2056 if( !result ) 2057 2057 { … … 2059 2059 bar.step(); 2060 2060 sLog.outString(); 2061 sLog.outString( ">> Loaded %u spell pet auras", count );2061 sLog.outString( ">> Loaded %u linked spells", count ); 2062 2062 return; 2063 2063 } … … 2071 2071 bar.step(); 2072 2072 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; 2113 2094 2114 2095 ++count; … … 2118 2099 2119 2100 sLog.outString(); 2120 sLog.outString( ">> Loaded %u spell pet auras", count );2101 sLog.outString( ">> Loaded %u linked spells", count ); 2121 2102 } 2122 2103 -
trunk/src/game/SpellMgr.h
r122 r131 649 649 typedef std::map<uint32, SpellExtraAttribute> SpellExtraAttrMap; 650 650 651 typedef std::map<int32, int32> SpellLinkedMap; 651 struct SpellLinkedSpell 652 { 653 int32 spell; 654 uint32 type; 655 }; 656 typedef std::map<int32, SpellLinkedSpell> SpellLinkedMap; 652 657 653 658 class SpellMgr … … 858 863 } 859 864 860 int32 GetSpellLinked(int32 spell_id ) const865 int32 GetSpellLinked(int32 spell_id, uint32 type) const 861 866 { 862 867 SpellLinkedMap::const_iterator itr = mSpellLinkedMap.find(spell_id); 863 868 if(itr != mSpellLinkedMap.end()) 864 return itr->second ;869 return itr->second.type == type ? itr->second.spell : 0; 865 870 else 866 871 return 0; -
trunk/src/game/Unit.cpp
r120 r131 4163 4163 if(caster->GetTypeId()==TYPEID_UNIT && ((Creature*)caster)->isTotem() && ((Totem*)caster)->GetTotemType()==TOTEM_STATUE) 4164 4164 statue = ((Totem*)caster); 4165 4166 4167 if(int32 spell_triggered = spellmgr.GetSpellLinked(-(int32)Aur->GetSpellProto()->Id, 0)) 4168 { 4169 if(spell_triggered > 0) 4170 { 4171 if(Unit* caster = Aur->GetCaster()) 4172 CastSpell(this, spell_triggered, true, 0, 0, caster->GetGUID()); 4173 } 4174 else 4175 RemoveAurasDueToSpell(-spell_triggered); 4176 } 4165 4177 4166 4178 sLog.outDebug("Aura %u now is remove mode %d",Aur->GetModifier()->m_auraname, mode);