aboutsummaryrefslogtreecommitdiff
path: root/src/server/game
diff options
context:
space:
mode:
authorShauren <shauren.dev@gmail.com>2011-01-01 23:37:35 +0100
committerShauren <shauren.dev@gmail.com>2011-01-01 23:37:35 +0100
commit039d87bbc9c948122418b35f5fd835fb8d3b5efa (patch)
tree9f0efa85320856c8b2d7393baa03105610148ab4 /src/server/game
parentce76f10bc8aa25526046ef8651e7c4a0f026c6cc (diff)
Scripts: Implemented virtual function DoCastSpellOnPlayers (self-explanatory) and CheckRequiredBosses checking states of other bosses before allowing combat with selected one
Scripts/Icecrown Citadel: Added checks to prevent skipping bosses
Diffstat (limited to 'src/server/game')
-rw-r--r--src/server/game/AI/ScriptedAI/ScriptedCreature.cpp8
-rwxr-xr-xsrc/server/game/Instances/InstanceScript.cpp11
-rwxr-xr-xsrc/server/game/Instances/InstanceScript.h7
3 files changed, 26 insertions, 0 deletions
diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
index bb21252efb0..ddf000e31c7 100644
--- a/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
+++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.cpp
@@ -545,7 +545,15 @@ void BossAI::_EnterCombat()
me->setActive(true);
DoZoneInCombat();
if (instance)
+ {
+ // bosses do not respawn, check only on enter combat
+ if (!instance->CheckRequiredBosses(bossId))
+ {
+ EnterEvadeMode();
+ return;
+ }
instance->SetBossState(bossId, IN_PROGRESS);
+ }
}
void BossAI::TeleportCheaters()
diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp
index 42a9c1eb291..29cf2043662 100755
--- a/src/server/game/Instances/InstanceScript.cpp
+++ b/src/server/game/Instances/InstanceScript.cpp
@@ -379,6 +379,17 @@ void InstanceScript::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
pPlayer->RemoveAurasDueToSpell(spell);
}
+// Cast spell on all players in instance
+void InstanceScript::DoCastSpellOnPlayers(uint32 spell)
+{
+ Map::PlayerList const &PlayerList = instance->GetPlayers();
+
+ if (!PlayerList.isEmpty())
+ for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
+ if (Player* player = i->getSource())
+ player->CastSpell(player, spell, true);
+}
+
bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/)
{
sLog->outError("Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h
index 26a06af3ecd..675adc9304b 100755
--- a/src/server/game/Instances/InstanceScript.h
+++ b/src/server/game/Instances/InstanceScript.h
@@ -173,6 +173,9 @@ class InstanceScript : public ZoneScript
// Remove Auras due to Spell on all players in instance
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell);
+ // Cast spell on all players in instance
+ void DoCastSpellOnPlayers(uint32 spell);
+
// Return wether server allow two side groups or not
bool ServerAllowsTwoSideGroups() { return sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP); }
@@ -183,6 +186,10 @@ class InstanceScript : public ZoneScript
// Achievement criteria additional requirements check
// NOTE: not use this if same can be checked existed requirement types from AchievementCriteriaRequirementType
virtual bool CheckAchievementCriteriaMeet(uint32 /*criteria_id*/, Player const* /*source*/, Unit const* /*target*/ = NULL, uint32 /*miscvalue1*/ = 0);
+
+ // Checks boss requirements (one boss required to kill other)
+ virtual bool CheckRequiredBosses(uint32 /*bossId*/, Player const* /*player*/ = NULL) const { return true; }
+
protected:
void SetBossNumber(uint32 number) { bosses.resize(number); }
void LoadDoorData(const DoorData *data);