Implement Four-Horsemen achievements (requires DB Data).
Fixes issue #1107. --HG-- branch : trunk
This commit is contained in:
@@ -322,6 +322,17 @@ void InstanceData::DoCompleteAchievement(uint32 achievement)
|
|||||||
pPlayer->CompletedAchievement(AE);
|
pPlayer->CompletedAchievement(AE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update Achievement Criteria for all players in instance
|
||||||
|
void InstanceData::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2, Unit *unit, uint32 time)
|
||||||
|
{
|
||||||
|
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||||
|
|
||||||
|
if (!PlayerList.isEmpty())
|
||||||
|
for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
|
||||||
|
if (Player *pPlayer = i->getSource())
|
||||||
|
pPlayer->UpdateAchievementCriteria(type, miscvalue1, miscvalue2, unit, time);
|
||||||
|
}
|
||||||
|
|
||||||
// Remove Auras due to Spell on all players in instance
|
// Remove Auras due to Spell on all players in instance
|
||||||
void InstanceData::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
|
void InstanceData::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -158,6 +158,9 @@ class InstanceData : public ZoneScript
|
|||||||
// Complete Achievement for all players in instance
|
// Complete Achievement for all players in instance
|
||||||
void DoCompleteAchievement(uint32 achievement);
|
void DoCompleteAchievement(uint32 achievement);
|
||||||
|
|
||||||
|
// Update Achievement Criteria for all players in instance
|
||||||
|
void DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1=0, uint32 miscvalue2=0, Unit *unit=NULL, uint32 time=0);
|
||||||
|
|
||||||
// Remove Auras due to Spell on all players in instance
|
// Remove Auras due to Spell on all players in instance
|
||||||
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell);
|
void DoRemoveAurasDueToSpellOnPlayers(uint32 spell);
|
||||||
|
|
||||||
|
|||||||
@@ -104,6 +104,9 @@ struct boss_four_horsemenAI : public BossAI
|
|||||||
if (!encounterActionReset)
|
if (!encounterActionReset)
|
||||||
DoEncounterAction(NULL, false, true, false);
|
DoEncounterAction(NULL, false, true, false);
|
||||||
|
|
||||||
|
if (instance)
|
||||||
|
instance->SetData(DATA_HORSEMEN0 + id, NOT_STARTED);
|
||||||
|
|
||||||
me->SetReactState(REACT_AGGRESSIVE);
|
me->SetReactState(REACT_AGGRESSIVE);
|
||||||
uiEventStarterGUID = 0;
|
uiEventStarterGUID = 0;
|
||||||
nextWP = 0;
|
nextWP = 0;
|
||||||
@@ -274,10 +277,18 @@ struct boss_four_horsemenAI : public BossAI
|
|||||||
{
|
{
|
||||||
events.Reset();
|
events.Reset();
|
||||||
summons.DespawnAll();
|
summons.DespawnAll();
|
||||||
if(instance && DoEncounterAction(NULL, false, false, true))
|
|
||||||
|
if (instance)
|
||||||
|
instance->SetData(DATA_HORSEMEN0 + id, DONE);
|
||||||
|
|
||||||
|
if (instance && DoEncounterAction(NULL, false, false, true))
|
||||||
{
|
{
|
||||||
instance->SetBossState(BOSS_HORSEMEN, DONE);
|
instance->SetBossState(BOSS_HORSEMEN, DONE);
|
||||||
instance->SaveToDB();
|
instance->SaveToDB();
|
||||||
|
|
||||||
|
// Achievements related to the 4-horsemen are given through spell 59450 which does not exist.
|
||||||
|
// There is thus no way it can be given by casting the spell on the players.
|
||||||
|
instance->DoUpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_BE_SPELL_TARGET, 59450);
|
||||||
}
|
}
|
||||||
|
|
||||||
DoScriptText(SAY_DEATH[id], me);
|
DoScriptText(SAY_DEATH[id], me);
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ inline uint32 GetEruptionSection(float x, float y)
|
|||||||
struct instance_naxxramas : public InstanceData
|
struct instance_naxxramas : public InstanceData
|
||||||
{
|
{
|
||||||
instance_naxxramas(Map* pMap) : InstanceData(pMap)
|
instance_naxxramas(Map* pMap) : InstanceData(pMap)
|
||||||
, Sapphiron(NULL), pGothikGate(NULL), HorsemenChest(NULL), HorsemenNum(0)
|
, Sapphiron(NULL), pGothikGate(NULL), HorsemenChest(NULL)
|
||||||
{
|
{
|
||||||
SetBossNumber(MAX_BOSS_NUMBER);
|
SetBossNumber(MAX_BOSS_NUMBER);
|
||||||
LoadDoorData(doorData);
|
LoadDoorData(doorData);
|
||||||
@@ -114,7 +114,6 @@ struct instance_naxxramas : public InstanceData
|
|||||||
std::set<GameObject*> HeiganEruption[4];
|
std::set<GameObject*> HeiganEruption[4];
|
||||||
GameObject* pGothikGate, *HorsemenChest;
|
GameObject* pGothikGate, *HorsemenChest;
|
||||||
Creature* Sapphiron;
|
Creature* Sapphiron;
|
||||||
uint32 HorsemenNum;
|
|
||||||
uint64 uiFaerlina;
|
uint64 uiFaerlina;
|
||||||
uint64 uiThane;
|
uint64 uiThane;
|
||||||
uint64 uiLady;
|
uint64 uiLady;
|
||||||
@@ -129,6 +128,9 @@ struct instance_naxxramas : public InstanceData
|
|||||||
uint64 uiKelthuzadTrigger;
|
uint64 uiKelthuzadTrigger;
|
||||||
uint64 uiPortals[4];
|
uint64 uiPortals[4];
|
||||||
|
|
||||||
|
time_t minHorsemenDiedTime;
|
||||||
|
time_t maxHorsemenDiedTime;
|
||||||
|
|
||||||
void OnCreatureCreate(Creature* pCreature, bool add)
|
void OnCreatureCreate(Creature* pCreature, bool add)
|
||||||
{
|
{
|
||||||
switch(pCreature->GetEntry())
|
switch(pCreature->GetEntry())
|
||||||
@@ -187,6 +189,26 @@ struct instance_naxxramas : public InstanceData
|
|||||||
if (pGothikGate)
|
if (pGothikGate)
|
||||||
pGothikGate->SetGoState(GOState(value));
|
pGothikGate->SetGoState(GOState(value));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case DATA_HORSEMEN0:
|
||||||
|
case DATA_HORSEMEN1:
|
||||||
|
case DATA_HORSEMEN2:
|
||||||
|
case DATA_HORSEMEN3:
|
||||||
|
if (value == NOT_STARTED)
|
||||||
|
{
|
||||||
|
minHorsemenDiedTime = 0;
|
||||||
|
maxHorsemenDiedTime = 0;
|
||||||
|
}
|
||||||
|
else if (value == DONE)
|
||||||
|
{
|
||||||
|
time_t now = time(NULL);
|
||||||
|
|
||||||
|
if (minHorsemenDiedTime == 0)
|
||||||
|
minHorsemenDiedTime = now;
|
||||||
|
|
||||||
|
maxHorsemenDiedTime = now;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -251,6 +273,28 @@ struct instance_naxxramas : public InstanceData
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* source, Unit const* target = NULL, uint32 miscvalue1 = 0)
|
||||||
|
{
|
||||||
|
switch(criteria_id)
|
||||||
|
{
|
||||||
|
case 7600: // Criteria for achievement 2176: And They Would All Go Down Together 15sec of each other 10-man
|
||||||
|
if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_10MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
case 7601: // Criteria for achievement 2177: And They Would All Go Down Together 15sec of each other 25-man
|
||||||
|
if (Difficulty(instance->GetSpawnMode()) == RAID_DIFFICULTY_25MAN_NORMAL && (maxHorsemenDiedTime - minHorsemenDiedTime) < 15)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
case 13233: // Criteria for achievement 2186: The Immortal (25-man)
|
||||||
|
// TODO.
|
||||||
|
break;
|
||||||
|
case 13237: // Criteria for achievement 2187: The Undying (10-man)
|
||||||
|
// TODO.
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
InstanceData* GetInstanceData_instance_naxxramas(Map* pMap)
|
InstanceData* GetInstanceData_instance_naxxramas(Map* pMap)
|
||||||
|
|||||||
@@ -44,6 +44,11 @@ enum Data
|
|||||||
DATA_HEIGAN_ERUPT,
|
DATA_HEIGAN_ERUPT,
|
||||||
DATA_GOTHIK_GATE,
|
DATA_GOTHIK_GATE,
|
||||||
DATA_SAPPHIRON_BIRTH,
|
DATA_SAPPHIRON_BIRTH,
|
||||||
|
|
||||||
|
DATA_HORSEMEN0,
|
||||||
|
DATA_HORSEMEN1,
|
||||||
|
DATA_HORSEMEN2,
|
||||||
|
DATA_HORSEMEN3,
|
||||||
};
|
};
|
||||||
|
|
||||||
enum Data64
|
enum Data64
|
||||||
|
|||||||
Reference in New Issue
Block a user