Advertisement
Guest User

Raise Ally

a guest
Jan 5th, 2013
1,734
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.00 KB | None | 0 0
  1. From: devilat <mourdo1@yahoo.com>
  2. Date: Thu, 3 Jan 2013 24:03:40 +0200
  3. Subject: [PATCH] Core/Spell: Implement Raise ally
  4.  
  5. ---
  6. sql/raise_ally.sql | 3 +
  7. .../game/Entities/Creature/TemporarySummon.cpp | 5 ++
  8. .../game/Entities/Creature/TemporarySummon.h | 2 +-
  9. src/server/game/Entities/Unit/Unit.cpp | 2 +-
  10. src/server/game/Entities/Unit/Unit.h | 3 +-
  11. src/server/game/Spells/Auras/SpellAuraEffects.cpp | 29 +++++++++-
  12. src/server/game/Spells/Spell.cpp | 2 +-
  13. src/server/game/Spells/SpellEffects.cpp | 15 +++++
  14. .../EasternKingdoms/eastern_plaguelands.cpp | 2 +-
  15. src/server/scripts/World/npcs_special.cpp | 60 ++++++++++++++++++++
  16. 10 files changed, 116 insertions(+), 7 deletions(-)
  17. create mode 100644 sql/raise_ally.sql
  18.  
  19. diff --git a/sql/raise_ally.sql b/sql/raise_ally.sql
  20. new file mode 100644
  21. index 0000000..86948f5
  22. --- /dev/null
  23. +++ b/sql/raise_ally.sql
  24. @@ -0,0 +1,3 @@
  25. +DELETE FROM creature_template WHERE entry = 30230;
  26. +INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction_A`, `faction_H`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `mindmg`, `maxdmg`, `dmgschool`, `attackpower`, `dmg_multiplier`, `baseattacktime`, `rangeattacktime`, `unit_class`, `unit_flags`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `minrangedmg`, `maxrangedmg`, `rangedattackpower`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `Health_mod`, `Mana_mod`, `Armor_mod`, `RacialLeader`, `questItem1`, `questItem2`, `questItem3`, `questItem4`, `questItem5`, `questItem6`, `movementId`, `RegenHealth`, `equipment_id`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `WDBVerified`) VALUES
  27. +('30230','0','0','0','0','0','24992','24993','24994','24995','Risen Ally','','','0','1','1','0','35','35','0','0.8','0.99206','1','0','0','0','0','0','1','2000','0','1','0','0','40','0','0','0','0','0','0','0','6','0','0','0','0','0','0','0','0','0','0','62225','47480','47481','47482','47484','51874','0','0','0','0','0','0','','0','3','286','1','1','0','0','0','0','0','0','0','0','1','0','8388624','0','npc_risen_ally','11723');
  28. diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
  29. index a6b51a4..5aec9bc 100644
  30. --- a/src/server/game/Entities/Creature/TemporarySummon.cpp
  31. +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
  32. @@ -245,6 +245,11 @@ void TempSummon::UnSummon(uint32 msTime)
  33. }
  34.  
  35. Unit* owner = GetSummoner();
  36. + if (owner && GetEntry() == 30230) // Risen ally
  37. + {
  38. + owner->RemoveAurasDueToSpell(62218);
  39. + owner->RemoveAurasDueToSpell(46619);
  40. + }
  41. if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
  42. owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
  43.  
  44. diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
  45. index b60197f..73a7018 100644
  46. --- a/src/server/game/Entities/Creature/TemporarySummon.h
  47. +++ b/src/server/game/Entities/Creature/TemporarySummon.h
  48. @@ -55,7 +55,7 @@ class Minion : public TempSummon
  49. Unit* GetOwner() { return m_owner; }
  50. float GetFollowAngle() const { return m_followAngle; }
  51. void SetFollowAngle(float angle) { m_followAngle = angle; }
  52. - bool IsPetGhoul() const {return GetEntry() == 26125;} // Ghoul may be guardian or pet
  53. + bool IsPetGhoul() const {return (GetEntry() == 26125 || GetEntry() == 30230);} // Ghoul may be guardian or pet
  54. bool IsGuardianPet() const;
  55. protected:
  56. Unit* const m_owner;
  57. diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
  58. index 4d3476c..1dc2d45 100644
  59. --- a/src/server/game/Entities/Unit/Unit.cpp
  60. +++ b/src/server/game/Entities/Unit/Unit.cpp
  61. @@ -12903,7 +12903,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
  62.  
  63. void Unit::setDeathState(DeathState s)
  64. {
  65. - if (s != ALIVE && s != JUST_RESPAWNED)
  66. + if (s != ALIVE && s != JUST_RESPAWNED && s != GHOULED)
  67. {
  68. CombatStop();
  69. DeleteThreatList();
  70. diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
  71. index 2982d5e..35c915c 100644
  72. --- a/src/server/game/Entities/Unit/Unit.h
  73. +++ b/src/server/game/Entities/Unit/Unit.h
  74. @@ -459,7 +459,8 @@ enum DeathState
  75. JUST_DIED = 1,
  76. CORPSE = 2,
  77. DEAD = 3,
  78. - JUST_RESPAWNED = 4
  79. + JUST_RESPAWNED = 4,
  80. + GHOULED = 5 //Raise ally, Deathknight's spell
  81. };
  82.  
  83. enum UnitState
  84. diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
  85. index 0f21dfd..bb8394a 100644
  86. --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
  87. +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
  88. @@ -5244,8 +5244,33 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
  89. break;
  90. case SPELLFAMILY_DEATHKNIGHT:
  91. {
  92. - //if (!(mode & AURA_EFFECT_HANDLE_REAL))
  93. - // break;
  94. + if (!(mode & AURA_EFFECT_HANDLE_REAL))
  95. + break;
  96. + if (GetId() == 46619) // Raise Ally
  97. + {
  98. + if (!target || target->GetTypeId() != TYPEID_PLAYER)
  99. + return;
  100. + Player* player = target->ToPlayer();
  101. + if (apply)
  102. + {
  103. + player->setDeathState(GHOULED);
  104. + player->RemoveAllAurasOnDeath();
  105. + WorldPacket data(SMSG_PRE_RESURRECT, player->GetPackGUID().size());
  106. + data.append(player->GetPackGUID());
  107. + player->GetSession()->SendPacket(&data);
  108. + player->StopMirrorTimers();
  109. + player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, float(1.0f));
  110. + player->SetHealth(1);
  111. + player->SetPower(player->getPowerType(), 1);
  112. + player->SetMovement(MOVE_ROOT)
  113. + }
  114. + else
  115. + {
  116. + player->RemoveAurasDueToSpell(62218);
  117. + player->SetMovement(MOVE_UNROOT);
  118. + player->SetHealth(0);
  119. + player->setDeathState(JUST_DIED);
  120. + }
  121. + break;
  122. + }
  123. break;
  124. }
  125. }
  126. diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
  127. index 9a00ddd..4009c6b 100644
  128. --- a/src/server/game/Spells/Spell.cpp
  129. +++ b/src/server/game/Spells/Spell.cpp
  130. @@ -5612,7 +5612,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
  131.  
  132. // dead owner (pets still alive when owners ressed?)
  133. if (Unit* owner = m_caster->GetCharmerOrOwner())
  134. - if (!owner->isAlive())
  135. + if (!owner->isAlive() && owner->getDeathState() != GHOULED)
  136. return SPELL_FAILED_CASTER_DEAD;
  137.  
  138. if (!target && m_targets.GetUnitTarget())
  139. diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
  140. index 4b7be63..7b632f2 100644
  141. --- a/src/server/game/Spells/SpellEffects.cpp
  142. +++ b/src/server/game/Spells/SpellEffects.cpp
  143. @@ -758,6 +758,21 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
  144. targets.SetDst(*m_targets.GetDstPos());
  145. spell_id = CalculateDamage(0, NULL);
  146. break;
  147. + case 61999:
  148. + if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER || unitTarget->isAlive())
  149. + {
  150. + SendCastResult(SPELL_FAILED_TARGET_NOT_DEAD);
  151. + finish(true);
  152. + CancelGlobalCooldown();
  153. + m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
  154. + return;
  155. + }else
  156. + {
  157. + unitTarget->CastSpell(unitTarget, 46619, true);
  158. + CancelGlobalCooldown();
  159. + return;
  160. + }
  161. + break;
  162. }
  163. break;
  164. }
  165. diff --git a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
  166. index c9b60f8..eb97fec 100644
  167. --- a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
  168. +++ b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
  169. @@ -174,7 +174,7 @@ class npc_tirion_fordring : public CreatureScript
  170. if (creature->isQuestGiver())
  171. player->PrepareQuestMenu(creature->GetGUID());
  172.  
  173. - if (player->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && player->getStandState() == UNIT_STAND_STATE_SIT)
  174. + if (player->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE)
  175. player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
  176.  
  177. player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
  178. diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
  179. index 5ed799b..f3601cb 100644
  180. --- a/src/server/scripts/World/npcs_special.cpp
  181. +++ b/src/server/scripts/World/npcs_special.cpp
  182. @@ -1985,6 +1985,66 @@ class npc_ebon_gargoyle : public CreatureScript
  183. }
  184. };
  185.  
  186. +class npc_risen_ally : public CreatureScript
  187. +{
  188. +public:
  189. + npc_risen_ally() : CreatureScript("npc_risen_ally") { }
  190. +
  191. + CreatureAI* GetAI(Creature* creature) const
  192. + {
  193. + return new npc_risen_allyAI(creature);
  194. + }
  195. +
  196. + struct npc_risen_allyAI : ScriptedAI
  197. + {
  198. + npc_risen_allyAI(Creature* creature) : ScriptedAI(creature) {}
  199. +
  200. + void InitializeAI()
  201. + {
  202. + me->setPowerType(POWER_ENERGY);
  203. + me->SetMaxPower(POWER_ENERGY, 100);
  204. + me->SetPower(POWER_ENERGY, 100);
  205. + me->SetSheath(SHEATH_STATE_MELEE);
  206. + me->SetByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_ABANDONED);
  207. + me->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
  208. + me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
  209. + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
  210. + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
  211. + }
  212. +
  213. + void Reset()
  214. + {
  215. + me->setPowerType(POWER_ENERGY);
  216. + me->SetMaxPower(POWER_ENERGY, 100);
  217. + }
  218. +
  219. + void IsSummonedBy(Unit* owner)
  220. + {
  221. + me->setPowerType(POWER_ENERGY);
  222. + me->SetMaxPower(POWER_ENERGY, 100);
  223. + me->SetPower(POWER_ENERGY, 100);
  224. + }
  225. +
  226. + void JustDied(Unit* /*killer*/)
  227. + {
  228. + if (me->GetOwner())
  229. + {
  230. + me->GetOwner()->RemoveAurasDueToSpell(62218);
  231. + me->GetOwner()->RemoveAurasDueToSpell(46619);
  232. + }
  233. + }
  234. +
  235. + void UpdateAI(const uint32 diff)
  236. + {
  237. + if (!me->isCharmed())
  238. + me->DespawnOrUnsummon();
  239. +
  240. + if (me->isInCombat())
  241. + DoMeleeAttackIfReady();
  242. + }
  243. + };
  244. +};
  245. +
  246. class npc_lightwell : public CreatureScript
  247. {
  248. public:
  249. --
  250. 1.7.10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement