aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormegamage <none@none>2009-08-19 20:30:11 -0500
committermegamage <none@none>2009-08-19 20:30:11 -0500
commit92f3d270272716c5a43f3916b0db042369808813 (patch)
tree30d5f8bd3b097d637dccfb06a251231a61fa656e /src
parent0fc22d6c1ca230569193e63e513ae21f73b3fcb6 (diff)
*Remove all ghouls after quest is completed in dk's "give gift" quest;
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp3
-rw-r--r--src/game/Unit.cpp13
-rw-r--r--src/game/Unit.h1
3 files changed, 17 insertions, 0 deletions
diff --git a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp
index afc5a48883e..57c1ed8cd86 100644
--- a/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp
+++ b/src/bindings/scripts/scripts/eastern_kingdoms/scarlet_enclave/chapter1.cpp
@@ -692,6 +692,9 @@ struct TRINITY_DLL_DECL npc_dkc1_gothikAI : public ScriptedAI
{
CAST_CRE(who)->CastSpell(owner, 52517, true);
CAST_CRE(who)->ForcedDespawn();
+
+ if (CAST_PLR(owner)->GetQuestStatus(12698) == QUEST_STATUS_COMPLETE)
+ owner->RemoveAllMinionsByEntry(28845);
}
}
}
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 8c2d95fb825..a38ea3cc0ca 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -8612,6 +8612,19 @@ void Unit::SetMinion(Minion *minion, bool apply)
}
}
+void Unit::RemoveAllMinionsByEntry(uint32 entry)
+{
+ for(Unit::ControlList::iterator itr = m_Controlled.begin(); itr != m_Controlled.end();)
+ {
+ Unit *unit = *itr;
+ ++itr;
+ if(unit->GetEntry() == entry && unit->GetTypeId() == TYPEID_UNIT
+ && ((Creature*)unit)->isSummon()) // minion, actually
+ ((TempSummon*)unit)->UnSummon();
+ // i think this is safe because i have never heard that a despawned minion will trigger a same minion
+ }
+}
+
void Unit::SetCharm(Unit* charm, bool apply)
{
if(apply)
diff --git a/src/game/Unit.h b/src/game/Unit.h
index a0b371a2b7e..d654c948ef4 100644
--- a/src/game/Unit.h
+++ b/src/game/Unit.h
@@ -1404,6 +1404,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
Player* GetCharmerOrOwnerPlayerOrPlayerItself() const;
void SetMinion(Minion *minion, bool apply);
+ void RemoveAllMinionsByEntry(uint32 entry);
void SetCharm(Unit* target, bool apply);
Unit* GetNextRandomRaidMemberOrPet(float radius);
bool SetCharmedBy(Unit* charmer, CharmType type);