All pastes #628725 Raw Edit

Someone

public text v1 · immutable
·published 2007-07-21 16:17 UTC
rendered paste body
Index: src/game/GridNotifiersImpl.h
===================================================================
--- src/game/GridNotifiersImpl.h	(revision 4141)
+++ src/game/GridNotifiersImpl.h	(working copy)
@@ -160,7 +160,7 @@
         return;
 
     SpellEntry const *spellInfo = sSpellStore.LookupEntry(i_dynobject.GetSpellId());
-    PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, i_dynobject.GetEffIndex(), target, i_dynobject.GetCaster());
+    PersistentAreaAura* Aur = new PersistentAreaAura(spellInfo, i_dynobject.GetEffIndex(), NULL, target, i_dynobject.GetCaster());
     target->AddAura(Aur);
     i_dynobject.AddAffected(target);
 }
Index: src/game/Level3.cpp
===================================================================
--- src/game/Level3.cpp	(revision 4141)
+++ src/game/Level3.cpp	(working copy)
@@ -2530,7 +2530,7 @@
                 continue;
             if (eff == SPELL_EFFECT_APPLY_AURA || eff == SPELL_EFFECT_APPLY_AREA_AURA || eff == SPELL_EFFECT_PERSISTENT_AREA_AURA)
             {
-                Aura *Aur = new Aura(spellInfo, i, target);
+                Aura *Aur = new Aura(spellInfo, i, NULL, target);
                 target->AddAura(Aur);
             }
         }
Index: src/game/Pet.cpp
===================================================================
--- src/game/Pet.cpp	(revision 4141)
+++ src/game/Pet.cpp	(working copy)
@@ -1309,13 +1309,13 @@
 
             if(spellproto->Effect[effindex] == SPELL_EFFECT_APPLY_AREA_AURA) //this might give problems if the pet was not the caster; possible: store bool if caster was self or not
             {
-                AreaAura* aura = new AreaAura(spellproto, effindex, this, this);
+                AreaAura* aura = new AreaAura(spellproto, effindex, NULL, this, this);
                 aura->SetAuraDuration(remaintime);
                 AddAura(aura);
             }
             else
             {
-                Aura* aura = new Aura(spellproto, effindex, this, this/*caster*/);
+                Aura* aura = new Aura(spellproto, effindex, NULL, this, this/*caster*/);
                 aura->SetAuraDuration(remaintime);
                 AddAura(aura);
             }
Index: src/game/Player.cpp
===================================================================
--- src/game/Player.cpp	(revision 4141)
+++ src/game/Player.cpp	(working copy)
@@ -11943,8 +11943,8 @@
             }
 
             // FIXME: real caster not stored in DB currently
-
-            Aura* aura = new Aura(spellproto, effindex, this, this/*caster*/);
+            // FIXME: real base points not stored in DB currently
+            Aura* aura = new Aura(spellproto, effindex, NULL, this, this/*caster*/);
             aura->SetAuraDuration(remaintime);
             AddAura(aura);
         }
Index: src/game/Spell.cpp
===================================================================
--- src/game/Spell.cpp	(revision 4141)
+++ src/game/Spell.cpp	(working copy)
@@ -203,19 +203,11 @@
 Spell::Spell( Unit* Caster, SpellEntry const *info, bool triggered, Aura* Aur, uint64 originalCasterGUID )
 {
     ASSERT( Caster != NULL && info != NULL );
+    ASSERT( info == sSpellStore.LookupEntry( info->Id ) && "`info` must be pointer to sSpellStore element");
 
     Player* p_caster;
 
-    // make own copy of custom `info` (`info` can be created at stack) for non-triggered spell
-    // copy custom SpellEntry in m_spellInfo will be delete at Spell delete
-    if(info != sSpellStore.LookupEntry( info->Id ) && !triggered)
-    {
-        SpellEntry* sInfo = new SpellEntry;
-        *sInfo = *info;
-        m_spellInfo = sInfo;
-    }
-    else
-        m_spellInfo = info;
+    m_spellInfo = info;
 
     m_caster = Caster;
 
@@ -231,6 +223,9 @@
     else
         m_originalCaster = ObjectAccessor::Instance().GetUnit(*m_caster,m_originalCasterGUID);
 
+    for(int i=0; i <3; ++i)
+        m_currentBasePoints[i] = m_spellInfo->EffectBasePoints[i];
+
     m_spellState = SPELL_STATE_NULL;
 
     m_castPositionX = m_castPositionY = m_castPositionZ = 0;
@@ -282,9 +277,6 @@
 
 Spell::~Spell()
 {
-    // free custom m_spellInfo for non-triggered spell
-    if(m_spellInfo != sSpellStore.LookupEntry(m_spellInfo->Id) && !m_IsTriggeredSpell)
-        delete m_spellInfo;
 }
 
 void Spell::FillTargetMap()
@@ -2905,7 +2897,7 @@
 
 int32 Spell::CalculateDamage(uint8 i)
 {
-    int32 value = m_caster->CalculateSpellDamage(m_spellInfo,i);
+    int32 value = m_caster->CalculateSpellDamage(m_spellInfo,i,m_currentBasePoints[i]);
 
     if(m_caster->GetTypeId() == TYPEID_PLAYER)
         ((Player*)m_caster)->ApplySpellMod(m_spellInfo->Id, SPELLMOD_DAMAGE, value);
Index: src/game/Spell.h
===================================================================
--- src/game/Spell.h	(revision 4141)
+++ src/game/Spell.h	(working copy)
@@ -470,6 +470,7 @@
         void EffectPickPocket(uint32 i);
         void EffectAddFarsight(uint32 i);
         void EffectSummonWild(uint32 i);
+        void EffectSummonGuardian(uint32 i);
         void EffectTeleUnitsFaceCaster(uint32 i);
         void EffectLearnSkill(uint32 i);
         void EffectTradeSkill(uint32 i);
@@ -572,6 +573,7 @@
         //void HandleAddAura(Unit* Target);
 
         SpellEntry const* m_spellInfo;
+        int32 m_currentBasePoints[3];                       // cache SpellEntry::EffectBasePoints and use for set custom base points
         Item* m_CastItem;
         SpellCastTargets m_targets;
 
@@ -594,7 +596,6 @@
     protected:
 
         void SendLoot(uint64 guid, LootType loottype);
-
         Unit* m_caster;
 
         uint64 m_originalCasterGUID;                        // real source of cast (aura caster/etc), used for spell targets selection
Index: src/game/SpellAuras.cpp
===================================================================
--- src/game/SpellAuras.cpp	(revision 4141)
+++ src/game/SpellAuras.cpp	(working copy)
@@ -287,7 +287,7 @@
     &Aura::HandleNULL                                       //234 SPELL_AURA_SILENCE_RESISTANCE
 };
 
-Aura::Aura(SpellEntry const* spellproto, uint32 eff, Unit *target, Unit *caster, Item* castItem) :
+Aura::Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster, Item* castItem) :
 m_procCharges(0), m_absorbDmg(0), m_spellmod(NULL), m_spellId(spellproto->Id), m_effIndex(eff), m_caster_guid(0), m_target(target),
 m_timeCla(1000), m_castItemGuid(castItem?castItem->GetGUID():0), m_auraSlot(MAX_AURAS),
 m_positive(false), m_permanent(false), m_isPeriodic(false), m_isTrigger(false), m_isAreaAura(false), m_isPersistent(false),
