void Load(char const* str) { if (!str) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(str); char dataHead1, dataHead2; std::istringstream loadStream(str); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'R' && dataHead2 == 'S') { for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } // Xinef: additional check if (GetBossState(DATA_HALION_INTRO_DONE) != DONE) { SetBossState(DATA_HALION_INTRO1, NOT_STARTED); SetBossState(DATA_HALION_INTRO2, NOT_STARTED); } } else
void SetData(uint32 type, uint32 data) { switch (type) { case DATA_PLATFORM_KEEPER_RESPAWNED: ++AliveKeepersCount; break; case DATA_PLATFORM_KEEPER_DIED: --AliveKeepersCount; break; case DATA_BRIDGE_ACTIVATED: SetBossState(DATA_BRIDGE_EMERGED, NOT_STARTED); SetBossState(DATA_BRIDGE_EMERGED, DONE); break; case DATA_ACTIVATE_SHIELD: if (Creature* vashj = instance->GetCreature(LadyVashjGUID)) for (uint8 i = 0; i < 4; ++i) if (GameObject* gobject = instance->GetGameObject(ShieldGeneratorGUID[i])) { gobject->RemoveFlag(GAMEOBJECT_FLAGS, GO_FLAG_NOT_SELECTABLE); vashj->SummonTrigger(gobject->GetPositionX(), gobject->GetPositionY(), gobject->GetPositionZ(), 0.0f, 0); } break; } }
void SetData(uint32 type, uint32) { switch (type) { case NPC_ECK_THE_FEROCIOUS: if (GetBossState(DATA_ECK_THE_FEROCIOUS_INIT) != DONE) { SetBossState(DATA_ECK_THE_FEROCIOUS_INIT, NOT_STARTED); SetBossState(DATA_ECK_THE_FEROCIOUS_INIT, DONE); } break; case GO_ALTAR_OF_SLAD_RAN: if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[0])) statue->SetGoState(GO_STATE_READY); break; case GO_ALTAR_OF_DRAKKARI: if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[1])) statue->SetGoState(GO_STATE_READY); break; case GO_ALTAR_OF_MOORABI: if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[2])) statue->SetGoState(GO_STATE_READY); break; } if (type >= GO_ALTAR_OF_SLAD_RAN) { for (uint8 i = 0; i < 3; ++i) if (GameObject* statue = instance->GetGameObject(_bridgeGUIDs[i])) if (statue->GetGoState() != GO_STATE_READY) return; _activateTimer = 1; } }
void Load(char const* strIn) override { if (!strIn) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(strIn); std::istringstream loadStream(strIn); for (uint8 i = 0; i < EncounterCount; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } loadStream >> TrialCounter; EventStage = 0; OUT_LOAD_INST_DATA_COMPLETE; }
void SetData(uint32 type, uint32 data) { SetBossState(type, EncounterState(data)); if (data == DONE) SaveToDB(); }
void Update(uint32 diff) { if (SignalTimerState == IN_PROGRESS) { if (SignalTimer <= diff) { --SignalTimerMinutes; SignalTimer = 60000; if (SignalTimerMinutes) { DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 1); DoUpdateWorldState(WORLDSTATE_ALGALON_TIMER, SignalTimerMinutes); } else { SignalTimerState = FAIL; DoUpdateWorldState(WORLDSTATE_SHOW_TIMER, 0); if (Creature* Algalon = instance->GetCreature(uiAlgalonGUID)) Algalon->AI()->DoAction(ACTION_ALGALON_ASCEND); SetBossState(TYPE_ALGALON, FAIL); } SaveToDB(); } else SignalTimer -= diff; } }
void Load(const char* in) { if (!in) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(in); char dataHead1, dataHead2; std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'S' && dataHead2 == 'B') { for (uint32 i = 0; i < MAX_ENCOUNTERS; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; // Below makes the player on-instance-entry display of bosses killed shit work (SMSG_RAID_INSTANCE_INFO). // Like, say an unbound player joins the party and he tries to enter the dungeon / raid. // This makes sure binding-to-instance-on-entrance confirmation box will properly display bosses defeated / available. SetBossState(i, EncounterState(tmpState)); } } else OUT_LOAD_INST_DATA_FAIL;
void Load(const char* strIn) override { if (!strIn) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(strIn); char dataHead1, dataHead2; std::istringstream loadStream(strIn); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'N' && dataHead2 == 'X') { for (uint8 i = 0; i < EncounterCount; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } loadStream >> playerDied; } OUT_LOAD_INST_DATA_COMPLETE; }
void Load(const char* str) { if (!str) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(str); char dataHead1, dataHead2; std::istringstream loadStream(str); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'E' && dataHead2 == 'E') { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } } else OUT_LOAD_INST_DATA_FAIL;
void Load(const char* str) { if (!str) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(str); char dataHead1, dataHead2; std::istringstream loadStream(str); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'H' && dataHead2 == 'O') { for (uint32 i = 0; i < EncounterCount; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } uint32 tmp; loadStream >> tmp; IncreaseDeadElementals(tmp); } else
void Load(const char* data) { if (!data) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(data); char dataHead1, dataHead2; uint16 data0; std::istringstream loadStream(data); loadStream >> dataHead1 >> dataHead2 >> data0; if (dataHead1 == 'E' && dataHead2 == 'E') { if (data0 == IN_PROGRESS || data0 > SPECIAL) data0 = NOT_STARTED; SetBossState(BOSS_MALYGOS, EncounterState(data0)); } else OUT_LOAD_INST_DATA_FAIL; OUT_LOAD_INST_DATA_COMPLETE; }
bool SetBossState(uint32 type, EncounterState state) override { if (!InstanceScript::SetBossState(type, state)) return false; switch (type) { case DATA_RAZORGORE_THE_UNTAMED: if (state == DONE) { for (GuidList::const_iterator itr = EggList.begin(); itr != EggList.end(); ++itr) if (GameObject* egg = instance->GetGameObject(*itr)) egg->SetPhaseMask(2, true); } SetData(DATA_EGG_EVENT, NOT_STARTED); break; case DATA_NEFARIAN: switch (state) { case NOT_STARTED: if (Creature* nefarian = GetCreature(DATA_NEFARIAN)) nefarian->DespawnOrUnsummon(); break; case FAIL: _events.ScheduleEvent(EVENT_RESPAWN_NEFARIUS, 15 * IN_MILLISECONDS * MINUTE); SetBossState(DATA_NEFARIAN, NOT_STARTED); break; default: break; } break; } return true; }
void Load(const char * str) { if (!str) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(str); char dataHead1, dataHead2; std::istringstream loadStream(str); loadStream >> dataHead1 >> dataHead2; if(dataHead1 == 'N' && dataHead2 == 'X') { for(int i = 0; i < MAX_BOSS_NUMBER; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } loadStream >> PlayerDeathCount >> HeiganPlayerDeathCount; } else
void Load(char const* strIn) { if (!strIn) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(strIn); char dataHead1, dataHead2; std::istringstream loadStream(strIn); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'U' && dataHead2 == 'U') { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; if (i == DATA_COLOSSUS) SetData(i, tmpState); else SetBossState(i, EncounterState(tmpState)); } } OUT_LOAD_INST_DATA_COMPLETE; }
void Load(char const* str) override { if (!str) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(str); char dataHead1, dataHead2; std::istringstream loadStream(str); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'S' && dataHead2 == 'L') { for (uint32 i = 0; i < EncounterCount; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } } else
void Load(const char* strIn) { if (!strIn) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(strIn); char dataHead1, dataHead2; uint32 data14; std::istringstream loadStream(strIn); loadStream >> dataHead1 >> dataHead2 >> data14; if (dataHead1 == 'U' && dataHead2 == 'U') { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { uint32 tmpState; loadStream >> tmpState; loadStream >> uiEncounter[data14]; //colossus pre leviathan if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } } OUT_LOAD_INST_DATA_COMPLETE; }
void Load(const char* in) { if (!in) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(in); char dataHead1, dataHead2; std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'V' && dataHead2 == 'P') { for (uint8 i = 0; i < maxEncounter; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } } OUT_LOAD_INST_DATA_COMPLETE; }
void OnCreatureCreate(Creature* creature) override { if (creature->GetEntry() == NPC_ANZU) { if (GetBossState(DATA_ANZU) == DONE) creature->DisappearAndDie(); else SetBossState(DATA_ANZU, IN_PROGRESS); } }
void ProcessEvent(WorldObject* /*gameObject*/, uint32 eventId) { switch (eventId) { case EVENT_PYROGUARD_EMBERSEER: SetBossState(DATA_PYROGAURD_EMBERSEER,IN_PROGRESS); break; default: break; } }
void OnUnitDeath(Unit* unit) override { Creature* creature = unit->ToCreature(); if (!creature) return; switch (creature->GetEntry()) { case NPC_FIRE_WARDEN: case NPC_EARTH_WARDEN: case NPC_WATER_WARDEN: case NPC_AIR_WARDEN: uint32 data = creature->GetEntry() - WARDEN_ENTRY_DATA_DELTA; SetBossState(data, IN_PROGRESS); // Needs to be set to IN_PROGRESS or else the gameobjects state won't be updated SetBossState(data, DONE); IncreaseDeadElementals(1); if (Creature* brann = instance->GetCreature(BrannBronzebeardGUID)) brann->AI()->DoAction(ACTION_ELEMENTAL_DIED); break; } }
bool SetBossState(uint32 type, EncounterState state) { // pussywizard: if (GetBossState(type) == DONE && state != DONE) // prevent undoneing a boss xd return false; if (!InstanceScript::SetBossState(type, state)) return false; switch (type) { case BOSS_RAZORGORE: HandleGameObject(RazorgoreDoorGUID, state == DONE); if (state == DONE) { for (std::list<uint64>::const_iterator itr = EggList.begin(); itr != EggList.end(); ++itr) if (GameObject* egg = instance->GetGameObject((*itr))) egg->SetPhaseMask(2, true); } SetData(DATA_EGG_EVENT, NOT_STARTED); break; case BOSS_VAELASTRAZ: HandleGameObject(VaelastraszDoorGUID, state == DONE); break; case BOSS_BROODLORD: HandleGameObject(BroodlordDoorGUID, state == DONE); break; case BOSS_FIREMAW: case BOSS_EBONROC: case BOSS_FLAMEGOR: HandleGameObject(ChrommagusDoorGUID, GetBossState(BOSS_FIREMAW) == DONE && GetBossState(BOSS_EBONROC) == DONE && GetBossState(BOSS_FLAMEGOR) == DONE); break; case BOSS_CHROMAGGUS: HandleGameObject(NefarianDoorGUID, state == DONE); break; case BOSS_NEFARIAN: switch (state) { case NOT_STARTED: if (Creature* nefarian = instance->GetCreature(NefarianGUID)) nefarian->DespawnOrUnsummon(); break; case FAIL: _events.ScheduleEvent(EVENT_RESPAWN_NEFARIUS, 15*IN_MILLISECONDS*MINUTE); SetBossState(BOSS_NEFARIAN, NOT_STARTED); break; default: break; } break; } return true; }
bool SetBossState(uint32 type, EncounterState state) override { if (!InstanceScript::SetBossState(type, state)) return false; switch (type) { case DATA_ONYXIA: if (state == IN_PROGRESS) SetBossState(DATA_SHE_DEEP_BREATH_MORE, IN_PROGRESS); break; } return true; }
void InstanceScript::ReadSaveDataBossStates(std::istringstream& data) { uint32 bossId = 0; for (std::vector<BossInfo>::iterator i = bosses.begin(); i != bosses.end(); ++i, ++bossId) { uint32 buff; data >> buff; if (buff == IN_PROGRESS || buff == SPECIAL) buff = NOT_STARTED; if (buff < TO_BE_DECIDED) SetBossState(bossId, EncounterState(buff)); } }
std::string InstanceScript::LoadBossState(const char * data) { if (!data) return NULL; std::istringstream loadStream(data); uint32 buff; uint32 bossId = 0; for (std::vector<BossInfo>::iterator i = bosses.begin(); i != bosses.end(); ++i, ++bossId) { loadStream >> buff; if (buff < TO_BE_DECIDED) SetBossState(bossId, (EncounterState) buff); } return loadStream.str(); }
void Load(char const* strIn) { if (!strIn) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(strIn); char dataHead1, dataHead2; std::istringstream loadStream(strIn); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'U' && dataHead2 == 'U') { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } uint32 tempState; loadStream >> tempState; if (tempState == IN_PROGRESS || tempState > SPECIAL) tempState = NOT_STARTED; SetData(DATA_COLOSSUS, tempState); loadStream >> _algalonTimer; loadStream >> tempState; _algalonSummoned = tempState != 0; if (_algalonSummoned && GetBossState(BOSS_ALGALON) != DONE) { _summonAlgalon = true; if (_algalonTimer && _algalonTimer <= 60) { _events.ScheduleEvent(EVENT_UPDATE_ALGALON_TIMER, 60000); DoUpdateWorldState(WORLD_STATE_ALGALON_TIMER_ENABLED, 1); DoUpdateWorldState(WORLD_STATE_ALGALON_DESPAWN_TIMER, _algalonTimer); } } } OUT_LOAD_INST_DATA_COMPLETE; }
void Load(const char* strIn) { if (!strIn) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(strIn); char dataHead1, dataHead2; uint32 data1,data2,data3; std::istringstream loadStream(strIn); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'U' && dataHead2 == 'U') { for (uint8 i = 0; i <= MAX_ENCOUNTER; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); // needed because of custom GetBossState(uint32 type) ? uiEncounter[i] = tmpState; } uint32 tmpState, tmpState2; loadStream >> tmpState >> tmpState2; ColossusData = tmpState; uiPlayerDeathFlag = tmpState2; loadStream >> data1; loadStream >> data2; loadStream >> data3; SetData(DATA_ALGALON_INTRO, data1); SignalTimerState = data2; SignalTimerMinutes = data3; } OUT_LOAD_INST_DATA_COMPLETE; }
void Load(char const* strIn) { if (!strIn) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(strIn); char dataHead1, dataHead2; uint32 data1,data2,data3; std::istringstream loadStream(strIn); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'U' && dataHead2 == 'U') { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; if (i == DATA_COLOSSUS) SetData(i, tmpState); else SetBossState(i, EncounterState(tmpState)); Encounter[i] = tmpState; } loadStream >> data1; loadStream >> data2; loadStream >> data3; SetData(DATA_ALGALON_INTRO, data1); SignalTimerState = data2; SignalTimerMinutes = data3; uint32 tmpState, tmpState2; loadStream >> tmpState >> tmpState2; ColossusData = tmpState; PlayerDeathFlag = tmpState2; } OUT_LOAD_INST_DATA_COMPLETE; }
void Load(const char* in) { if (!in) return; char dataHead1, dataHead2; std::istringstream loadStream(in); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'G' && dataHead2 == 'D') { for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } } }
void Load(char const* str) { if (!str) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(str); char dataHead1, dataHead2; std::istringstream loadStream(str); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'Z' && dataHead2 == 'A') { for (uint8 i = 0; i < EncounterCount; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); } loadStream >> ZulAmanState; loadStream >> SpeedRunTimer; loadStream >> ZulAmanBossCount; if (ZulAmanState == IN_PROGRESS && SpeedRunTimer && SpeedRunTimer <= 15) { events.ScheduleEvent(EVENT_UPDATE_ZULAMAN_TIMER, 60000); DoUpdateWorldState(WORLD_STATE_ZULAMAN_TIMER_ENABLED, 1); DoUpdateWorldState(WORLD_STATE_ZULAMAN_TIMER, SpeedRunTimer); } } else
void Load(const char* strIn) { if (!strIn) { OUT_LOAD_INST_DATA_FAIL; return; } OUT_LOAD_INST_DATA(strIn); char dataHead1, dataHead2; std::istringstream loadStream(strIn); loadStream >> dataHead1 >> dataHead2; if (dataHead1 == 'U' && dataHead2 == 'U') { for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) { uint32 tmpState; loadStream >> tmpState; if (tmpState == IN_PROGRESS || tmpState > SPECIAL) tmpState = NOT_STARTED; SetBossState(i, EncounterState(tmpState)); // needed because of custom GetBossState(uint32 type) ? uiEncounter[i] = tmpState; } uint32 tmpState, tmpState2, tmpState3; loadStream >> tmpState >> tmpState2 >> tmpState3; ColossusData = tmpState; uiPlayerDeathFlag = tmpState2; uiAlgalonCountdown = tmpState3; } OUT_LOAD_INST_DATA_COMPLETE; }