Merge [SD2]
r1017 Remove no longer needed functions used in instance scripts. Some additional code cleanup. r1018 Remove redundant calls to InterruptNonMeeleSpells() and use true in CombatStop() calls instead where needed. r1019 Fixed: use correct isInFlight check for item 34475 - Skipp already implemented r1020 Restore work of three scripts after recent changes in AI about AttackedBy(), also some additional code cleanup. --HG-- branch : trunk
This commit is contained in:
@@ -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);
|
||||
|
||||
-17
@@ -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)
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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) {}
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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)
|
||||
|
||||
+35
-52
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
-25
@@ -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:
|
||||
|
||||
+11
-31
@@ -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;
|
||||
|
||||
if (instance->IsHeroic())
|
||||
uiChest = m_uiChestHGUID;
|
||||
else
|
||||
uiChest = m_uiChestNGUID;
|
||||
|
||||
if (GameObject* pGo = instance->GetGameObject(uiChest))
|
||||
{
|
||||
uint64 uiChest;
|
||||
if (pGo->isSpawned())
|
||||
return;
|
||||
|
||||
if (instance->IsHeroic())
|
||||
uiChest = m_uiChestHGUID;
|
||||
else
|
||||
uiChest = m_uiChestNGUID;
|
||||
|
||||
if (GameObject* pGo = instance->GetGameObject(uiChest))
|
||||
{
|
||||
if (pGo->isSpawned())
|
||||
return;
|
||||
|
||||
pGo->SetRespawnTime(HOUR*IN_MILISECONDS);
|
||||
}
|
||||
pGo->SetRespawnTime(HOUR*IN_MILISECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
uiDamage = 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();
|
||||
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)
|
||||
|
||||
@@ -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 (Player* pPlayer = itr->getSource())
|
||||
{
|
||||
if (pPlayer->HasAura(SPELL_BARON_ULTIMATUM))
|
||||
pPlayer->RemoveAurasDueToSpell(SPELL_BARON_ULTIMATUM);
|
||||
|
||||
if (pGroupie->HasAura(SPELL_BARON_ULTIMATUM))
|
||||
pGroupie->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);
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user