@@ -295,17 +295,12 @@
 {
     assert(target);
 
-    // make own copy of custom `spellproto` (`spellproto` will be deleted at spell cast finished)
-    // copy custom SpellEntry in m_spellProto will be delete at Aura delete
-    if(spellproto != sSpellStore.LookupEntry( spellproto->Id ))
-    {
-        SpellEntry* sInfo = new SpellEntry;
-        *sInfo = *spellproto;
-        m_spellProto = sInfo;
-    }
-    else
-        m_spellProto = spellproto;
+    assert(spellproto == sSpellStore.LookupEntry( spellproto->Id ) && "`info` must be pointer to sSpellStore element");
 
+    m_spellProto = spellproto;
+
+    m_currentBasePoints = currentBasePoints ? *currentBasePoints : m_spellProto->EffectBasePoints[eff];
+
     m_isPassive = IsPassiveSpell(m_spellId);
 
     m_duration = GetDuration(spellproto);
@@ -383,8 +378,8 @@
         delete m_spellProto;
 }
 
-AreaAura::AreaAura(SpellEntry const* spellproto, uint32 eff, Unit *target,
-Unit *caster, Item* castItem) : Aura(spellproto, eff, target, caster, castItem)
+AreaAura::AreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target,
+Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target, caster, castItem)
 {
     m_isAreaAura = true;
 }
@@ -393,8 +388,8 @@
 {
 }
 
-PersistentAreaAura::PersistentAreaAura(SpellEntry const* spellproto, uint32 eff, Unit *target,
-Unit *caster, Item* castItem) : Aura(spellproto, eff, target, caster, castItem)
+PersistentAreaAura::PersistentAreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target,
+Unit *caster, Item* castItem) : Aura(spellproto, eff, currentBasePoints, target, caster, castItem)
 {
     m_isPersistent = true;
 }
@@ -421,7 +416,7 @@
     if(!caster)
         caster = m_target;
 
-    return caster->CalculateSpellDamage(spellproto,m_effIndex);
+    return caster->CalculateSpellDamage(spellproto,m_effIndex,m_currentBasePoints);
 }
 
 void Aura::SetModifier(uint8 t, int32 a, uint32 pt, int32 miscValue, uint32 miscValue2)
@@ -563,7 +558,7 @@
                     // apply aura to players in range that dont have it yet
                     if (!t_aura)
                     {
-                        AreaAura *aur = new AreaAura(GetSpellProto(), m_effIndex, Target, caster);
+                        AreaAura *aur = new AreaAura(GetSpellProto(), m_effIndex, &m_currentBasePoints, Target, caster);
                         Target->AddAura(aur);
                     }
                 }
@@ -587,7 +582,7 @@
                 {
                     if (!o_aura)
                     {
-                        AreaAura *aur = new AreaAura(GetSpellProto(), m_effIndex, owner, caster);
+                        AreaAura *aur = new AreaAura(GetSpellProto(), m_effIndex, &m_currentBasePoints, owner, caster);
                         owner->AddAura(aur);
                     }
                 }
@@ -3503,12 +3498,7 @@
                     if ((*i)->GetSpellProto()->SpellIconID == 240 && (*i)->GetModifier()->m_miscvalue == 3)
                         HotWMod = (*i)->GetModifier()->m_amount;
                 if (HotWMod)
-                {
-                    SpellEntry const *HotWTemplate = sSpellStore.LookupEntry(HotWSpellId);
-                    SpellEntry HotWCustom = *HotWTemplate;
-                    HotWCustom.EffectBasePoints[0] = HotWMod;
-                    m_target->CastSpell(m_target, &HotWCustom, true);
-                }
+                    m_target->CastSpell(m_target, HotWSpellId, &HotWMod, NULL, NULL, true);
             }
         }
     }
Index: src/game/SpellAuras.h
===================================================================
--- src/game/SpellAuras.h	(revision 4141)
+++ src/game/SpellAuras.h	(working copy)
@@ -185,7 +185,7 @@
         void HandleModSpellCritChanceShool(bool apply, bool Real);
         void HandleAuraRetainComboPoints(bool apply, bool Real);
 
-        Aura(SpellEntry const* spellproto, uint32 eff, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
+        Aura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
         virtual ~Aura();
 
         void SetModifier(uint8 t, int32 a, uint32 pt, int32 miscValue, uint32 miscValue2);
@@ -244,6 +244,7 @@
         uint32 m_spellId;
         uint32 m_effIndex;
         SpellEntry const *m_spellProto;
+        int32 m_currentBasePoints;                          // cache SpellEntry::EffectBasePoints and use for set custom base points
         uint64 m_caster_guid;
         Unit* m_target;
         int32 m_duration;
@@ -273,7 +274,7 @@
 class AreaAura : public Aura
 {
     public:
-        AreaAura(SpellEntry const* spellproto, uint32 eff, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
+        AreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
         ~AreaAura();
         void Update(uint32 diff);
 };
@@ -281,7 +282,7 @@
 class PersistentAreaAura : public Aura
 {
     public:
-        PersistentAreaAura(SpellEntry const* spellproto, uint32 eff, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
+        PersistentAreaAura(SpellEntry const* spellproto, uint32 eff, int32 *currentBasePoints, Unit *target, Unit *caster = NULL, Item* castItem = NULL);
         ~PersistentAreaAura();
         void Update(uint32 diff);
 };
Index: src/game/SpellEffects.cpp
===================================================================
--- src/game/SpellEffects.cpp	(revision 4141)
+++ src/game/SpellEffects.cpp	(working copy)
@@ -98,7 +98,7 @@
     &Spell::EffectNULL,                                     // 39 SPELL_EFFECT_LANGUAGE
     &Spell::EffectDualWield,                                // 40 SPELL_EFFECT_DUAL_WIELD
     &Spell::EffectSummonWild,                               // 41 SPELL_EFFECT_SUMMON_WILD
-    &Spell::EffectSummonWild,                               // 42 SPELL_EFFECT_SUMMON_GUARDIAN
+    &Spell::EffectSummonGuardian,                           // 42 SPELL_EFFECT_SUMMON_GUARDIAN
     &Spell::EffectTeleUnitsFaceCaster,                      // 43 SPELL_EFFECT_TELEPORT_UNITS_FACE_CASTER
     &Spell::EffectLearnSkill,                               // 44 SPELL_EFFECT_SKILL_STEP
     &Spell::EffectNULL,                                     // 45 SPELL_EFFECT_ADD_HONOR                honor/pvp related
@@ -129,7 +129,7 @@
     &Spell::EffectNULL,                                     // 70 SPELL_EFFECT_PULL                     one spell: Distract Move
     &Spell::EffectPickPocket,                               // 71 SPELL_EFFECT_PICKPOCKET
     &Spell::EffectAddFarsight,                              // 72 SPELL_EFFECT_ADD_FARSIGHT
-    &Spell::EffectSummonWild,                               // 73 SPELL_EFFECT_SUMMON_POSSESSED
+    &Spell::EffectSummonGuardian,                           // 73 SPELL_EFFECT_SUMMON_POSSESSED
     &Spell::EffectNULL,                                     // 74 SPELL_EFFECT_SUMMON_TOTEM
     &Spell::EffectNULL,                                     // 75 SPELL_EFFECT_HEAL_MECHANICAL          one spell: Mechanical Patch Kit
     &Spell::EffectSummonObjectWild,                         // 76 SPELL_EFFECT_SUMMON_OBJECT_WILD
@@ -259,11 +259,8 @@
     // Charge
     if(m_spellInfo->SpellVisual == 867 && m_spellInfo->SpellIconID == 457)
     {
-        uint32 rage = m_spellInfo->EffectBasePoints[i];
-        SpellEntry const* OriginalCharge = sSpellStore.LookupEntry(34846);
-        SpellEntry CustomCharge = *OriginalCharge;
-        CustomCharge.EffectBasePoints[0] = rage;
-        m_caster->CastSpell(m_caster,&CustomCharge,true);
+        int32 chargeBasePoints0 = m_spellInfo->EffectBasePoints[i];
+        m_caster->CastCustomSpell(m_caster,34846,&chargeBasePoints0,NULL,NULL,true);
 
         return;
     }
@@ -411,13 +408,11 @@
                 melee_mod = 30;
             if (healthPerc < 100 && healthPerc > 40)
                 melee_mod = 10+(100-healthPerc)/3;
-            SpellEntry const *OriginalHasteModSpell = sSpellStore.LookupEntry(26635);
-            SpellEntry CustomHasteModSpell = *OriginalHasteModSpell;
-            CustomHasteModSpell.EffectBasePoints[0] = melee_mod-1;
-                                                            // (EffectBasePoints[0]+1)-1+(5-melee_mod) = (melee_mod-1+1)-1+5-melee_mod = 5-1
-            CustomHasteModSpell.EffectBasePoints[1] = (5-melee_mod)-1;
-            CustomHasteModSpell.EffectBasePoints[2] = 5-1;
-            m_caster->CastSpell(m_caster,&CustomHasteModSpell,true,NULL);
+
+            int32 hasteModBasePoints0 = melee_mod-1;        // (EffectBasePoints[0]+1)-1+(5-melee_mod) = (melee_mod-1+1)-1+5-melee_mod = 5-1
+            int32 hasteModBasePoints1 = (5-melee_mod)-1;
+            int32 hasteModBasePoints2 = 5-1;
+            m_caster->CastCustomSpell(m_caster,26635,&hasteModBasePoints0,&hasteModBasePoints1,&hasteModBasePoints2,true,NULL);
             return;
         }
         
@@ -426,12 +421,8 @@
             if(!unitTarget)
                 return;
 
-            int32 dmg = damage;
-            dmg += int32(m_caster->GetPower(POWER_RAGE) * m_spellInfo->DmgMultiplier[i]);
-            SpellEntry const *tspellInfo = sSpellStore.LookupEntry(20647);
-            SpellEntry sInfo = *tspellInfo;
-            sInfo.EffectBasePoints[0] = dmg-1;
-            m_caster->CastSpell(unitTarget, &sInfo, true, 0);
+            int32 basePoints0 = damage+int32(m_caster->GetPower(POWER_RAGE) * m_spellInfo->DmgMultiplier[i])-1;
+            m_caster->CastCustomSpell(unitTarget, 20647, &basePoints0, NULL, NULL, true, 0);
             m_caster->SetPower(POWER_RAGE,0);
             return;
         }
@@ -444,14 +435,9 @@
         case 5420:
         {
             // Tree of Life area effect
-            SpellEntry const* spellInfo = sSpellStore.LookupEntry( 34123 );
-            if(!spellInfo)
-                return;
-
             int32 health_mod = int32(m_caster->GetStat(STAT_SPIRIT)/4);
-            SpellEntry customSpellInfo = *spellInfo;
-            customSpellInfo.EffectBasePoints[0] = health_mod-1;
-            m_caster->CastSpell(m_caster,&customSpellInfo,true,NULL);
+            int32 treeHealthBasePoints0 = health_mod-1;
+            m_caster->CastCustomSpell(m_caster,34123,&treeHealthBasePoints0,NULL,NULL,true,NULL);
             return;
         }
 
@@ -481,11 +467,9 @@
         //Last Stand
         case 12975:
         {
-            uint32 health_mod = uint32(m_caster->GetMaxHealth()*0.3);
-            SpellEntry const* OriginalHealthModSpell = sSpellStore.LookupEntry(12976);
-            SpellEntry CustomHealthModSpell = *OriginalHealthModSpell;
-            CustomHealthModSpell.EffectBasePoints[0] = health_mod; //12976 has a base dice of 0, so no decrement needed
-            m_caster->CastSpell(m_caster,&CustomHealthModSpell,true,NULL);
+            //12976 has a base dice of 0, so no decrement needed
+            int32 healthModSpellBasePoints0 = int32(m_caster->GetMaxHealth()*0.3);
+            m_caster->CastCustomSpell(m_caster, 12976, &healthModSpellBasePoints0, NULL, NULL, true, NULL);
             return;
         }
         
@@ -607,9 +591,6 @@
             else
                 damage = (m_caster->GetFloatValue(UNIT_FIELD_MINDAMAGE) + m_caster->GetFloatValue(UNIT_FIELD_MAXDAMAGE))/2;
             
-            SpellEntry const *deepWoundsDotTemplate = sSpellStore.LookupEntry(12721);
-            SpellEntry deepWoundsDot = *deepWoundsDotTemplate;
-
             switch (m_spellInfo->Id)
             {
                 case 12850: damage *= 0.2f; break;
@@ -620,8 +601,8 @@
                     return;
             };
 
-            deepWoundsDot.EffectBasePoints[0] = int32(damage / 4) - 1;
-            m_caster->CastSpell(unitTarget, &deepWoundsDot, true, NULL);
+            int32 deepWoundsDotBasePoints0 = int32(damage / 4) - 1;
+            m_caster->CastCustomSpell(unitTarget, 12721, &deepWoundsDotBasePoints0, NULL, NULL, true, NULL);
             return;
         }
 
@@ -884,7 +865,7 @@
 
     sLog.outDebug("Spell: Aura is: %u", m_spellInfo->EffectApplyAuraName[i]);
 
-    Aura* Aur = new Aura(m_spellInfo, i, unitTarget,m_caster, m_CastItem);
+    Aura* Aur = new Aura(m_spellInfo, i, &m_currentBasePoints[i], unitTarget,m_caster, m_CastItem);
 
     if(!Aur)                                                // is it useless?
         return;
@@ -980,7 +961,7 @@
             SpellEntry const *AdditionalSpellInfo = sSpellStore.LookupEntry(spellId);
             if (AdditionalSpellInfo)
             {
-                Aura* AdditionalAura = new Aura(AdditionalSpellInfo, 0, unitTarget,m_caster, 0);
+                Aura* AdditionalAura = new Aura(AdditionalSpellInfo, 0, &m_currentBasePoints[0], unitTarget,m_caster, 0);
                 unitTarget->AddAura(AdditionalAura, 0);
                 sLog.outDebug("Spell: Additional Aura is: %u", AdditionalSpellInfo->EffectApplyAuraName[0]);
             }
@@ -1542,7 +1523,7 @@
     if(!unitTarget->isAlive())
         return;
 
-    AreaAura* Aur = new AreaAura(m_spellInfo, i, unitTarget, m_caster);
+    AreaAura* Aur = new AreaAura(m_spellInfo, i, &m_currentBasePoints[i], unitTarget, m_caster);
     unitTarget->AddAura(Aur);
 }
 
@@ -1715,6 +1696,53 @@
 
 void Spell::EffectSummonWild(uint32 i)
 {
+    uint32 creature_entry = m_spellInfo->EffectMiscValue[i];
+    if(!creature_entry)
+        return;
+
+    uint32 level = m_caster->getLevel();
+
+    // level of creature summoned using engineering item based at engineering skill level
+    if(m_caster->GetTypeId()==TYPEID_PLAYER && m_CastItem)
+    {
+        ItemPrototype const *proto = m_CastItem->GetProto();
+        if(proto && proto->RequiredSkill == SKILL_ENGINERING)
+        {
+            uint16 skill202 = ((Player*)m_caster)->GetSkillValue(SKILL_ENGINERING);
+            if(skill202)
+            {
+                level = skill202/5;
+            }
+        }
+    }
+
+    // select center of summon position
+    float center_x = m_targets.m_destX;
+    float center_y = m_targets.m_destY;
+    float center_z = m_targets.m_destZ;
+
+    if (center_x == 0 || center_y == 0 || center_z == 0)
+        m_caster->GetClosePoint(NULL, center_x, center_y, center_z);
+
+    float radius = GetRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
+
+    int32 amount = damage > 0 ? damage : 1;
+
+    for(int32 count = 0; count < amount; ++count)
+    {
+        float px, py, pz;
+        m_caster->GetRandomPoint(center_x,center_y,center_z,radius,px,py,pz);
+
+        int32 duration = GetDuration(m_spellInfo);
+
+        TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN;
+
+        m_caster->SummonCreature(creature_entry,px,py,pz,m_caster->GetOrientation(),summonType,duration);
+    }
+}
+
+void Spell::EffectSummonGuardian(uint32 i)
+{
     uint32 pet_entry = m_spellInfo->EffectMiscValue[i];
     if(!pet_entry)
         return;
@@ -1816,27 +1844,8 @@
             spawnCreature->SetArmor(level*50);
             spawnCreature->AIM_Initialize();
 
-            /* not set name for guardians/minpets
-            std::string name;
-            if(m_caster->GetTypeId() == TYPEID_PLAYER)
-            name = ((Player*)m_caster)->GetName();
-            else
-            name = ((Creature*)m_caster)->GetCreatureInfo()->Name;
-            name.append(petTypeSuffix[spawnCreature->getPetType()]);
-            spawnCreature->SetName( name );
-            */
-
             ObjectAccessor::Instance().AddPet(spawnCreature);
             MapManager::Instance().GetMap(m_caster->GetMapId(), m_caster)->Add((Creature*)spawnCreature);
-            /*
-            guardians and wilds can't be controlled
-            if(m_caster->GetTypeId() == TYPEID_PLAYER)
-            {
-            m_caster->SetPet(spawnCreature);
-            ((Player*)m_caster)->PetSpellInitialize();
-            ((Player*)m_caster)->SavePet();
-            }
-            */
         }
     }
 }
@@ -2838,15 +2847,8 @@
     _player->DestroyItemCount(itemTarget,count,true);
     // TODO: fix crash when a spell has two effects, both pointed at the same item target
 
-    SpellEntry const *feedTemplate = sSpellStore.LookupEntry(m_spellInfo->EffectTriggerSpell[i]);
-    SpellEntry feedCustom = *feedTemplate;
-
-    feedCustom.EffectBasePoints[0] = pet->GetCurrentFoodBenefit() -1;
-
-    Spell _spell(m_caster, &feedCustom, true, 0);
-    SpellCastTargets targets;
-    targets.setUnitTarget(m_caster);
-    _spell.prepare(&targets);
+    int32 feedCustomBasePoints0 = pet->GetCurrentFoodBenefit() -1;
+    m_caster->CastCustomSpell(m_caster,m_spellInfo->EffectTriggerSpell[i],&feedCustomBasePoints0,NULL,NULL,true);
 }
 
 void Spell::EffectDismissPet(uint32 i)
@@ -3424,7 +3426,7 @@
     if (px == 0 || py == 0 || pz == 0)
         m_caster->GetClosePoint(NULL, px, py, pz);
 
-    Creature* Charmed = m_caster->SummonCreature(m_spellInfo->EffectMiscValue[i], m_caster->GetMapId(), px, py, pz, m_caster->GetOrientation(),TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,3600000);
+    Creature* Charmed = m_caster->SummonCreature(m_spellInfo->EffectMiscValue[i], px, py, pz, m_caster->GetOrientation(),TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,3600000);
 
     //might not always work correctly, maybe the creature that dies from CoD casts the effect on itself and is therefore the caster?
     Charmed->SetLevel(m_caster->getLevel());
Index: src/game/Unit.cpp
===================================================================
--- src/game/Unit.cpp	(revision 4141)
+++ src/game/Unit.cpp	(working copy)
@@ -830,6 +830,49 @@
     if (triggered) delete spell;                            // triggered spell not self deleted
 }
 
