Pelf

Pelf raise ally 1 (lich king)

May 4th, 2012
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 7.26 KB | None | 0 0
  1. diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
  2. index 2af6b4c..ca75c1c 100755
  3. --- a/src/server/game/Entities/Creature/TemporarySummon.cpp
  4. +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
  5. @@ -243,9 +243,13 @@ void TempSummon::UnSummon(uint32 msTime)
  6.      }
  7.  
  8.      Unit* owner = GetSummoner();
  9. +   if (owner && GetEntry() == 30230) // Risen ally
  10. +   {
  11. +       owner->RemoveAurasDueToSpell(62218);
  12. +       owner->RemoveAurasDueToSpell(46619);
  13. +   }
  14.      if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
  15.          owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
  16.  
  17. diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
  18. index 829eb73..bae305b 100755
  19. --- a/src/server/game/Entities/Creature/TemporarySummon.h
  20. +++ b/src/server/game/Entities/Creature/TemporarySummon.h
  21. @@ -54,7 +54,7 @@ class Minion : public TempSummon
  22.          Unit* GetOwner() { return m_owner; }
  23.          float GetFollowAngle() const { return m_followAngle; }
  24.          void SetFollowAngle(float angle) { m_followAngle = angle; }
  25. -        bool IsPetGhoul() const {return GetEntry() == 26125;} // Ghoul may be guardian or pet
  26. +        bool IsPetGhoul() const {return (GetEntry() == 26125 || GetEntry() == 30230);} // Ghoul may be guardian or pet
  27.          bool IsGuardianPet() const;
  28.      protected:
  29.          Unit* const m_owner;
  30. diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
  31. index 9366672..747808b 100755
  32. --- a/src/server/game/Entities/Unit/Unit.cpp
  33. +++ b/src/server/game/Entities/Unit/Unit.cpp
  34. @@ -12840,7 +12840,7 @@ void Unit::setDeathState(DeathState s)
  35.      // it can be used to check creation of death items (such as soul shards).
  36.      m_deathState = s;
  37.  
  38. -    if (s != ALIVE && s != JUST_ALIVED)
  39. +    if (s != ALIVE && s != JUST_ALIVED && s != GHOULED)
  40.      {
  41.          CombatStop();
  42.          DeleteThreatList();
  43. diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
  44. index 5a6276d..b260278 100755
  45. --- a/src/server/game/Entities/Unit/Unit.h
  46. +++ b/src/server/game/Entities/Unit/Unit.h
  47. @@ -466,6 +466,7 @@ enum DeathState
  48.      CORPSE      = 2,
  49.      DEAD        = 3,
  50.      JUST_ALIVED = 4,
  51. +   GHOULED     = 5, //Raise ally, Deathknight's spell
  52.  };
  53.  
  54.  enum UnitState
  55. diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
  56. index 31a8e57..19513d0 100755
  57. --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
  58. +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
  59. @@ -5253,8 +5253,34 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
  60.              break;
  61.          case SPELLFAMILY_DEATHKNIGHT:
  62.          {
  63. -            //if (!(mode & AURA_EFFECT_HANDLE_REAL))
  64. -            //    break;
  65. +            if (!(mode & AURA_EFFECT_HANDLE_REAL))
  66. +                break;
  67. +
  68. +           if (GetId() == 46619) // Raise Ally
  69. +           {
  70. +               if (!target || target->GetTypeId() != TYPEID_PLAYER)
  71. +                   break;
  72. +               Player* player = target->ToPlayer();
  73. +               if (apply)
  74. +               {
  75. +                   player->setDeathState(GHOULED);
  76. +                   WorldPacket data(SMSG_PRE_RESURRECT, player->GetPackGUID().size());
  77. +                   data.append(player->GetPackGUID());
  78. +                   player->GetSession()->SendPacket(&data);
  79. +                   player->StopMirrorTimers();
  80. +                   player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, float(1.0f));
  81. +                   player->SetHealth(1);
  82. +                   player->SetMovement(MOVE_ROOT);
  83. +               }
  84. +               else
  85. +               {
  86. +                   player->RemoveAurasDueToSpell(62218);
  87. +                   player->SetMovement(MOVE_UNROOT);
  88. +                   player->SetHealth(0);
  89. +                   player->setDeathState(JUST_DIED);
  90. +               }
  91. +               break;
  92. +           }
  93.              break;
  94.          }
  95.      }
  96. diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
  97. index 28b089f..2fcb2a6 100755
  98. --- a/src/server/game/Spells/Spell.cpp
  99. +++ b/src/server/game/Spells/Spell.cpp
  100. @@ -5565,7 +5565,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
  101.  
  102.      // dead owner (pets still alive when owners ressed?)
  103.      if (Unit* owner = m_caster->GetCharmerOrOwner())
  104. -        if (!owner->isAlive())
  105. +        if (!owner->isAlive() && owner->getDeathState() != GHOULED)
  106.              return SPELL_FAILED_CASTER_DEAD;
  107.  
  108.      if (!target && m_targets.GetUnitTarget())
  109. diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
  110. index d3566c2..43ab326 100755
  111. --- a/src/server/game/Spells/SpellEffects.cpp
  112. +++ b/src/server/game/Spells/SpellEffects.cpp
  113. @@ -4722,6 +4722,20 @@ void Spell::EffectScriptEffect(SpellEffIndex effIndex)
  114.          }
  115.          case SPELLFAMILY_DEATHKNIGHT:
  116.          {
  117. +           if (m_spellInfo->Id == 61999) // Raise Ally
  118. +           {
  119. +               if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER || unitTarget->isAlive())
  120. +               {
  121. +                   SendCastResult(SPELL_FAILED_TARGET_NOT_DEAD);
  122. +                   finish(false);
  123. +                   CancelGlobalCooldown();
  124. +                   m_caster->ToPlayer()->RemoveSpellCooldown(61999);
  125. +                   return;
  126. +               }
  127. +               unitTarget->CastSpell(unitTarget, 46619, true);
  128. +               CancelGlobalCooldown();
  129. +               return;
  130. +           }
  131.              // Pestilence
  132.              if (m_spellInfo->SpellFamilyFlags[1]&0x10000)
  133.              {
  134. diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
  135. index e1cfd07..da37de9 100644
  136. --- a/src/server/scripts/World/npcs_special.cpp
  137. +++ b/src/server/scripts/World/npcs_special.cpp
  138. @@ -2965,6 +2965,66 @@ public:
  139.      };
  140.  };
  141.  
  142. +class npc_risen_ally : public CreatureScript
  143. +{
  144. +public:
  145. +    npc_risen_ally() : CreatureScript("npc_risen_ally") { }
  146. +
  147. +   CreatureAI* GetAI(Creature* creature) const
  148. +    {
  149. +        return new npc_risen_allyAI(creature);
  150. +    }
  151. +
  152. +    struct npc_risen_allyAI : ScriptedAI
  153. +    {
  154. +        npc_risen_allyAI(Creature* creature) : ScriptedAI(creature) {}
  155. +
  156. +        void InitializeAI()
  157. +        {
  158. +           me->setPowerType(POWER_ENERGY);
  159. +           me->SetMaxPower(POWER_ENERGY, 100);
  160. +           me->SetPower(POWER_ENERGY, 100);
  161. +           me->SetSheath(SHEATH_STATE_MELEE);
  162. +           me->SetByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_ABANDONED);
  163. +           me->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
  164. +           me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
  165. +           me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
  166. +           me->SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
  167. +        }
  168. +
  169. +       void Reset()
  170. +       {
  171. +           me->setPowerType(POWER_ENERGY);
  172. +           me->SetMaxPower(POWER_ENERGY, 100);
  173. +       }
  174. +
  175. +       void IsSummonedBy(Unit* owner)
  176. +       {
  177. +           me->setPowerType(POWER_ENERGY);
  178. +           me->SetMaxPower(POWER_ENERGY, 100);
  179. +           me->SetPower(POWER_ENERGY, 100);
  180. +       }
  181. +
  182. +        void JustDied(Unit* /*killer*/)
  183. +        {
  184. +           if (me->GetOwner())
  185. +           {
  186. +               me->GetOwner()->RemoveAurasDueToSpell(62218);
  187. +               me->GetOwner()->RemoveAurasDueToSpell(46619);
  188. +           }
  189. +        }
  190. +
  191. +        void UpdateAI(const uint32 diff)
  192. +        {
  193. +           if (!me->isCharmed())
  194. +               me->DespawnOrUnsummon();
  195. +
  196. +           if (me->isInCombat())
  197. +               DoMeleeAttackIfReady();
  198. +        }
  199. +    };
  200. +};
  201. +
  202.  void AddSC_npcs_special()
  203.  {
  204.      new npc_air_force_bots();
  205. @@ -2997,4 +3057,5 @@ void AddSC_npcs_special()
  206.      new npc_earth_elemental();
  207.      new npc_firework();
  208.      new npc_spring_rabbit();
  209. +   new npc_risen_ally();
  210.  }
Advertisement
Add Comment
Please, Sign In to add comment