mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 01:08:35 +00:00
refactor(Scripts/Onyxia): Update Onyxia's script (#9371)
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1637948987614040500');
|
||||
|
||||
UPDATE `creature_template` SET `flags_extra` = `flags_extra` |128, `ScriptName` = '' WHERE `entry` = 12758;
|
||||
UPDATE `creature_template` SET `ScriptName` = '' WHERE `entry` = 11262;
|
||||
|
||||
-- Remove taunt immunity
|
||||
UPDATE `creature_template` SET `flags_extra` = `flags_extra` &~ 256 WHERE `entry` = 10184;
|
||||
File diff suppressed because it is too large
Load Diff
@@ -38,33 +38,18 @@ public:
|
||||
{
|
||||
instance_onyxias_lair_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {Initialize();};
|
||||
|
||||
uint32 m_auiEncounter[MAX_ENCOUNTER];
|
||||
std::string str_data;
|
||||
uint16 ManyWhelpsCounter;
|
||||
GuidVector minions;
|
||||
bool bDeepBreath;
|
||||
|
||||
void Initialize() override
|
||||
{
|
||||
memset(&m_auiEncounter, 0, sizeof(m_auiEncounter));
|
||||
SetBossNumber(MAX_ENCOUNTER);
|
||||
ManyWhelpsCounter = 0;
|
||||
bDeepBreath = true;
|
||||
LoadObjectData(creatureData, nullptr);
|
||||
}
|
||||
|
||||
void OnCreatureCreate(Creature* creature) override
|
||||
{
|
||||
switch (creature->GetEntry())
|
||||
{
|
||||
case NPC_ONYXIAN_WHELP:
|
||||
case NPC_ONYXIAN_LAIR_GUARD:
|
||||
minions.push_back(creature->GetGUID());
|
||||
break;
|
||||
}
|
||||
|
||||
InstanceScript::OnCreatureCreate(creature);
|
||||
}
|
||||
|
||||
void OnGameObjectCreate(GameObject* go) override
|
||||
{
|
||||
switch (go->GetEntry())
|
||||
@@ -79,26 +64,26 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void SetData(uint32 uiType, uint32 uiData) override
|
||||
bool SetBossState(uint32 type, EncounterState state) override
|
||||
{
|
||||
if (!InstanceScript::SetBossState(type, state))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (type == DATA_ONYXIA && state == NOT_STARTED)
|
||||
{
|
||||
ManyWhelpsCounter = 0;
|
||||
bDeepBreath = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void SetData(uint32 uiType, uint32 /*uiData*/) override
|
||||
{
|
||||
switch (uiType)
|
||||
{
|
||||
case DATA_ONYXIA:
|
||||
m_auiEncounter[0] = uiData;
|
||||
ManyWhelpsCounter = 0;
|
||||
bDeepBreath = true;
|
||||
if(uiData == NOT_STARTED)
|
||||
{
|
||||
for (ObjectGuid const& guid : minions)
|
||||
{
|
||||
if (Creature* c = instance->GetCreature(guid))
|
||||
{
|
||||
c->DespawnOrUnsummon();
|
||||
}
|
||||
}
|
||||
minions.clear();
|
||||
}
|
||||
break;
|
||||
case DATA_WHELP_SUMMONED:
|
||||
++ManyWhelpsCounter;
|
||||
break;
|
||||
@@ -106,29 +91,13 @@ public:
|
||||
bDeepBreath = false;
|
||||
break;
|
||||
}
|
||||
|
||||
if (uiType < MAX_ENCOUNTER && uiData == DONE)
|
||||
{
|
||||
SaveToDB();
|
||||
}
|
||||
}
|
||||
|
||||
uint32 GetData(uint32 uiType) const override
|
||||
{
|
||||
switch (uiType)
|
||||
{
|
||||
case DATA_ONYXIA:
|
||||
return m_auiEncounter[0];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::string GetSaveData() override
|
||||
{
|
||||
OUT_SAVE_INST_DATA;
|
||||
std::ostringstream saveStream;
|
||||
saveStream << "O L " << m_auiEncounter[0];
|
||||
saveStream << "O L " << GetBossSaveData();
|
||||
str_data = saveStream.str();
|
||||
OUT_SAVE_INST_DATA_COMPLETE;
|
||||
return str_data;
|
||||
@@ -136,7 +105,7 @@ public:
|
||||
|
||||
void Load(const char* in) override
|
||||
{
|
||||
if( !in )
|
||||
if (!in)
|
||||
{
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
return;
|
||||
@@ -149,13 +118,18 @@ public:
|
||||
std::istringstream loadStream(in);
|
||||
loadStream >> dataHead1 >> dataHead2 >> data0;
|
||||
|
||||
if( dataHead1 == 'O' && dataHead2 == 'L' )
|
||||
if (dataHead1 == 'O' && dataHead2 == 'L')
|
||||
{
|
||||
m_auiEncounter[0] = data0;
|
||||
|
||||
for( uint8 i = 0; i < MAX_ENCOUNTER; ++i )
|
||||
if( m_auiEncounter[i] == IN_PROGRESS )
|
||||
m_auiEncounter[i] = NOT_STARTED;
|
||||
for (uint32 i = 0; i < MAX_ENCOUNTER; ++i)
|
||||
{
|
||||
uint32 tmpState;
|
||||
loadStream >> tmpState;
|
||||
if (tmpState == IN_PROGRESS || tmpState == FAIL || tmpState > SPECIAL)
|
||||
{
|
||||
tmpState = NOT_STARTED;
|
||||
}
|
||||
SetBossState(i, EncounterState(tmpState));
|
||||
}
|
||||
}
|
||||
else
|
||||
OUT_LOAD_INST_DATA_FAIL;
|
||||
|
||||
@@ -58,4 +58,6 @@ inline AI* GetOnyxiasLairAI(T* obj)
|
||||
return GetInstanceAI<AI>(obj, OnyxiasLairScriptName);
|
||||
}
|
||||
|
||||
#define RegisterOnyxiasLairCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetOnyxiasLairAI)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user