+void Unit::CastCustomSpell(Unit* Victim,uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster)
+{
+    SpellEntry const *spellInfo = sSpellStore.LookupEntry(spellId );
+
+    if(!spellInfo)
+    {
+        sLog.outError("WORLD: unknown spell id %i\n", spellId);
+        return;
+    }
+
+    CastCustomSpell(Victim,spellInfo,bp0,bp1,bp2,triggered,castItem,triggredByAura, originalCaster);
+}
+
+void Unit::CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem, Aura* triggredByAura, uint64 originalCaster)
+{
+    if(!spellInfo)
+    {
+        sLog.outError("WORLD: unknown spell ");
+        return;
+    }
+
+    if (castItem)
+        DEBUG_LOG("WORLD: cast Item spellId - %i", spellInfo->Id);
+
+    Spell *spell = new Spell(this, spellInfo, triggered, triggredByAura,originalCaster);
+
+    if(bp0)
+        spell->m_currentBasePoints[0] = *bp0;
+
+    if(bp1)
+        spell->m_currentBasePoints[1] = *bp1;
+
+    if(bp2)
+        spell->m_currentBasePoints[2] = *bp2;
+
+    SpellCastTargets targets;
+    targets.setUnitTarget( Victim );
+    spell->m_CastItem = castItem;
+    spell->prepare(&targets);
+    m_canMove = false;
+    if (triggered) delete spell;                            // triggered spell not self deleted
+}
+
 void Unit::DealDamageBySchool(Unit *pVictim, SpellEntry const *spellInfo, uint32 *damage, CleanDamage *cleanDamage, bool *crit, bool isTriggeredSpell)
 {
 
@@ -1082,7 +1125,6 @@
 void Unit::PeriodicAuraLog(Unit *pVictim, SpellEntry const *spellProto, Modifier *mod, uint8 effect_idx)
 {
     uint32 procFlag = 0;
-    SpellEntry localSpellProto = *spellProto;
     if(!this || !pVictim || !isAlive() || !pVictim->isAlive())
     {
         return;
@@ -1095,25 +1137,25 @@
     if(mod->m_auraname != SPELL_AURA_PERIODIC_HEAL && mod->m_auraname != SPELL_AURA_OBS_MOD_HEALTH)
     {
         //Calculate armor mitigation if it is a physical spell
-        if (localSpellProto.School == 0)
+        if (spellProto->School == 0)
         {
             uint32 pdamageReductedArmor = CalcArmorReducedDamage(pVictim, pdamage);
             cleanDamage.damage += pdamage - pdamageReductedArmor;
             pdamage = pdamageReductedArmor;
         }
 
-        CalcAbsorbResist(pVictim, localSpellProto.School, pdamage, &absorb, &resist);
+        CalcAbsorbResist(pVictim, spellProto->School, pdamage, &absorb, &resist);
     }
 
     sLog.outDetail("PeriodicAuraLog: %u (TypeId: %u) attacked %u (TypeId: %u) for %u dmg inflicted by %u abs is %u",
-        GetGUIDLow(), GetTypeId(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), pdamage, localSpellProto.Id,absorb);
+        GetGUIDLow(), GetTypeId(), pVictim->GetGUIDLow(), pVictim->GetTypeId(), pdamage, spellProto->Id,absorb);
 
     switch(mod->m_auraname)
     {
         case SPELL_AURA_PERIODIC_DAMAGE:
         case SPELL_AURA_PERIODIC_DAMAGE_PERCENT:
         {
-            pdamage = SpellDamageBonus(pVictim,&localSpellProto,pdamage,DOT);
+            pdamage = SpellDamageBonus(pVictim,spellProto,pdamage,DOT);
 
             if(mod->m_auraname == SPELL_AURA_PERIODIC_DAMAGE_PERCENT)
                 pdamage = GetHealth()*(100+mod->m_amount)/100;
@@ -1121,43 +1163,43 @@
             WorldPacket data(SMSG_PERIODICAURALOG, (21+16));        // we guess size
             data.append(pVictim->GetPackGUID());
             data.append(GetPackGUID());
-            data << uint32(localSpellProto.Id);
+            data << uint32(spellProto->Id);
             data << uint32(1);
             data << uint32(mod->m_auraname);
             data << (uint32)pdamage;
-            data << (uint32)localSpellProto.School;
+            data << (uint32)spellProto->School;
             data << (uint32)absorb;
             data << (uint32)resist;
             SendMessageToSet(&data,true);
 
-            DealDamage(pVictim, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), &cleanDamage, DOT, localSpellProto.School, &localSpellProto, procFlag, true);
-            ProcDamageAndSpell(pVictim, 0, PROC_FLAG_TAKE_DAMAGE, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), &localSpellProto);
+            DealDamage(pVictim, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), &cleanDamage, DOT, spellProto->School, spellProto, procFlag, true);
+            ProcDamageAndSpell(pVictim, 0, PROC_FLAG_TAKE_DAMAGE, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), spellProto);
             break;
         }
         case SPELL_AURA_PERIODIC_HEAL:
         case SPELL_AURA_OBS_MOD_HEALTH:
         {
-            pdamage = SpellHealingBonus(&localSpellProto, pdamage, DOT, pVictim);
+            pdamage = SpellHealingBonus(spellProto, pdamage, DOT, pVictim);
 
             WorldPacket data(SMSG_PERIODICAURALOG, (21+16));        // we guess size
             data.append(pVictim->GetPackGUID());
             data.append(GetPackGUID());
-            data << uint32(localSpellProto.Id);
+            data << uint32(spellProto->Id);
             data << uint32(1);
             data << uint32(mod->m_auraname);
             data << (uint32)pdamage;
             SendMessageToSet(&data,true);
 
             int32 gain = pVictim->ModifyHealth(pdamage);
-            pVictim->getHostilRefManager().threatAssist(this, float(gain) * 0.5f, localSpellProto.School, &localSpellProto);
+            pVictim->getHostilRefManager().threatAssist(this, float(gain) * 0.5f, spellProto->School, spellProto);
 
             // heal for caster damage
-            if(pVictim!=this && localSpellProto.SpellVisual==163)
+            if(pVictim!=this && spellProto->SpellVisual==163)
             {
-                uint32 dmg = localSpellProto.manaPerSecond;
+                uint32 dmg = spellProto->manaPerSecond;
                 if(GetHealth() <= dmg && GetTypeId()==TYPEID_PLAYER)
                 {
-                    RemoveAurasDueToSpell(localSpellProto.Id);
+                    RemoveAurasDueToSpell(spellProto->Id);
                     if(m_currentSpell)
                     {
                         if(m_currentSpell->IsChanneledSpell())
@@ -1167,38 +1209,38 @@
                 }
                 else
                 {
-                    SendSpellNonMeleeDamageLog(this, localSpellProto.Id, gain, localSpellProto.School, 0, 0, false, 0, false);
-                    DealDamage(this, gain, &cleanDamage, NODAMAGE, localSpellProto.School, &localSpellProto, PROC_FLAG_HEAL, true);
+                    SendSpellNonMeleeDamageLog(this, spellProto->Id, gain, spellProto->School, 0, 0, false, 0, false);
+                    DealDamage(this, gain, &cleanDamage, NODAMAGE, spellProto->School, spellProto, PROC_FLAG_HEAL, true);
                 }
             }
 
             if(mod->m_auraname == SPELL_AURA_PERIODIC_HEAL && pVictim != this)
-                ProcDamageAndSpell(pVictim, PROC_FLAG_HEAL, PROC_FLAG_HEALED, pdamage, &localSpellProto);
+                ProcDamageAndSpell(pVictim, PROC_FLAG_HEAL, PROC_FLAG_HEALED, pdamage, spellProto);
             break;
         }
         case SPELL_AURA_PERIODIC_LEECH:
         {
-            float multiplier = localSpellProto.EffectMultipleValue[effect_idx] > 0 ? localSpellProto.EffectMultipleValue[effect_idx] : 1;
+            float multiplier = spellProto->EffectMultipleValue[effect_idx] > 0 ? spellProto->EffectMultipleValue[effect_idx] : 1;
             uint32 pdamage = mod->m_amount;
 
-            pdamage = SpellDamageBonus(pVictim,&localSpellProto,pdamage,DOT);
+            pdamage = SpellDamageBonus(pVictim,spellProto,pdamage,DOT);
 
             if(pVictim->GetHealth() < pdamage)
                 pdamage = uint32(pVictim->GetHealth());
 
-            SendSpellNonMeleeDamageLog(pVictim, localSpellProto.Id, pdamage, localSpellProto.School, absorb, resist, false, 0);
-            DealDamage(pVictim, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), &cleanDamage, DOT, localSpellProto.School, &localSpellProto, procFlag, false);
-            ProcDamageAndSpell(pVictim, PROC_FLAG_HIT_SPELL, PROC_FLAG_TAKE_DAMAGE, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), &localSpellProto);
+            SendSpellNonMeleeDamageLog(pVictim, spellProto->Id, pdamage, spellProto->School, absorb, resist, false, 0);
+            DealDamage(pVictim, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), &cleanDamage, DOT, spellProto->School, spellProto, procFlag, false);
+            ProcDamageAndSpell(pVictim, PROC_FLAG_HIT_SPELL, PROC_FLAG_TAKE_DAMAGE, (pdamage <= absorb+resist) ? 0 : (pdamage-absorb-resist), spellProto);
             if (!pVictim->isAlive() && m_currentSpell)
                 if (m_currentSpell->m_spellInfo)
