Skip to content

Commit

Permalink
Implement script for quest 11878
Browse files Browse the repository at this point in the history
Thanks to @Grz3s for providing the details

Signed-off-by: Xfurry <xfurry.cmangos@outlook.com>
  • Loading branch information
xfurry committed Jan 17, 2018
1 parent 33665bc commit 2632502
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 3 deletions.
1 change: 1 addition & 0 deletions sql/scriptdev2/scriptdev2.sql
Expand Up @@ -419,6 +419,7 @@ UPDATE creature_template SET ScriptName='npc_seaforium_depth_charge' WHERE entry
UPDATE creature_template SET ScriptName='npc_mootoo_the_younger' WHERE entry=25504;
UPDATE creature_template SET ScriptName='npc_storm_totem' WHERE entry=26048;
UPDATE creature_template SET ScriptName='npc_proudhoof' WHERE entry=25335;
UPDATE creature_template SET ScriptName='npc_orphaned_mammoth_calf' WHERE entry=25861;

/* BURNING STEPPES */
UPDATE creature_template SET ScriptName='npc_ragged_john' WHERE entry=9563;
Expand Down
58 changes: 55 additions & 3 deletions src/game/AI/ScriptDevAI/scripts/northrend/borean_tundra.cpp
Expand Up @@ -17,7 +17,7 @@
/* ScriptData
SDName: Borean_Tundra
SD%Complete: 100
SDComment: Quest support: 11570, 11590, 11592, 11608, 11664, 11673, 11728, 11865, 11881, 11889, 11895, 11897, 11919, 11940.
SDComment: Quest support: 11570, 11590, 11592, 11608, 11664, 11673, 11728, 11865, 11878, 11881, 11889, 11895, 11897, 11919, 11940.
SDCategory: Borean Tundra
EndScriptData */

Expand All @@ -34,12 +34,14 @@ npc_jenny
npc_mootoo_the_younger
npc_storm_totem
npc_proudhoof
npc_orphaned_mammoth_calf
EndContentData */

#include "AI/ScriptDevAI/include/precompiled.h"
#include "AI/ScriptDevAI/base/escort_ai.h"
#include "Entities/TemporarySpawn.h"
#include "AI/ScriptDevAI/base/follower_ai.h"
#include "AI/ScriptDevAI/base/pet_ai.h"

/*######
## npc_nesingwary_trapper
Expand Down Expand Up @@ -1496,7 +1498,7 @@ struct npc_proudhoofAI : public npc_escortAI
}
};

CreatureAI* GetAI_npc_proudhoofAI(Creature* pCreature)
CreatureAI* GetAI_npc_proudhoof(Creature* pCreature)
{
return new npc_proudhoofAI(pCreature);
}
Expand All @@ -1512,6 +1514,51 @@ bool QuestAccept_npc_proudhoof(Player* pPlayer, Creature* pCreature, const Quest
return false;
}

/*######
## npc_orphaned_mammoth_calf
######*/

enum
{
SPELL_MAMMOTH_CALL_CREDIT = 46231,
SOUND_ID_QUEST_COMPLETE = 9917,

NPC_KHUNOK_THE_BEHEMOTH = 25862,
};

struct npc_orphaned_mammoth_calfAI : public ScriptedPetAI
{
npc_orphaned_mammoth_calfAI(Creature* pCreature) : ScriptedPetAI(pCreature) { Reset(); }

bool m_bIsComplete;

void Reset() override
{
m_bIsComplete = false;
}

void MoveInLineOfSight(Unit* pWho) override
{
if (!m_bIsComplete && pWho->GetTypeId() == TYPEID_UNIT && pWho->GetEntry() == NPC_KHUNOK_THE_BEHEMOTH && m_creature->IsWithinDistInMap(pWho, 30.0f))
{
if (!m_creature->GetOwner())
return;

m_bIsComplete = true;
pWho->CastSpell(m_creature->GetOwner(), SPELL_MAMMOTH_CALL_CREDIT, TRIGGERED_OLD_TRIGGERED);
pWho->PlayDirectSound(SOUND_ID_QUEST_COMPLETE);
pWho->HandleEmote(EMOTE_ONESHOT_MOUNTSPECIAL);
}

ScriptedPetAI::MoveInLineOfSight(pWho);
}
};

CreatureAI* GetAI_npc_orphaned_mammoth_calf(Creature* pCreature)
{
return new npc_orphaned_mammoth_calfAI(pCreature);
}

void AddSC_borean_tundra()
{
Script* pNewScript;
Expand Down Expand Up @@ -1591,7 +1638,12 @@ void AddSC_borean_tundra()

pNewScript = new Script;
pNewScript->Name = "npc_proudhoof";
pNewScript->GetAI = &GetAI_npc_proudhoofAI;
pNewScript->GetAI = &GetAI_npc_proudhoof;
pNewScript->pQuestAcceptNPC = &QuestAccept_npc_proudhoof;
pNewScript->RegisterSelf();

pNewScript = new Script;
pNewScript->Name = "npc_orphaned_mammoth_calf";
pNewScript->GetAI = &GetAI_npc_orphaned_mammoth_calf;
pNewScript->RegisterSelf();
}
9 changes: 9 additions & 0 deletions src/game/Spells/SpellEffects.cpp
Expand Up @@ -2284,6 +2284,15 @@ void Spell::EffectDummy(SpellEffectIndex eff_idx)

return;
}
case 46237: // Dismiss Orphaned Mammoth
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_UNIT || !unitTarget->GetOwner())
return;

// remove player aura and despawn
unitTarget->GetOwner()->RemoveAurasDueToSpell(46233);
((Creature*)unitTarget)->ForcedDespawn(5000);
}
case 46292: // Cataclysm Breath
{
if (!unitTarget || unitTarget->GetTypeId() != TYPEID_PLAYER)
Expand Down

0 comments on commit 2632502

Please sign in to comment.