aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bindings/scripts/scripts/npc/npc_escortAI.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp17
-rw-r--r--src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp13
-rw-r--r--src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp25
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp87
-rw-r--r--src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp25
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp40
-rw-r--r--src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp2
-rw-r--r--src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp4
-rw-r--r--src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp13
-rw-r--r--src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp31
-rw-r--r--src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp98
-rw-r--r--src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp72
-rw-r--r--src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp3
-rw-r--r--src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp2
19 files changed, 164 insertions, 284 deletions
diff --git a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp
index d464a369826..681cf05e272 100644
--- a/src/bindings/scripts/scripts/npc/npc_escortAI.cpp
+++ b/src/bindings/scripts/scripts/npc/npc_escortAI.cpp
@@ -115,7 +115,7 @@ void npc_escortAI::UpdateAI(const uint32 diff)
m_creature->setDeathState(JUST_DIED);
m_creature->SetHealth(0);
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
m_creature->DeleteThreatList();
m_creature->Respawn();
m_creature->GetMotionMaster()->Clear(true);
@@ -161,7 +161,7 @@ void npc_escortAI::UpdateAI(const uint32 diff)
m_creature->setDeathState(JUST_DIED);
m_creature->SetHealth(0);
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
m_creature->DeleteThreatList();
m_creature->Respawn();
m_creature->GetMotionMaster()->Clear(true);
diff --git a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp
index cc63d253d1b..9747159fcaf 100644
--- a/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp
+++ b/src/bindings/scripts/scripts/zone/aunchindoun/shadow_labyrinth/instance_shadow_labyrinth.cpp
@@ -92,23 +92,6 @@ struct TRINITY_DLL_DECL instance_shadow_labyrinth : public ScriptedInstance
}
}
- Player* GetPlayerInMap()
- {
- Map::PlayerList const& players = instance->GetPlayers();
-
- if (!players.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* plr = itr->getSource())
- return plr;
- }
- }
-
- debug_log("TSCR: Instance Shadow Labyrinth: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
- }
-
void SetData(uint32 type, uint32 data)
{
switch(type)
diff --git a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
index 2048961fc08..9cfbcb7f4ee 100644
--- a/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
+++ b/src/bindings/scripts/scripts/zone/azuremyst_isle/azuremyst_isle.cpp
@@ -159,7 +159,7 @@ struct TRINITY_DLL_DECL npc_draenei_survivorAI : public ScriptedAI
m_creature->GetMotionMaster()->MoveIdle();
m_creature->setDeathState(JUST_DIED);
m_creature->SetHealth(0);
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
m_creature->DeleteThreatList();
m_creature->RemoveCorpse();
}else RunAwayTimer -= diff;
@@ -593,7 +593,7 @@ struct TRINITY_DLL_DECL npc_nestlewood_owlkinAI : public ScriptedAI
m_creature->SetVisibility(VISIBILITY_OFF);
m_creature->setDeathState(JUST_DIED);
m_creature->SetHealth(0);
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
m_creature->DeleteThreatList();
m_creature->RemoveCorpse();
}else DespawnTimer -= diff;
diff --git a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
index 30a9db9f29c..f1dbc48ee79 100644
--- a/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
+++ b/src/bindings/scripts/scripts/zone/barrens/the_barrens.cpp
@@ -120,7 +120,7 @@ struct TRINITY_DLL_DECL npc_taskmaster_fizzuleAI : public ScriptedAI
{
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
m_creature->StopMoving();
m_creature->GetMotionMaster()->MoveIdle();
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
index 4c836c2036a..a045218f00a 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
@@ -1037,10 +1037,9 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
// Do not call reset in Akama's evade mode, as this will stop him from summoning minions after he kills the first bit
void EnterEvadeMode()
{
- m_creature->InterruptNonMeleeSpells(true);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
}
void EnterCombat(Unit *who) {}
diff --git a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
index 1b375f0be0f..78903b14b2a 100644
--- a/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
+++ b/src/bindings/scripts/scripts/zone/black_temple/boss_shade_of_akama.cpp
@@ -257,17 +257,12 @@ struct TRINITY_DLL_DECL boss_shade_of_akamaAI : public ScriptedAI
{
Channeler->RemoveCorpse();
Channeler->Respawn();
- Channeler->InterruptNonMeleeSpells(true);
- Channeler->RemoveAurasDueToSpell(SPELL_SHADE_SOUL_CHANNEL);
}
- if (Channeler->isAlive())
- {
- Channeler->CastSpell(m_creature, SPELL_SHADE_SOUL_CHANNEL, true);
- Channeler->CastSpell(m_creature, SPELL_SHADE_SOUL_CHANNEL_2, true);
- Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- GridSearcherSucceeded = true;
- }
+ Channeler->CastSpell(m_creature, SPELL_SHADE_SOUL_CHANNEL, true);
+ Channeler->CastSpell(m_creature, SPELL_SHADE_SOUL_CHANNEL_2, true);
+ Channeler->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ GridSearcherSucceeded = true;
}
}
}else error_log("SD2 ERROR: No Channelers are stored in the list. This encounter will not work properly");
diff --git a/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp
index d84bd96791d..750d611b58e 100644
--- a/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp
+++ b/src/bindings/scripts/scripts/zone/blackrock_depths/instance_blackrock_depths.cpp
@@ -114,23 +114,6 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance
Encounter[i] = NOT_STARTED;
}
- Player* GetPlayerInMap()
- {
- Map::PlayerList const& players = instance->GetPlayers();
-
- if (!players.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* plr = itr->getSource())
- return plr;
- }
- }
-
- debug_log("TSCR: Instance Blackrock Depths: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
- }
-
void OnCreatureCreate(Creature *creature, bool add)
{
switch(creature->GetEntry())
@@ -166,14 +149,6 @@ struct TRINITY_DLL_DECL instance_blackrock_depths : public ScriptedInstance
void SetData(uint32 type, uint32 data)
{
- Player *player = GetPlayerInMap();
-
- if (!player)
- {
- debug_log("TSCR: Instance Blackrock Depths: SetData (Type: %u Data %u) cannot find any player.", type, data);
- return;
- }
-
debug_log("TSCR: Instance Blackrock Depths: SetData update (Type: %u Data %u)", type, data);
switch(type)
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp
index e988782ad60..58962c0c469 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/dark_portal/instance_dark_portal.cpp
@@ -95,23 +95,6 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
NextPortal_Timer = 0;
}
- Player* GetPlayerInMap()
- {
- Map::PlayerList const& players = instance->GetPlayers();
-
- if (!players.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* plr = itr->getSource())
- return plr;
- }
- }
-
- debug_log("TSCR: Instance Black Portal: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
- }
-
void UpdateBMWorldState(uint32 id, uint32 state)
{
Map::PlayerList const& players = instance->GetPlayers();
@@ -158,7 +141,7 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
//what other conditions to check?
bool CanProgressEvent()
{
- if (!GetPlayerInMap())
+ if (instance->GetPlayers().isEmpty())
return false;
return true;
@@ -183,14 +166,6 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
void SetData(uint32 type, uint32 data)
{
- Player *player = GetPlayerInMap();
-
- if (!player)
- {
- debug_log("TSCR: Instance Black Portal: SetData (Type: %u Data %u) cannot find any player.", type, data);
- return;
- }
-
switch(type)
{
case TYPE_MEDIVH:
@@ -201,11 +176,11 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
if (!mShieldPercent)
{
- if (Unit *medivh = Unit::GetUnit(*player,MedivhGUID))
+ if (Creature* pMedivh = instance->GetCreature(MedivhGUID))
{
- if (medivh->isAlive())
+ if (pMedivh->isAlive())
{
- medivh->DealDamage(medivh, medivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
+ pMedivh->DealDamage(pMedivh, pMedivh->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
Encounter[0] = FAIL;
Encounter[1] = NOT_STARTED;
}
@@ -225,11 +200,22 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
if (data == DONE)
{
//this may be completed further out in the post-event
- if (Unit *medivh = Unit::GetUnit(*player,MedivhGUID))
+ debug_log("TSCR: Instance Dark Portal: Event completed.");
+ Map::PlayerList const& players = instance->GetPlayers();
+
+ if (!players.isEmpty())
{
- debug_log("TSCR: Instance Dark Portal: Event completed.");
- player->GroupEventHappens(QUEST_OPENING_PORTAL,medivh);
- player->GroupEventHappens(QUEST_MASTER_TOUCH,medivh);
+ for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
+ {
+ if (Player* pPlayer = itr->getSource())
+ {
+ if (pPlayer->GetQuestStatus(QUEST_OPENING_PORTAL) == QUEST_STATUS_INCOMPLETE)
+ pPlayer->AreaExploredOrEventHappens(QUEST_OPENING_PORTAL);
+
+ if (pPlayer->GetQuestStatus(QUEST_MASTER_TOUCH) == QUEST_STATUS_INCOMPLETE)
+ pPlayer->AreaExploredOrEventHappens(QUEST_MASTER_TOUCH);
+ }
+ }
}
}
@@ -272,24 +258,25 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
return 0;
}
- Unit* SummonedPortalBoss(Unit* source)
+ Creature* SummonedPortalBoss(Creature* pSource)
{
uint32 entry = RiftWaves[GetRiftWaveId()].PortalBoss;
+
if (entry == RIFT_BOSS)
entry = RandRiftBoss();
float x,y,z;
- source->GetRandomPoint(source->GetPositionX(),source->GetPositionY(),source->GetPositionZ(),10.0f,x,y,z);
+ pSource->GetRandomPoint(pSource->GetPositionX(),pSource->GetPositionY(),pSource->GetPositionZ(),10.0f,x,y,z);
//normalize Z-level if we can, if rift is not at ground level.
z = std::max(instance->GetHeight(x, y, MAX_HEIGHT), instance->GetWaterLevel(x, y));
debug_log("TSCR: Instance Dark Portal: Summoning rift boss entry %u.",entry);
- Unit *Summon = source->SummonCreature(entry,x,y,z,source->GetOrientation(),
+ Creature* pSummoned = pSource->SummonCreature(entry,x,y,z,pSource->GetOrientation(),
TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,600000);
- if (Summon)
- return Summon;
+ if (pSummoned)
+ return pSummoned;
debug_log("TSCR: Instance Dark Portal: what just happened there? No boss, no loot, no fun...");
return NULL;
@@ -297,11 +284,7 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
void DoSpawnPortal()
{
- Player *player = GetPlayerInMap();
- if (!player)
- return;
-
- if (Unit *medivh = Unit::GetUnit(*player,MedivhGUID))
+ if (Creature* pMedivh = instance->GetCreature(MedivhGUID))
{
int tmp = rand()%(4-1);
@@ -311,26 +294,26 @@ struct TRINITY_DLL_DECL instance_dark_portal : public ScriptedInstance
CurrentRiftId = tmp;
- Unit *temp = medivh->SummonCreature(C_TIME_RIFT,
+ Creature* pTemp = pMedivh->SummonCreature(C_TIME_RIFT,
PortalLocation[tmp][0],PortalLocation[tmp][1],PortalLocation[tmp][2],PortalLocation[tmp][3],
TEMPSUMMON_CORPSE_DESPAWN,0);
- if (temp)
+ if (pTemp)
{
- temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
- temp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
+ pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
+ pTemp->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
- if (Unit* boss = SummonedPortalBoss(temp))
+ if (Creature* pBoss = SummonedPortalBoss(pTemp))
{
- if (boss->GetEntry() == C_AEONUS)
+ if (pBoss->GetEntry() == C_AEONUS)
{
- boss->AddThreat(medivh,0.0f);
+ pBoss->AddThreat(pMedivh,0.0f);
}
else
{
- boss->AddThreat(temp,0.0f);
- temp->CastSpell(boss,SPELL_RIFT_CHANNEL,false);
+ pBoss->AddThreat(pTemp,0.0f);
+ pTemp->CastSpell(pBoss,SPELL_RIFT_CHANNEL,false);
}
}
}
diff --git a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
index 92ca93dcc2c..487347c1c18 100644
--- a/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
+++ b/src/bindings/scripts/scripts/zone/caverns_of_time/hyjal/hyjalAI.cpp
@@ -409,11 +409,10 @@ void hyjalAI::Reset()
void hyjalAI::EnterEvadeMode()
{
- m_creature->InterruptNonMeleeSpells(true);
if(m_creature->GetEntry() != JAINA)
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
m_creature->LoadCreaturesAddon();
if(m_creature->isAlive())
diff --git a/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp b/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp
index 9f0cb4a7d4c..a35551481fa 100644
--- a/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp
+++ b/src/bindings/scripts/scripts/zone/coilfang_resevoir/steam_vault/instance_steam_vault.cpp
@@ -88,23 +88,6 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance
return false;
}
- Player* GetPlayerInMap()
- {
- Map::PlayerList const& players = instance->GetPlayers();
-
- if (!players.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* plr = itr->getSource())
- return plr;
- }
- }
-
- debug_log("TSCR: Instance Steamvault: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
- }
-
void OnCreatureCreate(Creature *creature, bool add)
{
switch(creature->GetEntry())
@@ -127,14 +110,6 @@ struct TRINITY_DLL_DECL instance_steam_vault : public ScriptedInstance
void SetData(uint32 type, uint32 data)
{
- Player *player = GetPlayerInMap();
-
- if (!player)
- {
- debug_log("TSCR: Instance Steamvault: SetData (Type: %u Data %u) cannot find any player.", type, data);
- return;
- }
-
switch(type)
{
case TYPE_HYDROMANCER_THESPIA:
diff --git a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp
index 4061b2b3b65..21e88eab4c4 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_citadel/hellfire_ramparts/instance_hellfire_ramparts.cpp
@@ -51,41 +51,21 @@ struct TRINITY_DLL_DECL instance_ramparts : public ScriptedInstance
}
}
- Player* GetFirstPlayerInInstance()
- {
- Map::PlayerList const& pPlayers = instance->GetPlayers();
-
- if (!pPlayers.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = pPlayers.begin(); itr != pPlayers.end(); ++itr)
- {
- if (Player* pPlr = itr->getSource())
- return pPlr;
- }
- }
-
- debug_log("TSCR: Instance Ramparts: GetFirstPlayerInInstance, but PlayerList is empty.");
- return NULL;
- }
-
void DoRespawnChest()
{
- if (Player* pPlayer = GetFirstPlayerInInstance())
- {
- uint64 uiChest;
+ uint64 uiChest;
- if (instance->IsHeroic())
- uiChest = m_uiChestHGUID;
- else
- uiChest = m_uiChestNGUID;
+ if (instance->IsHeroic())
+ uiChest = m_uiChestHGUID;
+ else
+ uiChest = m_uiChestNGUID;
- if (GameObject* pGo = instance->GetGameObject(uiChest))
- {
- if (pGo->isSpawned())
- return;
+ if (GameObject* pGo = instance->GetGameObject(uiChest))
+ {
+ if (pGo->isSpawned())
+ return;
- pGo->SetRespawnTime(HOUR*IN_MILISECONDS);
- }
+ pGo->SetRespawnTime(HOUR*IN_MILISECONDS);
}
}
diff --git a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp
index a32112ed709..19046679816 100644
--- a/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp
+++ b/src/bindings/scripts/scripts/zone/hellfire_peninsula/hellfire_peninsula.cpp
@@ -90,7 +90,7 @@ struct TRINITY_DLL_DECL npc_aeranasAI : public ScriptedAI
m_creature->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_QUESTGIVER);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
DoScriptText(SAY_FREE, m_creature);
return;
}
diff --git a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
index 87eb787c095..8208f320e0f 100644
--- a/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
+++ b/src/bindings/scripts/scripts/zone/karazhan/bosses_opera.cpp
@@ -1161,7 +1161,7 @@ void boss_julianneAI::DamageTaken(Unit* done_by, uint32 &damage)
Romulo->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Romulo->GetMotionMaster()->Clear();
Romulo->setDeathState(JUST_DIED);
- Romulo->CombatStop();
+ Romulo->CombatStop(true);
Romulo->DeleteThreatList();
Romulo->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
@@ -1216,7 +1216,7 @@ void boss_romuloAI::DamageTaken(Unit* done_by, uint32 &damage)
Julianne->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
Julianne->GetMotionMaster()->Clear();
Julianne->setDeathState(JUST_DIED);
- Julianne->CombatStop();
+ Julianne->CombatStop(true);
Julianne->DeleteThreatList();
Julianne->SetUInt32Value(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_LOOTABLE);
}
diff --git a/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp b/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp
index 1ed6b003504..22f80983084 100644
--- a/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp
+++ b/src/bindings/scripts/scripts/zone/nagrand/nagrand.cpp
@@ -109,6 +109,17 @@ struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI
m_creature->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
}
+ void AttackedBy(Unit* pAttacker)
+ {
+ if (m_creature->getVictim())
+ return;
+
+ if (m_creature->IsFriendlyTo(pAttacker))
+ return;
+
+ AttackStart(pAttacker);
+ }
+
void DamageTaken(Unit *done_by, uint32 & damage)
{
if (done_by->GetTypeId() == TYPEID_PLAYER && (m_creature->GetHealth() - damage)*100 / m_creature->GetMaxHealth() < 30)
@@ -122,7 +133,7 @@ struct TRINITY_DLL_DECL mob_lumpAI : public ScriptedAI
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
m_creature->setFaction(1080); //friendly
m_creature->SetStandState(UNIT_STAND_STATE_SIT);
DoScriptText(LUMP_DEFEAT, m_creature);
diff --git a/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp b/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp
index fb8b14c368e..c8382eaaa96 100644
--- a/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp
+++ b/src/bindings/scripts/scripts/zone/shadowfang_keep/instance_shadowfang_keep.cpp
@@ -66,22 +66,6 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance
Encounter[i] = NOT_STARTED;
}
- Player* GetPlayerInMap()
- {
- Map::PlayerList const& players = instance->GetPlayers();
-
- if (!players.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* plr = itr->getSource())
- return plr;
- }
- }
- debug_log("TSCR: Instance Shadowfang Keep: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
- }
-
void OnCreatureCreate(Creature* pCreature, bool add)
{
switch(pCreature->GetEntry())
@@ -115,18 +99,13 @@ struct TRINITY_DLL_DECL instance_shadowfang_keep : public ScriptedInstance
void DoSpeech()
{
- Player* pPlayer = GetPlayerInMap();
+ Creature* pAda = instance->GetCreature(uiAdaGUID);
+ Creature* pAsh = instance->GetCreature(uiAshGUID);
- if (pPlayer)
+ if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive())
{
- Unit* pAda = Unit::GetUnit(*pPlayer,uiAdaGUID);
- Unit* pAsh = Unit::GetUnit(*pPlayer,uiAshGUID);
-
- if (pAda && pAda->isAlive() && pAsh && pAsh->isAlive())
- {
- DoScriptText(SAY_BOSS_DIE_AD,pAda);
- DoScriptText(SAY_BOSS_DIE_AS,pAsh);
- }
+ DoScriptText(SAY_BOSS_DIE_AD,pAda);
+ DoScriptText(SAY_BOSS_DIE_AS,pAsh);
}
}
diff --git a/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp b/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp
index 3182a56926c..c952c1057f7 100644
--- a/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp
+++ b/src/bindings/scripts/scripts/zone/stormwind/stormwind_city.cpp
@@ -64,58 +64,67 @@ bool GossipSelect_npc_archmage_malin(Player *player, Creature *_Creature, uint32
## npc_bartleby
######*/
+enum
+{
+ FACTION_ENEMY = 168,
+ QUEST_BEAT = 1640
+};
+
struct TRINITY_DLL_DECL npc_bartlebyAI : public ScriptedAI
{
- npc_bartlebyAI(Creature *c) : ScriptedAI(c) {}
+ npc_bartlebyAI(Creature *c) : ScriptedAI(c)
+ {
+ m_uiNormalFaction = c->getFaction();
+ }
- uint64 PlayerGUID;
+ uint32 m_uiNormalFaction;
void Reset()
{
- m_creature->setFaction(11);
-
- PlayerGUID = 0;
+ if (m_creature->getFaction() != m_uiNormalFaction)
+ m_creature->setFaction(m_uiNormalFaction);
}
- void JustDied(Unit *who)
+ void AttackedBy(Unit* pAttacker)
{
- m_creature->setFaction(11);
+ if (m_creature->getVictim())
+ return;
+
+ if (m_creature->IsFriendlyTo(pAttacker))
+ return;
+
+ AttackStart(pAttacker);
}
- void DamageTaken(Unit *done_by, uint32 & damage)
+ void Aggro(Unit *who) { }
+
+ void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
{
- if(damage > m_creature->GetHealth() || ((m_creature->GetHealth() - damage)*100 / m_creature->GetMaxHealth() < 15))
+ if (uiDamage > m_creature->GetHealth() || ((m_creature->GetHealth() - uiDamage)*100 / m_creature->GetMaxHealth() < 15))
{
//Take 0 damage
- damage = 0;
-
- if (done_by->GetTypeId() == TYPEID_PLAYER && done_by->GetGUID() == PlayerGUID)
- {
- CAST_PLR(done_by)->AttackStop();
- CAST_PLR(done_by)->AreaExploredOrEventHappens(1640);
- }
- m_creature->CombatStop();
+ uiDamage = 0;
+
+ if (pDoneBy->GetTypeId() == TYPEID_PLAYER)
+ ((Player*)pDoneBy)->AreaExploredOrEventHappens(QUEST_BEAT);
EnterEvadeMode();
}
}
-
- void EnterCombat(Unit *who) {}
};
-bool QuestAccept_npc_bartleby(Player *player, Creature *_Creature, Quest const *_Quest)
+bool QuestAccept_npc_bartleby(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
{
- if(_Quest->GetQuestId() == 1640)
+ if (pQuest->GetQuestId() == QUEST_BEAT)
{
- _Creature->setFaction(168);
- CAST_AI(npc_bartlebyAI, _Creature->AI())->PlayerGUID = player->GetGUID();
- CAST_AI(npc_bartlebyAI, _Creature->AI())->AttackStart(player);
+ pCreature->setFaction(FACTION_ENEMY);
+ ((npc_bartlebyAI*)pCreature->AI())->AttackStart(pPlayer);
}
return true;
}
-CreatureAI* GetAI_npc_bartleby(Creature *_creature)
+CreatureAI* GetAI_npc_bartleby(Creature* pCreature)
{
- return new npc_bartlebyAI(_creature);
+ return new npc_bartlebyAI(pCreature);
}
/*######
@@ -130,31 +139,44 @@ enum
struct TRINITY_DLL_DECL npc_dashel_stonefistAI : public ScriptedAI
{
- npc_dashel_stonefistAI(Creature *c) : ScriptedAI(c) { uiNormFaction = c->getFaction(); }
+ npc_dashel_stonefistAI(Creature *c) : ScriptedAI(c)
+ {
+ m_uiNormalFaction = c->getFaction();
+ }
- uint32 uiNormFaction;
+ uint32 m_uiNormalFaction;
void Reset()
{
- m_creature->setFaction(uiNormFaction);
+ if (m_creature->getFaction() != m_uiNormalFaction)
+ m_creature->setFaction(m_uiNormalFaction);
}
- void DamageTaken(Unit *done_by, uint32 & damage)
+ void AttackedBy(Unit* pAttacker)
{
- if ((damage > m_creature->GetHealth()) || (m_creature->GetHealth() - damage)*100 / m_creature->GetMaxHealth() < 15)
+ if (m_creature->getVictim())
+ return;
+
+ if (m_creature->IsFriendlyTo(pAttacker))
+ return;
+
+ AttackStart(pAttacker);
+ }
+
+ void Aggro(Unit *who) {}
+
+ void DamageTaken(Unit* pDoneBy, uint32 &uiDamage)
+ {
+ if (uiDamage > m_creature->GetHealth() || ((m_creature->GetHealth() - uiDamage)*100 / m_creature->GetMaxHealth() < 15))
{
- //Take 0 damage
- damage = 0;
+ uiDamage = 0;
- if (done_by->GetTypeId() == TYPEID_PLAYER)
- CAST_PLR(done_by)->AreaExploredOrEventHappens(QUEST_MISSING_DIPLO_PT8);
+ if (pDoneBy->GetTypeId() == TYPEID_PLAYER)
+ ((Player*)pDoneBy)->AreaExploredOrEventHappens(QUEST_MISSING_DIPLO_PT8);
- //m_creature->CombatStop();
EnterEvadeMode();
}
}
-
- void EnterCombat(Unit *who) {}
};
bool QuestAccept_npc_dashel_stonefist(Player* pPlayer, Creature* pCreature, Quest const* pQuest)
diff --git a/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp b/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp
index 918fec913b5..12f68359a4a 100644
--- a/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp
+++ b/src/bindings/scripts/scripts/zone/stratholme/instance_stratholme.cpp
@@ -102,23 +102,6 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance
abomnationGUID.clear();
}
- Player* GetPlayerInMap()
- {
- Map::PlayerList const& players = instance->GetPlayers();
-
- if (!players.isEmpty())
- {
- for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
- {
- if (Player* plr = itr->getSource())
- return plr;
- }
- }
-
- debug_log("TSCR: Instance Stratholme: GetPlayerInMap, but PlayerList is empty!");
- return NULL;
- }
-
bool StartSlaugtherSquare()
{
//change to DONE when crystals implemented
@@ -183,14 +166,6 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance
void SetData(uint32 type, uint32 data)
{
- Player *player = GetPlayerInMap();
-
- if (!player)
- {
- debug_log("TSCR: Instance Stratholme: SetData (Type: %u Data %u) cannot find any player.", type, data);
- return;
- }
-
switch(type)
{
case TYPE_BARON_RUN:
@@ -206,8 +181,10 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance
//may add code to remove aura from players, but in theory the time should be up already and removed.
break;
case DONE:
- if (Unit *t = Unit::GetUnit(*player, ysidaTriggerGUID))
- t->SummonCreature(C_YSIDA,t->GetPositionX(),t->GetPositionY(),t->GetPositionZ(),t->GetOrientation(),TEMPSUMMON_TIMED_DESPAWN,1800000);
+ if (Creature* pYsidaT = instance->GetCreature(ysidaTriggerGUID))
+ pYsidaT->SummonCreature(C_YSIDA,
+ pYsidaT->GetPositionX(),pYsidaT->GetPositionY(),pYsidaT->GetPositionZ(),pYsidaT->GetOrientation(),
+ TEMPSUMMON_TIMED_DESPAWN,1800000);
BaronRun_Timer = 0;
break;
}
@@ -243,9 +220,9 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance
uint32 count = abomnationGUID.size();
for(std::set<uint64>::iterator i = abomnationGUID.begin(); i != abomnationGUID.end(); ++i)
{
- if (Unit* abom = Unit::GetUnit(*player, *i))
+ if (Creature* pAbom = instance->GetCreature(*i))
{
- if (!abom->isAlive())
+ if (!pAbom->isAlive())
--count;
}
}
@@ -254,9 +231,12 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance
{
//a bit itchy, it should close the door after 10 secs, but it doesn't. skipping it for now.
//UpdateGoState(ziggurat4GUID,0,true);
- player->SummonCreature(C_RAMSTEIN,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000);
+ if (Creature* pBaron = instance->GetCreature(baronGUID))
+ pBaron->SummonCreature(C_RAMSTEIN,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000);
debug_log("TSCR: Instance Stratholme: Ramstein spawned.");
- } else debug_log("TSCR: Instance Stratholme: %u Abomnation left to kill.",count);
+ }
+ else
+ debug_log("TSCR: Instance Stratholme: %u Abomnation left to kill.",count);
}
if (data == DONE)
{
@@ -270,22 +250,22 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance
{
if (GetData(TYPE_BARON_RUN) == IN_PROGRESS)
{
- if (Group *pGroup = player->GetGroup())
+ Map::PlayerList const& players = instance->GetPlayers();
+
+ if (!players.isEmpty())
{
- for(GroupReference *itr = pGroup->GetFirstMember(); itr != NULL; itr = itr->next())
+ for(Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
{
- Player* pGroupie = itr->getSource();
- if (!pGroupie)
- continue;
-
- if (pGroupie->HasAura(SPELL_BARON_ULTIMATUM))
- pGroupie->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM);
+ if (Player* pPlayer = itr->getSource())
+ {
+ if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM))
+ pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM);
+
+ if (pPlayer->GetQuestStatus(QUEST_DEAD_MAN_PLEA) == QUEST_STATUS_INCOMPLETE)
+ pPlayer->AreaExploredOrEventHappens(QUEST_DEAD_MAN_PLEA);
+ }
}
- } else if (player->HasAura(SPELL_BARON_ULTIMATUM))
- player->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM);
-
- if (Unit *temp = Unit::GetUnit(*player,GetData64(DATA_BARON)))
- player->GroupEventHappens(QUEST_DEAD_MAN_PLEA,temp);
+ }
SetData(TYPE_BARON_RUN,DONE);
}
@@ -363,10 +343,10 @@ struct TRINITY_DLL_DECL instance_stratholme : public ScriptedInstance
{
if (SlaugtherSquare_Timer <= diff)
{
- if (Player *p = GetPlayerInMap())
+ if (Creature* pBaron = instance->GetCreature(baronGUID))
{
for(uint8 i = 0; i < 4; i++)
- p->SummonCreature(C_BLACK_GUARD,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000);
+ pBaron->SummonCreature(C_BLACK_GUARD,4032.84,-3390.24,119.73,4.71,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,1800000);
UpdateGoState(ziggurat4GUID,0,false);
UpdateGoState(ziggurat5GUID,0,false);
diff --git a/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp b/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp
index fb376795119..eff160843de 100644
--- a/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp
+++ b/src/bindings/scripts/scripts/zone/teldrassil/teldrassil.cpp
@@ -73,10 +73,9 @@ struct TRINITY_DLL_DECL npc_mistAI : public ScriptedAI
void EnterEvadeMode()
{
- m_creature->InterruptNonMeleeSpells(true);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
m_creature->LoadCreaturesAddon();
if (m_creature->isAlive())
diff --git a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
index cf55ff0123d..e35c45b2cf0 100644
--- a/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
+++ b/src/bindings/scripts/scripts/zone/terokkar_forest/terokkar_forest.cpp
@@ -72,7 +72,7 @@ struct TRINITY_DLL_DECL mob_unkor_the_ruthlessAI : public ScriptedAI
m_creature->SetStandState(UNIT_STAND_STATE_SIT);
m_creature->RemoveAllAuras();
m_creature->DeleteThreatList();
- m_creature->CombatStop();
+ m_creature->CombatStop(true);
UnkorUnfriendly_Timer = 60000;
}