-                    if (m_currentSpell->m_spellInfo->Id == localSpellProto.Id)
+                    if (m_currentSpell->m_spellInfo->Id == spellProto->Id)
                         m_currentSpell->cancel();
 
             int32 gain = ModifyHealth(int32(pdamage * multiplier));
-            getHostilRefManager().threatAssist(this, float(gain) * 0.5f, localSpellProto.School, &localSpellProto);
+            getHostilRefManager().threatAssist(this, float(gain) * 0.5f, spellProto->School, spellProto);
 
             if(GetTypeId() == TYPEID_PLAYER)
-                SendHealSpellOnPlayer(this, localSpellProto.Id, uint32(pdamage * multiplier));
+                SendHealSpellOnPlayer(this, spellProto->Id, uint32(pdamage * multiplier));
             break;
         }
         case SPELL_AURA_PERIODIC_MANA_LEECH:
@@ -1212,12 +1254,12 @@
 
             pVictim->ModifyPower(power, -drain_amount);
 
-            float gain_multiplier = GetMaxPower(power) > 0 ? localSpellProto.EffectMultipleValue[effect_idx] : 0;
+            float gain_multiplier = GetMaxPower(power) > 0 ? spellProto->EffectMultipleValue[effect_idx] : 0;
 
             WorldPacket data(SMSG_PERIODICAURALOG, (21+16));    // we guess size
             data.append(pVictim->GetPackGUID());
             data.append(GetPackGUID());
-            data << uint32(localSpellProto.Id);
+            data << uint32(spellProto->Id);
             data << uint32(1);
             data << uint32(mod->m_auraname);
             data << (uint32)power;                              // power type
@@ -1230,7 +1272,7 @@
             if(gain_amount)
             {
                 int32 gain = ModifyPower(power,gain_amount);
-                pVictim->AddThreat(this, float(gain) * 0.5f, localSpellProto.School, &localSpellProto);
+                pVictim->AddThreat(this, float(gain) * 0.5f, spellProto->School, spellProto);
             }
             break;
         }
@@ -1247,7 +1289,7 @@
             WorldPacket data(SMSG_PERIODICAURALOG, (21+16));    // we guess size
             data.append(pVictim->GetPackGUID());
             data.append(GetPackGUID());
-            data << uint32(localSpellProto.Id);
+            data << uint32(spellProto->Id);
             data << uint32(1);
             data << uint32(mod->m_auraname);
             data << (uint32)power;                              // power type
@@ -1255,7 +1297,7 @@
             SendMessageToSet(&data,true);
 
             int32 gain = pVictim->ModifyPower(power,mod->m_amount);
-            pVictim->getHostilRefManager().threatAssist(this, float(gain) * 0.5f, localSpellProto.School, &localSpellProto);
+            pVictim->getHostilRefManager().threatAssist(this, float(gain) * 0.5f, spellProto->School, spellProto);
             break;
         }
         case SPELL_AURA_OBS_MOD_MANA:
@@ -1266,7 +1308,7 @@
             WorldPacket data(SMSG_PERIODICAURALOG, (21+16));        // we guess size
             data.append(pVictim->GetPackGUID());
             data.append(GetPackGUID());
-            data << uint32(localSpellProto.Id);
+            data << uint32(spellProto->Id);
             data << uint32(1);
             data << uint32(mod->m_auraname);
             data << (uint32)mod->m_amount;
@@ -1274,7 +1316,7 @@
             SendMessageToSet(&data,true);
 
             int32 gain = ModifyPower(POWER_MANA, mod->m_amount);
-            getHostilRefManager().threatAssist(this, float(gain) * 0.5f, localSpellProto.School, &localSpellProto);
+            getHostilRefManager().threatAssist(this, float(gain) * 0.5f, spellProto->School, spellProto);
             break;
         }
     }
@@ -3444,21 +3486,20 @@
             if(!pVictim)
                 return;
 
