Advertisement
Guest User

Untitled

a guest
Nov 14th, 2011
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.39 KB | None | 0 0
  1. diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
  2. index c1cfd68..a3910c9 100644
  3. --- a/src/game/SpellEffects.cpp
  4. +++ b/src/game/SpellEffects.cpp
  5. @@ -4941,6 +4941,34 @@ void Spell::EffectScriptEffect(uint32 effIndex)
  6.                          player->learnSpell(discoveredSpell,false);
  7.                      return;
  8.                  }
  9. +                case 52694:                                     // Recall Eye of Acherus
  10. +                {
  11. +                    if(!m_caster || m_caster->GetTypeId() != TYPEID_UNIT)
  12. +                        return;
  13. +                    
  14. +                    Unit *target = m_caster->GetCharmer();
  15. +                    
  16. +                    if(!target || target->GetTypeId() != TYPEID_PLAYER)
  17. +                        return;
  18. +
  19. +                    m_caster->SetCharmerGUID(0);                        
  20. +                    target->RemoveAurasDueToSpell(51852);       // Remove The Eye of Acherus
  21. +                    
  22. +                    target->SetCharm(NULL);
  23. +
  24. +                    ((Player*)target)->SetFarSightGUID(0);
  25. +                    ((Player*)target)->SetClientControl(m_caster,0);
  26. +
  27. +                    WorldPacket data(SMSG_PET_SPELLS, 8+4);
  28. +                    data << uint64(0);
  29. +                    data << uint32(0);
  30. +                    ((Player*)target)->GetSession()->SendPacket(&data);
  31. +
  32. +                    m_caster->CleanupsBeforeDelete();
  33. +                    m_caster->AddObjectToRemoveList();
  34. +
  35. +                    return;
  36. +                }
  37.              }
  38.              break;
  39.          }
  40. diff --git a/src/game/Spell.h b/src/game/Spell.h
  41. index 3ffa368..cb4dfbb 100644
  42. --- a/src/game/Spell.h
  43. +++ b/src/game/Spell.h
  44. @@ -257,6 +257,7 @@ class Spell
  45.          void EffectPickPocket(uint32 i);
  46.          void EffectAddFarsight(uint32 i);
  47.          void EffectSummonWild(uint32 i);
  48. +        void EffectSummonPosessed(uint32 i);
  49.          void EffectSummonGuardian(uint32 i);
  50.          void EffectHealMechanical(uint32 i);
  51.          void EffectJump(uint32 i);
  52. diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp
  53. index c1cfd68..1a9d440 100644
  54. --- a/src/game/SpellEffects.cpp
  55. +++ b/src/game/SpellEffects.cpp
  56. @@ -3142,12 +3142,14 @@ void Spell::EffectSummonType(uint32 i)
  57.      switch(m_spellInfo->EffectMiscValueB[i])
  58.      {
  59.          case SUMMON_TYPE_GUARDIAN:
  60. -        case SUMMON_TYPE_POSESSED:
  61. -        case SUMMON_TYPE_POSESSED2:
  62. -        case SUMMON_TYPE_FORCE_OF_NATURE:
  63.          case SUMMON_TYPE_GUARDIAN2:
  64. +        case SUMMON_TYPE_FORCE_OF_NATURE:
  65.              EffectSummonGuardian(i);
  66.              break;
  67. +        case SUMMON_TYPE_POSESSED:
  68. +        case SUMMON_TYPE_POSESSED2:
  69. +            EffectSummonPosessed(i);
  70. +            break;
  71.          case SUMMON_TYPE_WILD:
  72.              EffectSummonWild(i);
  73.              break;
  74. @@ -3577,6 +3579,70 @@ void Spell::EffectSummonWild(uint32 i)
  75.      }
  76.  }
  77.  
  78. +void Spell::EffectSummonPosessed(uint32 i)
  79. +{
  80. +    uint32 creature_entry = m_spellInfo->EffectMiscValue[i];
  81. +    if(!creature_entry)
  82. +        return;
  83. +
  84. +    // set timer for unsummon
  85. +    int32 duration = GetSpellDuration(m_spellInfo);
  86. +
  87. +    // in another case summon new
  88. +    uint32 level = m_caster->getLevel();
  89. +
  90. +    float px, py, pz;
  91. +    // If dest location if present
  92. +    if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
  93. +    {
  94. +        // Summon 1 unit in dest location
  95. +        px = m_targets.m_destX;
  96. +        py = m_targets.m_destY;
  97. +        pz = m_targets.m_destZ;
  98. +    }
  99. +    // Summon if dest location not present near caster
  100. +    else
  101. +        m_caster->GetClosePoint(px,py,pz,1.0f);
  102. +
  103. +    TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN;
  104. +
  105. +    Creature *spawnCreature = m_caster->SummonCreature(creature_entry,px,py,pz,m_caster->GetOrientation(),summonType,duration);
  106. +    //spawnCreature->Relocate(px,py,pz,m_caster->GetOrientation());
  107. +
  108. +    if(!spawnCreature->IsPositionValid())
  109. +    {
  110. +        sLog.outError("Pet (guidlow %d, entry %d) not created base at creature. Suggested coordinates isn't valid (X: %f Y: %f)",
  111. +        spawnCreature->GetGUIDLow(), spawnCreature->GetEntry(), spawnCreature->GetPositionX(), spawnCreature->GetPositionY());
  112. +        delete spawnCreature;
  113. +        return;
  114. +    }
  115. +
  116. +    spawnCreature->SetCharmerGUID(m_caster->GetGUID());
  117. +    spawnCreature->SetCreatorGUID(m_caster->GetGUID());
  118. +
  119. +    if(m_caster->GetTypeId()==TYPEID_PLAYER)
  120. +    {
  121. +        ((Player*)m_caster)->SetCharm(spawnCreature);
  122. +        ((Player*)m_caster)->SetFarSightGUID(spawnCreature->GetGUID());
  123. +        ((Player*)m_caster)->SetClientControl(spawnCreature, 1);
  124. +    }
  125. +
  126. +    spawnCreature->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,m_caster->getFaction());
  127. +    spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS,16777224);
  128. +    spawnCreature->SetUInt32Value(UNIT_FIELD_FLAGS_2,162048);
  129. +    spawnCreature->SetUInt32Value(UNIT_FIELD_BYTES_2,1);
  130. +    spawnCreature->SetUInt32Value(UNIT_CREATED_BY_SPELL, m_spellInfo->Id);
  131. +
  132. +    //spawnCreature->AIM_Initialize();
  133. +
  134. +    if(CharmInfo *charmInfo = spawnCreature->InitCharmInfo(spawnCreature))
  135. +        charmInfo->InitPossessCreateSpells();
  136. +
  137. +    if(m_caster->GetTypeId()==TYPEID_PLAYER)
  138. +        ((Player*)m_caster)->PossessSpellInitialize();
  139. +
  140. +}
  141. +
  142.  void Spell::EffectSummonGuardian(uint32 i)
  143.  {
  144.      uint32 pet_entry = m_spellInfo->EffectMiscValue[i];
  145.  
  146.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement