All pastes #982451 Raw Edit

Stuff

public text v1 · immutable
·published 2008-04-12 16:01 UTC
rendered paste body
Index: game/Player.cpp
===================================================================
--- game/Player.cpp	(revision 5609)
+++ game/Player.cpp	(working copy)
@@ -14742,6 +14742,148 @@
         data << uint32(0x8e8b) << uint64(0);                // if count = 3
 
         GetSession()->SendPacket(&data);
+
+
+		// Check for Master's dummy spells
+        if(pet->isControlled() && (pet->getPetType() == HUNTER_PET || cinfo && cinfo->type == CREATURE_TYPE_DEMON && getClass() == CLASS_WARLOCK))
+        {
+            for(PetSpellMap::iterator itr = pet->m_spells.begin();itr != pet->m_spells.end();itr++)
+            {
+                if(itr->second->state == PETSPELL_REMOVED)
+                    continue;
+                ++addlist;
+            }
+
+
+            Unit::AuraList const& dummyList = GetAurasByType(SPELL_AURA_DUMMY);
+            for(Unit::AuraList::const_iterator itr = dummyList.begin();itr!=dummyList.end();++itr)
+            {
+                uint32 MD = 0;
+
+                switch((*itr)->GetSpellProto()->Id)
+                {
+                // Spirit Bond
+                case 19578:
+                    pet->CastSpell(pet, 19579, true);
+                    break;
+                case 20895:
+                    pet->CastSpell(pet, 24529, true);
+                    break;
+                // Stalker's Ally
+                case 28757:
+                    pet->CastSpell(pet, 28758, true);
+                    break;
+                // Master Demonologist
+                case 23785:
+                {
+                    switch(pet->GetEntry())
+                    {
+                        case 416: MD = 23759; break;	// imp
+                        case 1860: MD = 23760; break;	// voidwalker
+                        case 1863: MD = 23761; break;	// succubus
+                        case 417: MD = 23762; break;	// felhunter
+                        case 17252: MD = 35702; break;	// felguard
+                        default: break;
+                    }
+                    if(MD) pet->CastSpell(pet, MD, true);
+                    break;
+                }
+                case 23822:
+                {
+                    switch(pet->GetEntry())
+                    { 
+                        case 416: MD = 23826; break;	// imp
+                        case 1860: MD = 23841; break;	// voidwalker
+                        case 1863: MD = 23833; break;	// succubus
+                        case 417: MD = 23837; break;	// felhunter
+                        case 17252: MD = 35703; break;	// felguard
+                        default: break;
+                    }
+                    if(MD) pet->CastSpell(pet, MD, true);
+                    break;
+                }
+                case 23823:
+                {
+                    switch(pet->GetEntry())
+                    {
+                        case 416: MD = 23827; break;	// imp
+                        case 1860: MD = 23842; break;	// voidwalker
+                        case 1863: MD = 23834; break;	// succubus
+                        case 417: MD = 23838; break;	// felhunter
+                        case 17252: MD = 35704; break;	// felguard
+                        default: break;
+                    }
+                    if(MD) pet->CastSpell(pet, MD, true);
+                    break;
+                }
+                case 23824:
+                {
+                    switch(pet->GetEntry())
+                    {
+                        case 416: MD = 23828; break;	// imp
+			            case 1860: MD = 23842; break;	// voidwalker
+			            case 1863: MD = 23835; break;	// succubus
+			            case 417: MD = 23839; break;	// felhunter
+			            case 17252: MD = 35705; break;	// felguard
+			            default: break;
+                    }
+                    if(MD) pet->CastSpell(pet, MD, true);
+			        break;
+                }
+		        case 23825:
+                {
+			        switch(pet->GetEntry())
+			        {
+			            case 416: MD = 23829; break;	// imp
+			            case 1860: MD = 23844; break;	// voidwalker
+                        case 1863: MD = 23836; break;	// succubus
+                        case 417: MD = 23840; break;	// felhunter
+                        case 17252: MD = 35706; break;	// felguard
+                        default: break;
+                    }
+                    if(MD) pet->CastSpell(pet, MD, true);
+                    break;
+                }
+                // Focused Fire
+		        case 35029:
+			        pet->CastSpell(pet, 35060, true);
+                    break;
+		        case 35030:
+			        pet->CastSpell(pet, 35061, true);
+                    break;
+                // Demonic Knowledge
+                case 35691:
+                case 35692:
+                case 35693:
+                {
+                    int32 DemonKnowledgeBasePoints0 = (*itr)->GetModifier()->m_amount;
+                    DemonKnowledgeBasePoints0 = int32( DemonKnowledgeBasePoints0 * (pet->GetStat(STAT_STAMINA) + pet->GetStat(STAT_INTELLECT)) / 100.0f );
+                    pet->CastCustomSpell(pet,35696,&DemonKnowledgeBasePoints0, NULL, NULL, true );
+                    break;
+                }
+                default: break;
+                }
+            }
+			// Focused Fire is has SPELL_AURA_ADD_FLAT_MODIFIER :-/
+            Unit::AuraList const& flatModList = GetAurasByType(SPELL_AURA_ADD_FLAT_MODIFIER);
+            for(Unit::AuraList::const_iterator itr = flatModList.begin();itr!=flatModList.end();++itr)
+            {
+                switch((*itr)->GetSpellProto()->Id)
+                {
+                // Focused Fire
+		        case 35029:
+			        pet->CastSpell(pet, 35060, true);
+                    break;
+		        case 35030:
+			        pet->CastSpell(pet, 35061, true);
+                    break;
+                default: break;
+                }
+            }
+            // done
+
+
+        }
     }
 }
 
