Jump to content

Question about server side scripts for spells


Guest evilmuke

Recommended Posts

Hello i need few informations about spells handling and server side scripts for spells in mangos.

I have found few methods in spelleffect and spellauras files but still im not sure where should i put what to make it compatible with mangos core. Lets take example: spell Haunt from warlock talents

http://www.wowhead.com/?spell=48181

Direct damage works but there is missing script for 2 other effects.

First one is + 20% shadow over time damage for 12 seconds.

Here question how to count spell family mask i ve seen tool 303 spell work but doesnt work for me its asking for dbc files even if i place it in same directory and where should i put my code. ( which file and which method - dummyspell ?)

Second one is healing for the damage done after spell ends ( after 12 seconds). In my opinion this spell would need to use trigger. When its triggered then i start counting damage done and after it ends i heal the caster for total damage value. Again question where to put this script.

If there is something else that i should do before adding script please let me know since colaboration diagrams that i ve found for mangos were wrong and its quite hard to findout the whole chain of calls.

Thx

EvilMuke

p.s where are u directly calling spell effects if they dont need server side script ?

Link to comment
Share on other sites

First you need to lookup what a spell does. In the example of Haunt you have 3 effects;

The first effect does damage via a certain school of magic (Shadow in this case) so it is handled by Spell::EffectSchoolDMG in SpellEffects.cpp. Under that heading there is a list of various exceptions for spell with different ways of calculating damage and at the end there is

       if(damage >= 0)
           m_damage+= damage;

which turns the spell damage value in the dbcs (not sure about this but its the logical place to store such data) in to damage applied to the target.

Next there is a dummy aura for the heal. These are handled under Spell::EffectDummy; In this case there is no handler for this spell but if someone were to code an exception it would go in there and if you couldn't find out the spell family, you could use the SPELLFAMILY_GENERIC and catch the case by the spellid. I'm not sure on how to code the count damage, so someone else may need to help here.

Last is the the +shadow damage from dots. This calls the Spell::EffectApplyAura which applies the aura onto the target. The real effect comes when that aura is handled in SpellAura.cpp; in this case the aur is 271 and according the list at the start

&Aura::HandleNoImmediateEffect,                         //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER    implemented in Unit::SpellDamageBonus

so the effect should be handled by

   AuraList const& mOwnerTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
   for(AuraList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
       if( (*i)->GetCasterGUID() == GetGUID() && (*i)->isAffectedOnSpell(spellProto))
           TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;

Not sure if this works, but in theory it should and damage should go up.

All spell effects should be handled in SpellEfects.cpp; for futue use wowhead often gives you effect to lookup, usually requiring the spell effect prefix. Also note that spaces are converted into "_" in the list which helps when searching or browsing for the effect.

Hopefully I've been of some help and haven't lost you... Feel free to ask more questions if you have any.

Link to comment
Share on other sites

First you need to lookup what a spell does. In the example of Haunt you have 3 effects;

The first effect does damage via a certain school of magic (Shadow in this case) so it is handled by Spell::EffectSchoolDMG in SpellEffects.cpp. Under that heading there is a list of various exceptions for spell with different ways of calculating damage and at the end there is

       if(damage >= 0)
           m_damage+= damage;

which turns the spell damage value in the dbcs (not sure about this but its the logical place to store such data) in to damage applied to the target.

Next there is a dummy aura for the heal. These are handled under Spell::EffectDummy; In this case there is no handler for this spell but if someone were to code an exception it would go in there and if you couldn't find out the spell family, you could use the SPELLFAMILY_GENERIC and catch the case by the spellid. I'm not sure on how to code the count damage, so someone else may need to help here.

Last is the the +shadow damage from dots. This calls the Spell::EffectApplyAura which applies the aura onto the target. The real effect comes when that aura is handled in SpellAura.cpp; in this case the aur is 271 and according the list at the start

&Aura::HandleNoImmediateEffect,                         //271 SPELL_AURA_MOD_DAMAGE_FROM_CASTER    implemented in Unit::SpellDamageBonus

so the effect should be handled by

   AuraList const& mOwnerTaken = pVictim->GetAurasByType(SPELL_AURA_MOD_DAMAGE_FROM_CASTER);
   for(AuraList::const_iterator i = mOwnerTaken.begin(); i != mOwnerTaken.end(); ++i)
       if( (*i)->GetCasterGUID() == GetGUID() && (*i)->isAffectedOnSpell(spellProto))
           TakenTotalMod *= ((*i)->GetModifier()->m_amount+100.0f)/100.0f;

Not sure if this works, but in theory it should and damage should go up.

All spell effects should be handled in SpellEfects.cpp; for futue use wowhead often gives you effect to lookup, usually requiring the spell effect prefix. Also note that spaces are converted into "_" in the list which helps when searching or browsing for the effect.

Hopefully I've been of some help and haven't lost you... Feel free to ask more questions if you have any.

nah i alredy found myself where should i put my code for server side scripts but thx for reply

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use