mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Scripts/Vault of Archavon: Earth, Wind & Fire achievement - by idostyle@zoit, with some spell attribute correction to the patch by me.
This commit is contained in:
5
sql/updates/world/2011_09_03_09_world_spell_dbc.sql
Normal file
5
sql/updates/world/2011_09_03_09_world_spell_dbc.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
-- Dummy effect with caster as target
|
||||
DELETE FROM `spell_dbc` WHERE `id` IN (68308);
|
||||
INSERT INTO `spell_dbc` (`Id`, `Attributes`, `AttributesEx`, `AttributesEx2`,`AttributesEx3`,`AttributesEx4`,`AttributesEx5`,`AttributesEx6`,`Effect1`,`EffectImplicitTargetA1`,`EffectImplicitTargetB1`,`comment`)
|
||||
VALUES
|
||||
(68308, 0x09800100, 0x00000420, 0x00004005, 0x10040000, 0x00000080, 0x00000008, 0x00001000, 3, 1, 0, 'Vault of Archavon - Earth, Wind & Fire - Achievement Check');
|
||||
@@ -41,6 +41,9 @@ class instance_archavon : public InstanceMapScript
|
||||
{
|
||||
EmalonGUID = 0;
|
||||
ToravonGUID = 0;
|
||||
ArchavonDeath = 0;
|
||||
EmalonDeath = 0;
|
||||
KoralonDeath = 0;
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature)
|
||||
@@ -73,9 +76,63 @@ class instance_archavon : public InstanceMapScript
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool SetBossState(uint32 type, EncounterState state)
|
||||
{
|
||||
if (!InstanceScript::SetBossState(type, state))
|
||||
return false;
|
||||
|
||||
if (state != DONE)
|
||||
return true;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case DATA_ARCHAVON:
|
||||
ArchavonDeath = time(NULL);
|
||||
break;
|
||||
case DATA_EMALON:
|
||||
EmalonDeath = time(NULL);
|
||||
break;
|
||||
case DATA_KORALON:
|
||||
KoralonDeath = time(NULL);
|
||||
break;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
|
||||
// on every death of Archavon, Emalon and Koralon check our achievement
|
||||
DoCastSpellOnPlayers(SPELL_EARTH_WIND_FIRE_ACHIEVEMENT_CHECK);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/)
|
||||
{
|
||||
switch (criteria_id)
|
||||
{
|
||||
case CRITERIA_EARTH_WIND_FIRE_10:
|
||||
case CRITERIA_EARTH_WIND_FIRE_25:
|
||||
if (ArchavonDeath && EmalonDeath && KoralonDeath)
|
||||
{
|
||||
// instance difficulty check is already done in db (achievement_criteria_data)
|
||||
// int() for Visual Studio, compile errors with abs(time_t)
|
||||
return (abs(int(ArchavonDeath-EmalonDeath)) < MINUTE && \
|
||||
abs(int(EmalonDeath-KoralonDeath)) < MINUTE && \
|
||||
abs(int(KoralonDeath-ArchavonDeath)) < MINUTE);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
uint64 EmalonGUID;
|
||||
uint64 ToravonGUID;
|
||||
time_t ArchavonDeath;
|
||||
time_t EmalonDeath;
|
||||
time_t KoralonDeath;
|
||||
};
|
||||
|
||||
InstanceScript* GetInstanceScript(InstanceMap* map) const
|
||||
|
||||
@@ -36,4 +36,15 @@ enum Data
|
||||
|
||||
#define MAX_ENCOUNTER 4
|
||||
|
||||
enum AchievementCriteriaIds
|
||||
{
|
||||
CRITERIA_EARTH_WIND_FIRE_10 = 12018,
|
||||
CRITERIA_EARTH_WIND_FIRE_25 = 12019,
|
||||
};
|
||||
|
||||
enum AchievementSpells
|
||||
{
|
||||
SPELL_EARTH_WIND_FIRE_ACHIEVEMENT_CHECK = 68308,
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user