Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Core/Spell: Implement Raise ally
- ---
- sql/raise_ally.sql | 3 +
- .../game/Entities/Creature/TemporarySummon.cpp | 5 ++
- .../game/Entities/Creature/TemporarySummon.h | 2 +-
- src/server/game/Entities/Unit/Unit.cpp | 2 +-
- src/server/game/Entities/Unit/Unit.h | 3 +-
- src/server/game/Spells/Auras/SpellAuraEffects.cpp | 29 +++++++++-
- src/server/game/Spells/Spell.cpp | 2 +-
- src/server/game/Spells/SpellEffects.cpp | 15 +++++
- .../EasternKingdoms/eastern_plaguelands.cpp | 2 +-
- src/server/scripts/World/npcs_special.cpp | 60 ++++++++++++++++++++
- 10 files changed, 116 insertions(+), 7 deletions(-)
- create mode 100644 sql/raise_ally.sql
- diff --git a/sql/raise_ally.sql b/sql/raise_ally.sql
- new file mode 100644
- index 0000000..86948f5
- --- /dev/null
- +++ b/sql/raise_ally.sql
- @@ -0,0 +1,3 @@
- +DELETE FROM creature_template WHERE entry = 30230;
- +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
- +('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');
- diff --git a/src/server/game/Entities/Creature/TemporarySummon.cpp b/src/server/game/Entities/Creature/TemporarySummon.cpp
- index a6b51a4..5aec9bc 100644
- --- a/src/server/game/Entities/Creature/TemporarySummon.cpp
- +++ b/src/server/game/Entities/Creature/TemporarySummon.cpp
- @@ -245,6 +245,11 @@ void TempSummon::UnSummon(uint32 msTime)
- }
- Unit* owner = GetSummoner();
- + if (owner && GetEntry() == 30230) // Risen ally
- + {
- + owner->RemoveAurasDueToSpell(62218);
- + owner->RemoveAurasDueToSpell(46619);
- + }
- if (owner && owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled)
- owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
- diff --git a/src/server/game/Entities/Creature/TemporarySummon.h b/src/server/game/Entities/Creature/TemporarySummon.h
- index b60197f..73a7018 100644
- --- a/src/server/game/Entities/Creature/TemporarySummon.h
- +++ b/src/server/game/Entities/Creature/TemporarySummon.h
- @@ -55,7 +55,7 @@ class Minion : public TempSummon
- Unit* GetOwner() { return m_owner; }
- float GetFollowAngle() const { return m_followAngle; }
- void SetFollowAngle(float angle) { m_followAngle = angle; }
- - bool IsPetGhoul() const {return GetEntry() == 26125;} // Ghoul may be guardian or pet
- + bool IsPetGhoul() const {return (GetEntry() == 26125 || GetEntry() == 30230);} // Ghoul may be guardian or pet
- bool IsGuardianPet() const;
- protected:
- Unit* const m_owner;
- diff --git a/src/server/game/Entities/Unit/Unit.cpp b/src/server/game/Entities/Unit/Unit.cpp
- index 4d3476c..1dc2d45 100644
- --- a/src/server/game/Entities/Unit/Unit.cpp
- +++ b/src/server/game/Entities/Unit/Unit.cpp
- @@ -12903,7 +12903,7 @@ void Unit::SetSpeed(UnitMoveType mtype, float rate, bool forced)
- void Unit::setDeathState(DeathState s)
- {
- - if (s != ALIVE && s != JUST_RESPAWNED)
- + if (s != ALIVE && s != JUST_RESPAWNED && s != GHOULED)
- {
- CombatStop();
- DeleteThreatList();
- diff --git a/src/server/game/Entities/Unit/Unit.h b/src/server/game/Entities/Unit/Unit.h
- index 2982d5e..35c915c 100644
- --- a/src/server/game/Entities/Unit/Unit.h
- +++ b/src/server/game/Entities/Unit/Unit.h
- @@ -459,7 +459,8 @@ enum DeathState
- JUST_DIED = 1,
- CORPSE = 2,
- DEAD = 3,
- - JUST_RESPAWNED = 4
- + JUST_RESPAWNED = 4,
- + GHOULED = 5 //Raise ally, Deathknight's spell
- };
- enum UnitState
- diff --git a/src/server/game/Spells/Auras/SpellAuraEffects.cpp b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
- index 0f21dfd..bb8394a 100644
- --- a/src/server/game/Spells/Auras/SpellAuraEffects.cpp
- +++ b/src/server/game/Spells/Auras/SpellAuraEffects.cpp
- @@ -5244,8 +5244,33 @@ void AuraEffect::HandleAuraDummy(AuraApplication const* aurApp, uint8 mode, bool
- break;
- case SPELLFAMILY_DEATHKNIGHT:
- {
- - //if (!(mode & AURA_EFFECT_HANDLE_REAL))
- - // break;
- + if (!(mode & AURA_EFFECT_HANDLE_REAL))
- + break;
- + if (GetId() == 46619) // Raise Ally
- + {
- + if (!target || target->GetTypeId() != TYPEID_PLAYER)
- + return;
- + Player* player = target->ToPlayer();
- + if (apply)
- + {
- + player->setDeathState(GHOULED);
- + player->RemoveAllAurasOnDeath();
- + WorldPacket data(SMSG_PRE_RESURRECT, player->GetPackGUID().size());
- + data.append(player->GetPackGUID());
- + player->GetSession()->SendPacket(&data);
- + player->StopMirrorTimers();
- + player->SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, float(1.0f));
- + player->SetHealth(1);
- + player->SetPower(player->getPowerType(), 1);
- + player->SetMovement(MOVE_ROOT)
- + }
- + else
- + {
- + player->RemoveAurasDueToSpell(62218);
- + player->SetMovement(MOVE_UNROOT);
- + player->SetHealth(0);
- + player->setDeathState(JUST_DIED);
- + }
- + break;
- + }
- break;
- }
- }
- diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp
- index 9a00ddd..4009c6b 100644
- --- a/src/server/game/Spells/Spell.cpp
- +++ b/src/server/game/Spells/Spell.cpp
- @@ -5612,7 +5612,7 @@ SpellCastResult Spell::CheckPetCast(Unit* target)
- // dead owner (pets still alive when owners ressed?)
- if (Unit* owner = m_caster->GetCharmerOrOwner())
- - if (!owner->isAlive())
- + if (!owner->isAlive() && owner->getDeathState() != GHOULED)
- return SPELL_FAILED_CASTER_DEAD;
- if (!target && m_targets.GetUnitTarget())
- diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp
- index 4b7be63..7b632f2 100644
- --- a/src/server/game/Spells/SpellEffects.cpp
- +++ b/src/server/game/Spells/SpellEffects.cpp
- @@ -758,6 +758,21 @@ void Spell::EffectDummy(SpellEffIndex effIndex)
- targets.SetDst(*m_targets.GetDstPos());
- spell_id = CalculateDamage(0, NULL);
- break;
- + case 61999:
- + if (!unitTarget || m_caster->GetTypeId() != TYPEID_PLAYER || unitTarget->isAlive())
- + {
- + SendCastResult(SPELL_FAILED_TARGET_NOT_DEAD);
- + finish(true);
- + CancelGlobalCooldown();
- + m_caster->ToPlayer()->RemoveSpellCooldown(m_spellInfo->Id, true);
- + return;
- + }else
- + {
- + unitTarget->CastSpell(unitTarget, 46619, true);
- + CancelGlobalCooldown();
- + return;
- + }
- + break;
- }
- break;
- }
- diff --git a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
- index c9b60f8..eb97fec 100644
- --- a/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
- +++ b/src/server/scripts/EasternKingdoms/eastern_plaguelands.cpp
- @@ -174,7 +174,7 @@ class npc_tirion_fordring : public CreatureScript
- if (creature->isQuestGiver())
- player->PrepareQuestMenu(creature->GetGUID());
- - if (player->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE && player->getStandState() == UNIT_STAND_STATE_SIT)
- + if (player->GetQuestStatus(5742) == QUEST_STATUS_INCOMPLETE)
- player->ADD_GOSSIP_ITEM(GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF+1);
- player->SEND_GOSSIP_MENU(player->GetGossipTextId(creature), creature->GetGUID());
- diff --git a/src/server/scripts/World/npcs_special.cpp b/src/server/scripts/World/npcs_special.cpp
- index 5ed799b..f3601cb 100644
- --- a/src/server/scripts/World/npcs_special.cpp
- +++ b/src/server/scripts/World/npcs_special.cpp
- @@ -1985,6 +1985,66 @@ class npc_ebon_gargoyle : public CreatureScript
- }
- };
- +class npc_risen_ally : public CreatureScript
- +{
- +public:
- + npc_risen_ally() : CreatureScript("npc_risen_ally") { }
- +
- + CreatureAI* GetAI(Creature* creature) const
- + {
- + return new npc_risen_allyAI(creature);
- + }
- +
- + struct npc_risen_allyAI : ScriptedAI
- + {
- + npc_risen_allyAI(Creature* creature) : ScriptedAI(creature) {}
- +
- + void InitializeAI()
- + {
- + me->setPowerType(POWER_ENERGY);
- + me->SetMaxPower(POWER_ENERGY, 100);
- + me->SetPower(POWER_ENERGY, 100);
- + me->SetSheath(SHEATH_STATE_MELEE);
- + me->SetByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_ABANDONED);
- + me->SetUInt32Value(UNIT_FIELD_BYTES_0, 2048);
- + me->SetUInt32Value(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
- + me->SetUInt32Value(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_NONE);
- + me->SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
- + }
- +
- + void Reset()
- + {
- + me->setPowerType(POWER_ENERGY);
- + me->SetMaxPower(POWER_ENERGY, 100);
- + }
- +
- + void IsSummonedBy(Unit* owner)
- + {
- + me->setPowerType(POWER_ENERGY);
- + me->SetMaxPower(POWER_ENERGY, 100);
- + me->SetPower(POWER_ENERGY, 100);
- + }
- +
- + void JustDied(Unit* /*killer*/)
- + {
- + if (me->GetOwner())
- + {
- + me->GetOwner()->RemoveAurasDueToSpell(62218);
- + me->GetOwner()->RemoveAurasDueToSpell(46619);
- + }
- + }
- +
- + void UpdateAI(const uint32 diff)
- + {
- + if (!me->isCharmed())
- + me->DespawnOrUnsummon();
- +
- + if (me->isInCombat())
- + DoMeleeAttackIfReady();
- + }
- + };
- +};
- +
- class npc_lightwell : public CreatureScript
- {
- public:
- --
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement