Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. void Spell::EffectSummonPossessed(SpellEffectIndex eff_idx)
  2. {
  3.     uint32 creature_entry = m_spellInfo->EffectMiscValue[eff_idx];
  4.     if(!creature_entry)
  5.         return;
  6.  
  7.     int32 duration = GetSpellDuration(m_spellInfo);
  8.  
  9.         float px, py, pz;
  10.     // If dest location if present
  11.     if (m_targets.m_targetMask & TARGET_FLAG_DEST_LOCATION)
  12.     {
  13.         // Summon 1 unit in dest location
  14.         px = m_targets.m_destX;
  15.         py = m_targets.m_destY;
  16.         pz = m_targets.m_destZ;
  17.     }
  18.     // Summon if dest location not present near caster
  19.     else
  20.         m_caster->GetClosePoint(px,py,pz,1.0f);
  21.  
  22.     TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_OR_DEAD_DESPAWN;
  23.     Creature *summon = m_caster->SummonCreature(creature_entry,px,py,pz,m_caster->GetOrientation(),summonType,duration);
  24.  
  25.     summon->addUnitState(UNIT_STAT_CONTROLLED);
  26.     summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PLAYER_CONTROLLED);
  27.     summon->SetCharmerGuid(m_caster->GetGUID());
  28.     summon->setFaction(m_caster->getFaction());
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement