Advertisement
Guest User

Untitled

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