From 49fb289aefb264ae65ba8bf54e898cdea36c34d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=83=91=E4=BD=A9=E8=8C=B9?= Date: Mon, 13 Feb 2023 14:12:50 -0700 Subject: [PATCH] Fix instance scripts after upstream changes --- src/naxx40Scripts/instance_naxxramas.cpp | 55 +++---------------- .../instance_blackrock_spire.cpp | 46 ++-------------- src/vanillaScripts/instance_molten_core.cpp | 52 ------------------ src/vanillaScripts/instance_onyxias_lair.cpp | 43 --------------- 4 files changed, 13 insertions(+), 183 deletions(-) diff --git a/src/naxx40Scripts/instance_naxxramas.cpp b/src/naxx40Scripts/instance_naxxramas.cpp index 2b75993..ca26ee1 100644 --- a/src/naxx40Scripts/instance_naxxramas.cpp +++ b/src/naxx40Scripts/instance_naxxramas.cpp @@ -1181,55 +1181,14 @@ public: return ObjectGuid::Empty; } - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "N X X " << GetBossSaveData() << ' ' << immortalAchievement; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) override - { - if (!in) + void ReadSaveDataMore(std::istringstream& data) override { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2, dataHead3; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> dataHead3; - - if (dataHead1 == 'N' && dataHead2 == 'X' && dataHead3 == 'X') - { - for (uint8 i = 0; i < MAX_ENCOUNTERS; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS) - { - tmpState = NOT_STARTED; + data >> immortalAchievement; } - if (i == BOSS_HORSEMAN && tmpState == DONE) - { - _horsemanLoadDoneState = true; - } - SetBossState(i, EncounterState(tmpState)); - } - loadStream >> immortalAchievement; - OUT_LOAD_INST_DATA_COMPLETE; - } - else + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_LOAD_INST_DATA_FAIL; - } + data << immortalAchievement; } }; }; @@ -1487,10 +1446,10 @@ public: const Position sapphironEntryTP = { 3498.300049f, -5349.490234f, 144.968002f, 1.3698910f }; -class naxx_hub_portal : public AreaTriggerScript +class at_naxxramas_hub_portal : public AreaTriggerScript { public: - naxx_hub_portal() : AreaTriggerScript("at_naxxramas_hub_portal") { } + at_naxxramas_hub_portal() : AreaTriggerScript("at_naxxramas_hub_portal") { } bool OnTrigger(Player* player, AreaTrigger const* /*areaTrigger*/) override { @@ -1555,7 +1514,7 @@ void AddSC_instance_naxxramas_combined() new NaxxPlayerScript(); new naxx_exit_trigger(); new naxx_northrend_entrance(); - new naxx_hub_portal(); + new at_naxxramas_hub_portal(); new NaxxEntryFlag_AllMapScript(); new gobject_naxx40_tele(); // new boss_naxxramas_misc(); diff --git a/src/vanillaScripts/instance_blackrock_spire.cpp b/src/vanillaScripts/instance_blackrock_spire.cpp index 83d271e..6ac99ff 100644 --- a/src/vanillaScripts/instance_blackrock_spire.cpp +++ b/src/vanillaScripts/instance_blackrock_spire.cpp @@ -753,50 +753,16 @@ public: } } - std::string GetSaveData() override + void ReadSaveDataMore(std::istringstream& data) override { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "B S " << GetBossSaveData() << uint32(UBRSDoorOpen ? 1 : 0); - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); + uint32 temp = 0; + data >> temp; + UBRSDoorOpen = temp; } - void Load(const char* strIn) override - { - if (!strIn) + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(strIn); - - char dataHead1, dataHead2; - - std::istringstream loadStream(strIn); - loadStream >> dataHead1 >> dataHead2; - - if (dataHead1 == 'B' && dataHead2 == 'S') - { - uint32 tmpState; - for (uint8 i = 0; i < EncounterCount; ++i) - { - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - - SetBossState(i, EncounterState(tmpState)); - } - - loadStream >> tmpState; - UBRSDoorOpen = tmpState; - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + data << uint32(UBRSDoorOpen ? 1 : 0); } protected: diff --git a/src/vanillaScripts/instance_molten_core.cpp b/src/vanillaScripts/instance_molten_core.cpp index da37575..70e86f0 100644 --- a/src/vanillaScripts/instance_molten_core.cpp +++ b/src/vanillaScripts/instance_molten_core.cpp @@ -453,58 +453,6 @@ public: return true; } - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "M C " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(char const* data) override - { - if (!data) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(data); - - char dataHead1, dataHead2; - - std::istringstream loadStream(data); - loadStream >> dataHead1 >> dataHead2; - - if (dataHead1 == 'M' && dataHead2 == 'C') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > TO_BE_DECIDED) - { - tmpState = NOT_STARTED; - } - - SetBossState(i, static_cast(tmpState)); - } - - if (CheckMajordomoExecutus()) - { - SummonMajordomoExecutus(); - } - } - else - { - OUT_LOAD_INST_DATA_FAIL; - } - - OUT_LOAD_INST_DATA_COMPLETE; - } private: std::unordered_map _circlesGUIDs; diff --git a/src/vanillaScripts/instance_onyxias_lair.cpp b/src/vanillaScripts/instance_onyxias_lair.cpp index f00ffb8..bf319a4 100644 --- a/src/vanillaScripts/instance_onyxias_lair.cpp +++ b/src/vanillaScripts/instance_onyxias_lair.cpp @@ -106,49 +106,6 @@ public: } } - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - std::ostringstream saveStream; - saveStream << "O L " << GetBossSaveData(); - str_data = saveStream.str(); - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) override - { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0; - - if (dataHead1 == 'O' && dataHead2 == 'L') - { - 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } bool CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/, uint32 /*miscvalue1*/) override {