Fix instance scripts after upstream changes

This commit is contained in:
郑佩茹
2023-02-13 14:12:50 -07:00
parent 88d103b57f
commit 49fb289aef
4 changed files with 13 additions and 183 deletions

View File

@@ -1181,55 +1181,14 @@ public:
return ObjectGuid::Empty;
}
std::string GetSaveData() override
void ReadSaveDataMore(std::istringstream& data) override
{
OUT_SAVE_INST_DATA;
std::ostringstream saveStream;
saveStream << "N X X " << GetBossSaveData() << ' ' << immortalAchievement;
OUT_SAVE_INST_DATA_COMPLETE;
return saveStream.str();
data >> immortalAchievement;
}
void Load(const char* in) override
void WriteSaveDataMore(std::ostringstream& data) override
{
if (!in)
{
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;
}
if (i == BOSS_HORSEMAN && tmpState == DONE)
{
_horsemanLoadDoneState = true;
}
SetBossState(i, EncounterState(tmpState));
}
loadStream >> immortalAchievement;
OUT_LOAD_INST_DATA_COMPLETE;
}
else
{
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();

View File

@@ -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
void WriteSaveDataMore(std::ostringstream& data) 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 == '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:

View File

@@ -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<EncounterState>(tmpState));
}
if (CheckMajordomoExecutus())
{
SummonMajordomoExecutus();
}
}
else
{
OUT_LOAD_INST_DATA_FAIL;
}
OUT_LOAD_INST_DATA_COMPLETE;
}
private:
std::unordered_map<uint32 /*bossid*/, ObjectGuid /*circleGUID*/> _circlesGUIDs;

View File

@@ -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
{