Index: game/Player.h
===================================================================
--- game/Player.h	(revision 5609)
+++ game/Player.h	(working copy)
@@ -83,6 +83,13 @@
     Spell const* lastAffected;
 };
 
+enum PetLink
+{
+    PETLINK_NONE = 0,
+    PETLINK_BOTH   = 1,
+    PETLINK_MASTER = 2,
+};
+
 typedef HM_NAMESPACE::hash_map<uint16, PlayerSpell*> PlayerSpellMap;
 typedef std::list<SpellModifier*> SpellModList;
 
Index: game/SpellAuras.cpp
===================================================================
--- game/SpellAuras.cpp	(revision 5609)
+++ game/SpellAuras.cpp	(working copy)
@@ -307,7 +307,8 @@
 m_procCharges(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),
-m_periodicTimer(0), m_PeriodicEventId(0), m_updated(false), m_removeOnDeath(false),m_fearMoveAngle(0), m_isRemovedOnShapeLost(true)
+m_periodicTimer(0), m_PeriodicEventId(0), m_updated(false), m_removeOnDeath(false),m_fearMoveAngle(0), m_isRemovedOnShapeLost(true),
+m_PetLink(PETLINK_NONE)
 {
     assert(target);
 
@@ -415,6 +416,11 @@
     m_radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(GetSpellProto()->EffectRadiusIndex[m_effIndex]));
     if(Player* modOwner = caster_ptr->GetSpellModOwner())
         modOwner->ApplySpellMod(GetSpellProto()->Id, SPELLMOD_RADIUS, m_radius);
+
+	if (spellproto->Effect[eff] == 119)
+	    m_PetLink = PETLINK_BOTH;
+    else if (spellproto->Effect[eff] == 143)
+        m_PetLink = PETLINK_MASTER;
 }
 
 AreaAura::~AreaAura()
@@ -605,7 +611,7 @@
                 pGroup = ((Player*)owner)->GetGroup();
         }
 
-        if(pGroup)
+		if(pGroup && m_PetLink == PETLINK_NONE)
         {
             for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
             {
@@ -733,6 +739,10 @@
 {
     AuraType aura = m_modifier.m_auraname;
 
+    // Master Type of Auras will add effects only on Master
+    if (m_target && m_PetLink == PETLINK_MASTER && m_target->GetTypeId() != TYPEID_PLAYER)
+        return;
+
     if(aura<TOTAL_AURAS)
         (*this.*AuraHandler [aura])(apply,Real);
 }
Index: game/SpellAuras.h
===================================================================
--- game/SpellAuras.h	(revision 5609)
+++ game/SpellAuras.h	(working copy)
@@ -252,6 +252,7 @@
         bool IsPersistent() const { return m_isPersistent; }
         bool IsDeathPersistent() const { return m_isDeathPersist; }
         bool IsRemovedOnShapeLost() const { return m_isRemovedOnShapeLost; }
+        PetLink GetPetLink() const { return m_PetLink; }
 
         virtual void Update(uint32 diff);
         void ApplyModifier(bool apply, bool Real = false);
@@ -305,6 +306,7 @@
         uint32 m_PeriodicEventId;
         bool m_updated;
         bool m_removeOnDeath;
+		PetLink m_PetLink;
     private:
         void UpdateSlotCounterAndDuration(bool add);
         void CleanupTriggeredSpells();
Index: game/SpellEffects.cpp
===================================================================
--- game/SpellEffects.cpp	(revision 5609)
+++ game/SpellEffects.cpp	(working copy)
@@ -201,7 +201,7 @@
     &Spell::EffectNULL,                                     //140 SPELL_EFFECT_140
     &Spell::EffectNULL,                                     //141 SPELL_EFFECT_141
     &Spell::EffectTriggerSpellWithValue,                    //142 SPELL_EFFECT_TRIGGER_SPELL_WITH_VALUE
-    &Spell::EffectNULL,                                     //143 SPELL_EFFECT_143 probably apply aura again :)
+    &Spell::EffectApplyPetAura,                             //143 SPELL_EFFECT_143 probably apply aura again :)
     &Spell::EffectNULL,                                     //144 SPELL_EFFECT_144
     &Spell::EffectNULL,                                     //145 SPELL_EFFECT_145
     &Spell::EffectNULL,                                     //146 SPELL_EFFECT_146
@@ -885,6 +885,16 @@
                     m_caster->CastSpell(m_caster,spell_id,true,NULL);
                     return;
                 }
+                case 19028:                                 // Soul Link
+                {
+                    if (!unitTarget)
+                        return;
+
+                    // Pet will cast aura
+                    unitTarget->CastSpell(unitTarget,25228,true,NULL);
+                    return;
+                }
+
             }
 
             //All IconID Check in there
@@ -4955,17 +4965,17 @@
 
 void Spell::EffectApplyPetAura(uint32 i)
 {
-    //spell aura for both pet and owner, think the pet has the aura and applies it to owner
-    EffectApplyAura(i);
+    if(!unitTarget)
+        return;
+    if(!unitTarget->isAlive())
+        return;
 
-    Unit* owner = unitTarget->GetCharmerOrOwner();
-    if(owner)
-    {
-        unitTarget = owner;
-        EffectApplyAura(i);
-    }
+    // use area aura
+    AreaAura* Aur = new AreaAura(m_spellInfo, i, &m_currentBasePoints[i], unitTarget, m_caster);
+    unitTarget->AddAura(Aur);
 }
 
+
 void Spell::EffectSummonDemon(uint32 i)
 {
     float px = m_targets.m_destX;
Index: game/Unit.cpp
===================================================================
--- game/Unit.cpp	(revision 5609)
+++ game/Unit.cpp	(working copy)
@@ -4154,7 +4154,7 @@
             }
 
             //float radius =  GetRadius(sSpellRadiusStore.LookupEntry((*i).second->GetSpellProto()->EffectRadiusIndex[(*i).second->GetEffIndex()]));
-            if(pGroup && pGroupOf)
+            if(pGroup && pGroupOf && (*i).second->GetPetLink() == PETLINK_NONE)
             {
                 for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
                 {