-            SpellEntry const *igniteDotTemplate = sSpellStore.LookupEntry(12654);
-            SpellEntry igniteDot = *igniteDotTemplate;
+            int32 igniteDotBasePoints0;
 
             switch (dummySpell->Id)
             {
-                case 11119: igniteDot.EffectBasePoints[0]=int32(0.04f*damage)-1; break;
-                case 11120: igniteDot.EffectBasePoints[0]=int32(0.08f*damage)-1; break;
-                case 12846: igniteDot.EffectBasePoints[0]=int32(0.12f*damage)-1; break;
-                case 12847: igniteDot.EffectBasePoints[0]=int32(0.16f*damage)-1; break;
-                case 12848: igniteDot.EffectBasePoints[0]=int32(0.20f*damage)-1; break;
+                case 11119: igniteDotBasePoints0=int32(0.04f*damage)-1; break;
+                case 11120: igniteDotBasePoints0=int32(0.08f*damage)-1; break;
+                case 12846: igniteDotBasePoints0=int32(0.12f*damage)-1; break;
+                case 12847: igniteDotBasePoints0=int32(0.16f*damage)-1; break;
+                case 12848: igniteDotBasePoints0=int32(0.20f*damage)-1; break;
                 default:
                     sLog.outError("Unit::HandleDummyAuraProc: non handled spell id: %u (IG)",dummySpell->Id);
                     return;
             };
-            CastSpell(pVictim, &igniteDot, true, NULL, triggredByAura);
+            CastCustomSpell(pVictim, 12654, &igniteDotBasePoints0, NULL, NULL, true, NULL, triggredByAura);
             return;
         }
 
@@ -3480,10 +3521,8 @@
 
             if(triggredByAura->GetCasterGUID() == pVictim->GetGUID())
             {
-                SpellEntry const *VEHealTemplate = sSpellStore.LookupEntry(15290);
-                SpellEntry VEHeal = *VEHealTemplate;
-                VEHeal.EffectBasePoints[0] = triggredByAura->GetModifier()->m_amount*damage/100; //VEHeal has a BaseDice of 0, so no decrement needed
-                pVictim->CastSpell(pVictim, &VEHeal, true, NULL, triggredByAura);
+                int32 VEHealBasePoints0 = triggredByAura->GetModifier()->m_amount*damage/100; //VEHeal has a BaseDice of 0, so no decrement needed
+                pVictim->CastCustomSpell(pVictim, 15290, &VEHealBasePoints0, NULL, NULL, true, NULL, triggredByAura);
             }
             return;
 
@@ -3499,10 +3538,8 @@
             if(backDamage > GetMaxHealth()/2)
                 backDamage = GetMaxHealth()/2;
 
-            SpellEntry const *YYDamageTemplate = sSpellStore.LookupEntry(25997);
-            SpellEntry YYDamage = *YYDamageTemplate;
-            YYDamage.EffectBasePoints[0] = backDamage-1;
-            CastSpell(pVictim, &YYDamage, true, NULL, triggredByAura);
+            int32 YYDamageBasePoints0 = backDamage-1;
+            CastCustomSpell(pVictim, 25997, &YYDamageBasePoints0, NULL, NULL, true, NULL, triggredByAura);
 
             return;
         }
@@ -3517,10 +3554,8 @@
             // if healed by another unit (pVictim)
             if(this != pVictim)
             {
-                SpellEntry const *SAHealTemplate = sSpellStore.LookupEntry(31786);
-                SpellEntry SAHeal = *SAHealTemplate;
-                SAHeal.EffectBasePoints[0] = triggredByAura->GetModifier()->m_amount*damage/100-1;
-                CastSpell(this, &SAHeal, true, NULL, triggredByAura);
+                int32 SAHealBasePoints0 = triggredByAura->GetModifier()->m_amount*damage/100-1;
+                CastCustomSpell(this, 31786, &SAHealBasePoints0, NULL, NULL, true, NULL, triggredByAura);
             }
 
             return;
@@ -3539,10 +3574,8 @@
 
         if(triggredByAura->GetCasterGUID() == pVictim->GetGUID())
         {
-            SpellEntry const *VTEnergizeTemplate = sSpellStore.LookupEntry(34919);
-            SpellEntry VTEnergize = *VTEnergizeTemplate;
-            VTEnergize.EffectBasePoints[0] = triggredByAura->GetModifier()->m_amount*damage/100 - 1;
-            pVictim->CastSpell(pVictim,&VTEnergize,true,NULL, triggredByAura);
+            int32 VTEnergizeBasePoints0 = triggredByAura->GetModifier()->m_amount*damage/100 - 1;
+            pVictim->CastCustomSpell(pVictim,34919,&VTEnergizeBasePoints0,NULL,NULL,true,NULL, triggredByAura);
         }
         return;
     }
@@ -3564,10 +3597,8 @@
         {
             //Mana Surge (Shaman T1 bonus)
             //Effect: 23571
-            SpellEntry const *ManaSurgeTemplate = sSpellStore.LookupEntry(23571);
-            SpellEntry ManaSurgeSpell = *ManaSurgeTemplate;
-            ManaSurgeSpell.EffectBasePoints[0] = procSpell->manaCost * 35/100;
-            CastSpell(this, &ManaSurgeSpell, true, NULL, triggredByAura);
+            int32 manaSurgeSpellBasePoints0 = procSpell->manaCost * 35/100;
+            CastCustomSpell(this, 23571, &manaSurgeSpellBasePoints0, NULL, NULL, true, NULL, triggredByAura);
             return;
         }    
         case 113:
@@ -3579,10 +3610,8 @@
             {
                 if ((*i)->GetModifier()->m_miscvalue == SPELLMOD_CHANCE_OF_SUCCESS && (*i)->GetSpellProto()->SpellIconID == 113)
                 {
-                    SpellEntry const *impDrainSoulTemplate = sSpellStore.LookupEntry(18371);
-                    SpellEntry impDrainSoul = *impDrainSoulTemplate;
-                    impDrainSoul.EffectBasePoints[0] = (*i)->GetSpellProto()->EffectBasePoints[2] * GetMaxPower(POWER_MANA) / 100;
-                    CastSpell(this, &impDrainSoul, true, NULL, triggredByAura);
+                    int32 impDrainSoulBasePoints0 = (*i)->GetSpellProto()->EffectBasePoints[2] * GetMaxPower(POWER_MANA) / 100;
+                    CastCustomSpell(this, 18371, &impDrainSoulBasePoints0, NULL, NULL, true, NULL, triggredByAura);
                 }
             }
             return;
@@ -3626,11 +3655,9 @@
                         originalSpell = HSSpell;
                     }
 
-                    SpellEntry const *ILManaTemplate = sSpellStore.LookupEntry(20272);
-                    SpellEntry ILManaSpell = *ILManaTemplate;
-                    ILManaSpell.EffectBasePoints[0] = originalSpell->manaCost;
                     // BasePoints = val -1 not required (EffectBaseDice==0)
-                    CastSpell(this, &ILManaSpell, true, NULL, triggredByAura);
+                    int32 ILManaSpellBasePoints0 = originalSpell->manaCost;
+                    CastCustomSpell(this, 20272, &ILManaSpellBasePoints0, NULL, NULL, true, NULL, triggredByAura);
                     return;
                 }
             }
@@ -3642,10 +3669,8 @@
             //Cooldown: 6 secs
             if (triggredByAura->GetModifier()->m_amount == 0)
                 break;
-            SpellEntry const *improvedLotPTemplate = sSpellStore.LookupEntry(34299);
-            SpellEntry improvedLotP = *improvedLotPTemplate;
-            improvedLotP.EffectBasePoints[0] = triggredByAura->GetModifier()->m_amount * GetMaxHealth() / 100 - 1;
-            CastSpell(this, &improvedLotP, true, NULL, triggredByAura);
+            int32 improvedLotPBasePoints0 = triggredByAura->GetModifier()->m_amount * GetMaxHealth() / 100 - 1;
+            CastCustomSpell(this, 34299, &improvedLotPBasePoints0, NULL, NULL, true, NULL, triggredByAura);
             if (GetTypeId() == TYPEID_PLAYER)
                 ((Player*)this)->AddSpellCooldown(34299,0,time(NULL) + 6);
             return;
@@ -3682,12 +3707,9 @@
                     return;
             }
 
-            SpellEntry const *BRHealTemplate = sSpellStore.LookupEntry(EffectId);
-            SpellEntry BRHeal = *BRHealTemplate;
-
             int32 heal_amount = damage * triggredByAura->GetModifier()->m_amount / 100;
-            BRHeal.EffectBasePoints[0] = heal_amount/3-1;
-            CastSpell(this, &BRHeal, true, NULL, triggredByAura);
+            int32 BRHealBasePoints0 = heal_amount/3-1;
+            CastCustomSpell(this, EffectId, &BRHealBasePoints0, NULL, NULL, true, NULL, triggredByAura);
             return;
         }
         case 2006:
@@ -5309,7 +5331,7 @@
 //======================================================================
 //======================================================================
 
-int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index)
+int32 Unit::CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 effBasePoints)
 {
     int32 value = 0;
     uint32 level = 0;
@@ -5322,7 +5344,7 @@
 
     float basePointsPerLevel = spellProto->EffectRealPointsPerLevel[effect_index];
     float randomPointsPerLevel = spellProto->EffectDicePerLevel[effect_index];
-    int32 basePoints = int32(spellProto->EffectBasePoints[effect_index] + level * basePointsPerLevel);
+    int32 basePoints = int32(effBasePoints + level * basePointsPerLevel);
     int32 randomPoints = int32(spellProto->EffectDieSides[effect_index] + level * randomPointsPerLevel);
     float comboDamage = spellProto->EffectPointsPerComboPoint[effect_index];
     uint8 comboPoints=0;
@@ -5484,13 +5506,13 @@
     }
 }
 
-Creature* Unit::SummonCreature(uint32 id, uint32 mapid, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime)
+Creature* Unit::SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime)
 {
     TemporarySummon* pCreature = new TemporarySummon(this,this);
 
     pCreature->SetInstanceId(GetInstanceId());
 
-    if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), mapid, x, y, z, ang, id))
+    if (!pCreature->Create(objmgr.GenerateLowGuid(HIGHGUID_UNIT), GetMapId(), x, y, z, ang, id))
     {
         delete pCreature;
         return NULL;
Index: src/game/Unit.h
===================================================================
--- src/game/Unit.h	(revision 4141)
+++ src/game/Unit.h	(working copy)
@@ -797,6 +797,8 @@
         void SpellNonMeleeDamageLog(Unit *pVictim, uint32 spellID, uint32 damage, bool isTriggeredSpell = false, bool useSpellDamage = true);
         void CastSpell(Unit* Victim, uint32 spellId, bool triggered, Item *castItem = NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0);
         void CastSpell(Unit* Victim,SpellEntry const *spellInfo, bool triggered, Item *castItem= NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0);
+        void CastCustomSpell(Unit* Victim, uint32 spellId, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0);
+        void CastCustomSpell(Unit* Victim,SpellEntry const *spellInfo, int32 const* bp0, int32 const* bp1, int32 const* bp2, bool triggered, Item *castItem= NULL, Aura* triggredByAura = NULL, uint64 originalCaster = 0);
         bool IsDamageToThreatSpell(SpellEntry const * spellInfo) const;
 
         void DeMorph();
@@ -995,8 +997,8 @@
         void _RemoveAllAuraMods();
         void _ApplyAllAuraMods();
 
-        int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index);
-        Creature* SummonCreature(uint32 id, uint32 mapid, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime);
+        int32 CalculateSpellDamage(SpellEntry const* spellProto, uint8 effect_index, int32 basePoints);
+        Creature* SummonCreature(uint32 id, float x, float y, float z, float ang,TempSummonType spwtype,uint32 despwtime);
 
         void addFollower(FollowerReference* pRef) { m_FollowingRefManager.insertFirst(pRef); }
         void removeFollower(FollowerReference* pRef) {  } // nothing to do yet
Index: src/game/World.cpp
===================================================================
--- src/game/World.cpp	(revision 4141)
+++ src/game/World.cpp	(working copy)
@@ -991,7 +991,7 @@
                 float z = step.script->z;
                 float o = step.script->o;
 
-                Creature* pCreature = ((Unit*)step.source)->SummonCreature(step.script->datalong,((Unit*)step.source)->GetMapId(), x, y, z, o,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,step.script->datalong2);
+                Creature* pCreature = ((Unit*)step.source)->SummonCreature(step.script->datalong, x, y, z, o,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,step.script->datalong2);
                 if (!pCreature)
                 {
                     sLog.outError("SCRIPT_COMMAND_TEMP_SUMMON failed for creature (entry: %u).",step.script->datalong);
Index: src/shared/Database/DBCStructure.h
===================================================================
--- src/shared/Database/DBCStructure.h	(revision 4141)
+++ src/shared/Database/DBCStructure.h	(working copy)
@@ -354,7 +354,7 @@
     uint32    EffectBaseDice[3];                            //70-72
     float     EffectDicePerLevel[3];                        //73-75
     float     EffectRealPointsPerLevel[3];                  //76-78
-    int32     EffectBasePoints[3];                          //79-81
+    int32     EffectBasePoints[3];                          //79-81 (don't must be used in spell/auras explicitly, must be used cached Spell::m_currentBasePoints)
                                                             //82-84 not used
     uint32    EffectImplicitTargetA[3];                     //85-87
     uint32    EffectImplicitTargetB[3];                     //88-90
@@ -393,6 +393,10 @@
     //uint32    unk3[3];                                    //205-207 not used null
     uint32    TotemCategory[2];                             //208-209
     uint32    AreaId;                                       //210
+
+private:
+    // prevent creating custom entries (copy data from original infact)
+    SpellEntry(SpellEntry const&);                          // DON'T must have implementation
 };
 
 typedef std::set<uint32> SpellCategorySet;