diff --git a/sql/updates/world/0032_dungeon_level_scaling.sql b/sql/updates/world/0032_dungeon_level_scaling.sql index e0daa74f..a0da6b4b 100644 --- a/sql/updates/world/0032_dungeon_level_scaling.sql +++ b/sql/updates/world/0032_dungeon_level_scaling.sql @@ -565,6 +565,7 @@ UPDATE creature_template SET minlevel = 41, maxlevel = 41, ScaleLevelMin = 38, S UPDATE creature_template SET minlevel = 41, maxlevel = 41, ScaleLevelMin = 38, ScaleLevelMax = 60, ScaleLevelDelta = 0 WHERE entry = 59503; UPDATE creature_template SET minlevel = 42, maxlevel = 42, ScaleLevelMin = 38, ScaleLevelMax = 60, ScaleLevelDelta = 1 WHERE entry = 59613; UPDATE creature_template SET minlevel = 41, maxlevel = 41, ScaleLevelMin = 38, ScaleLevelMax = 60, ScaleLevelDelta = 0 WHERE entry = 59614; +UPDATE `creature` SET `spawnMask` = 4 where `id` = 59369; -- Doctor Theolen Krastinov is heroic only -- zul'farrak UPDATE creature_template SET minlevel = 47, maxlevel = 48, ScaleLevelMin = 44, ScaleLevelMax = 60, ScaleLevelDelta = 0 WHERE entry = 5648; diff --git a/sql/updates/world/0033_add_ragefire_chasm_encounters.sql b/sql/updates/world/0033_add_ragefire_chasm_encounters.sql new file mode 100644 index 00000000..f74ae210 --- /dev/null +++ b/sql/updates/world/0033_add_ragefire_chasm_encounters.sql @@ -0,0 +1,21 @@ +DELETE FROM `instance_encounters` WHERE `entry` IN (1443, 1444, 1445, 1446); + +INSERT INTO `instance_encounters` (`entry`, `difficulty`, `creditType`, `creditEntry`, `lastEncounterDungeon`, `comment`) VALUES +(1443, -1, 0, 61408, 0, 'Adarogg'), +(1444, -1, 0, 61412, 0, 'Dark Shaman Koranthal'), +(1445, -1, 0, 61463, 0, 'Slagmaw'), +(1446, -1, 0, 61528, 4, 'Lava Guard Gordoth'); + +DELETE FROM `instance_template` WHERE `map` = 389; + +INSERT INTO `instance_template` (`map`, `parent`, `script`, `allowMount`, `bonusChance`) VALUES +(389, 1, 'instance_ragefire_chasm', 1, 20); + +UPDATE `creature_template` SET `ScriptName` = 'boss_adarogg' WHERE `entry` = 61408; +UPDATE `creature_template` SET `ScriptName` = 'boss_dark_shaman_koranthal' WHERE `entry` = 61412; +UPDATE `creature_template` SET `ScriptName` = 'boss_slagmaw' WHERE `entry` = 61463; +UPDATE `creature_template` SET `ScriptName` = 'boss_lava_guard_gordoth' WHERE `entry` = 61528; + +DELETE FROM `areatrigger_scripts` WHERE `entry`=7899; +INSERT INTO `areatrigger_scripts` (`entry`, `ScriptName`) VALUES + (7899, 'at_lava_guard_gordoth_intro'); diff --git a/src/common/Utilities/Random.cpp b/src/common/Utilities/Random.cpp index 8f20dbd4..de4751ea 100644 --- a/src/common/Utilities/Random.cpp +++ b/src/common/Utilities/Random.cpp @@ -65,6 +65,14 @@ float frand(float min, float max) return float(GetRng()->Random() * (max - min) + min); } +Milliseconds randtime(Milliseconds min, Milliseconds max) +{ + long long diff = max.count() - min.count(); + ASSERT(diff >= 0); + ASSERT(diff <= 0xFFFFFFFF); + return min + Milliseconds(urand(0, uint32(diff))); +} + uint32 rand32() { return GetRng()->BRandom(); diff --git a/src/common/Utilities/Random.h b/src/common/Utilities/Random.h index d0e5be86..92681419 100644 --- a/src/common/Utilities/Random.h +++ b/src/common/Utilities/Random.h @@ -19,6 +19,7 @@ #define Random_h__ #include "Define.h" +#include "Duration.h" #include #include @@ -34,6 +35,9 @@ uint32 urandms(uint32 min, uint32 max); /* Return a random number in the range 0 .. UINT32_MAX. */ uint32 rand32(); +/* Return a random time in the range min..max (up to millisecond precision). Only works for values where millisecond difference is a valid uint32. */ +Milliseconds randtime(Milliseconds min, Milliseconds max); + /* Return a random number in the range min..max */ float frand(float min, float max); diff --git a/src/server/game/AI/CoreAI/UnitAI.h b/src/server/game/AI/CoreAI/UnitAI.h index adaeec3c..4b23a126 100644 --- a/src/server/game/AI/CoreAI/UnitAI.h +++ b/src/server/game/AI/CoreAI/UnitAI.h @@ -222,7 +222,7 @@ class UnitAI // Called at any Damage from any attacker (before damage apply) // Note: it for recalculation damage or special reaction at damage // for attack reaction use AttackedBy called for not DOT damage in Unit::DealDamage also - virtual void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType dmgType) {} + virtual void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType dmgType) { } // Called when the creature receives heal virtual void HealReceived(Unit* /*done_by*/, uint32& /*addhealth*/) {} @@ -235,6 +235,7 @@ class UnitAI void DoAddAuraToAllHostilePlayers(uint32 spellid); void DoCast(uint32 spellId); void DoCast(Unit* victim, uint32 spellId, bool triggered = false); + void DoCastSelf(uint32 spellId, bool triggered = false) { DoCast(me, spellId, triggered); } void DoCastToAllHostilePlayers(uint32 spellid, bool triggered = false); void DoFunctionToHostilePlayers(uint8 playersCount, std::function const& function); void DoCastVictim(uint32 spellId, bool triggered = false); diff --git a/src/server/game/AI/CreatureAI.h b/src/server/game/AI/CreatureAI.h index dd5940d3..9c44f888 100644 --- a/src/server/game/AI/CreatureAI.h +++ b/src/server/game/AI/CreatureAI.h @@ -214,7 +214,7 @@ class CreatureAI : public UnitAI protected: virtual void MoveInLineOfSight(Unit* /*who*/); - bool _EnterEvadeMode(); + virtual bool _EnterEvadeMode(); private: bool m_MoveInLineOfSight_locked; diff --git a/src/server/game/AI/EventMap.cpp b/src/server/game/AI/EventMap.cpp index 3734f0fb..75a1e453 100644 --- a/src/server/game/AI/EventMap.cpp +++ b/src/server/game/AI/EventMap.cpp @@ -72,6 +72,11 @@ void EventMap::RemovePhase(uint8 phase) _phase &= ~(1 << (phase - 1)); } +void EventMap::ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group, uint32 phase) +{ + ScheduleEvent(eventId, time.count(), group, phase); +} + void EventMap::ScheduleEvent(uint32 eventId, Seconds time, uint32 group, uint32 phase) { ScheduleEvent(eventId, time.count(), group, phase); diff --git a/src/server/game/AI/EventMap.h b/src/server/game/AI/EventMap.h index a01f89de..d7acc87a 100644 --- a/src/server/game/AI/EventMap.h +++ b/src/server/game/AI/EventMap.h @@ -117,6 +117,7 @@ class EventMap : std::map void AddPhase(uint8 phase); void RemovePhase(uint8 phase); + void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group = 0, uint32 phase = 0); void ScheduleEvent(uint32 eventId, Seconds time, uint32 group = 0, uint32 phase = 0); void ScheduleEvent(uint32 eventId, Minutes time, uint32 group = 0, uint32 phase = 0); void ScheduleEvent(uint32 eventId, uint32 time, uint32 group = 0, uint32 phase = 0); diff --git a/src/server/game/AI/ScriptedAI/ScriptedCreature.h b/src/server/game/AI/ScriptedAI/ScriptedCreature.h index 75eacde7..6a7b9b5f 100644 --- a/src/server/game/AI/ScriptedAI/ScriptedCreature.h +++ b/src/server/game/AI/ScriptedAI/ScriptedCreature.h @@ -115,7 +115,7 @@ struct ScriptedAI : public CreatureAI void AttackStart(Unit* who); // Called at any Damage from any attacker (before damage apply) - void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType dmgType) {} + void DamageTaken(Unit* /*attacker*/, uint32& /*damage*/, DamageEffectType dmgType) override { } //Called at World update tick virtual void UpdateAI(uint32 diff); @@ -371,6 +371,7 @@ class BossAI : public ScriptedAI void _EnterCombat(); void _JustDied(); void _JustReachedHome(); + bool _EnterEvadeMode() override; void _DespawnAtEvade(uint32 delayToRespawn = 30, Creature* who = nullptr); @@ -389,7 +390,6 @@ class BossAI : public ScriptedAI TaskScheduler scheduler; private: - virtual bool _EnterEvadeMode(); BossBoundaryMap const* const _boundary; uint32 const _bossId; diff --git a/src/server/game/Challenge/Challenge.cpp b/src/server/game/Challenge/Challenge.cpp index 848c41bc..e37e0755 100644 --- a/src/server/game/Challenge/Challenge.cpp +++ b/src/server/game/Challenge/Challenge.cpp @@ -26,7 +26,7 @@ #include "MiscPackets.h" #include "WorldStatePackets.h" -Challenge::Challenge(Map* map, Player* player, uint32 instanceID, Scenario* scenario) : InstanceScript(map), _instanceScript(nullptr), _challengeEntry(nullptr), _isKeyDepleted(false), _scenario(scenario) +Challenge::Challenge(InstanceMap* map, Player* player, uint32 instanceID, Scenario* scenario) : InstanceScript(map), _instanceScript(nullptr), _challengeEntry(nullptr), _isKeyDepleted(false), _scenario(scenario) { if (!player) { diff --git a/src/server/game/Challenge/Challenge.h b/src/server/game/Challenge/Challenge.h index b483c90f..61650029 100644 --- a/src/server/game/Challenge/Challenge.h +++ b/src/server/game/Challenge/Challenge.h @@ -64,7 +64,7 @@ enum MiscChallengeData : uint32 class Challenge : public InstanceScript { public: - Challenge(Map* map, Player* player, uint32 instanceID, Scenario* scenario); + Challenge(InstanceMap* map, Player* player, uint32 instanceID, Scenario* scenario); ~Challenge(); void OnPlayerEnterForScript(Player* player) override; diff --git a/src/server/game/Entities/Creature/Creature.h b/src/server/game/Entities/Creature/Creature.h index 1ea5bc8f..411522fd 100644 --- a/src/server/game/Entities/Creature/Creature.h +++ b/src/server/game/Entities/Creature/Creature.h @@ -362,23 +362,6 @@ struct CreatureAIInstance typedef std::unordered_map CreatureAIInstanceContainer; -// `creature_ai_instance_door` table - -enum DoorType -{ - DOOR_TYPE_ROOM = 0, // Door can open if encounter is not in progress - DOOR_TYPE_PASSAGE = 1, // Door can open if encounter is done - DOOR_TYPE_SPAWN_HOLE = 2, // Door can open if encounter is in progress, typically used for spawning places - MAX_DOOR_TYPES -}; - -struct DoorData -{ - uint32 entry, bossId; - DoorType type; - uint32 boundary; -}; - enum BoundaryType { BOUNDARY_NONE = 0, diff --git a/src/server/game/Entities/Object/Object.cpp b/src/server/game/Entities/Object/Object.cpp index b8bc10a4..adfcd8b4 100644 --- a/src/server/game/Entities/Object/Object.cpp +++ b/src/server/game/Entities/Object/Object.cpp @@ -1891,7 +1891,7 @@ void WorldObject::GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const map->GetZoneAndAreaId(zoneid, areaid, m_positionX, m_positionY, m_positionZ); } -InstanceScript* WorldObject::GetInstanceScript() +InstanceScript* WorldObject::GetInstanceScript() const { Map* map = GetMap(); if (!map) diff --git a/src/server/game/Entities/Object/Object.h b/src/server/game/Entities/Object/Object.h index eea7fcff..2da52ad9 100644 --- a/src/server/game/Entities/Object/Object.h +++ b/src/server/game/Entities/Object/Object.h @@ -520,7 +520,7 @@ class WorldObject : public Object, public WorldLocation uint32 GetAreaId() const; void GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const; - InstanceScript* GetInstanceScript(); + InstanceScript* GetInstanceScript() const; const char* GetName() const { return m_name.c_str(); } void SetName(std::string const& newname) { m_name=newname; } diff --git a/src/server/game/Globals/ObjectMgr.h b/src/server/game/Globals/ObjectMgr.h index 659a7d19..1d15a496 100644 --- a/src/server/game/Globals/ObjectMgr.h +++ b/src/server/game/Globals/ObjectMgr.h @@ -742,8 +742,8 @@ class ObjectMgr void LoadCreatureAIInstance(); void LoadCreatureActionData(); void LoadDisplayChoiceData(); - void LoadPlayerChoicesLocale(); - void LoadLinkedRespawn(); + void LoadPlayerChoicesLocale(); + void LoadLinkedRespawn(); bool SetCreatureLinkedRespawn(ObjectGuid::LowType const& guid, ObjectGuid::LowType const& linkedGuid); void LoadCreatureAddons(); void LoadCreatureModelInfo(); diff --git a/src/server/game/Instances/InstanceScript.cpp b/src/server/game/Instances/InstanceScript.cpp index bd88d0e4..d7250bc1 100644 --- a/src/server/game/Instances/InstanceScript.cpp +++ b/src/server/game/Instances/InstanceScript.cpp @@ -44,11 +44,7 @@ DungeonEncounterEntry const* BossInfo::GetDungeonEncounterForDifficulty(Difficul return itr != DungeonEncounters.end() ? *itr : nullptr; } -DoorInfo::DoorInfo(BossInfo* _bossInfo, DoorType _type, BoundaryType _boundary): bossInfo(_bossInfo), type(_type), boundary(_boundary) -{ -} - -InstanceScript::InstanceScript(Map* map) : initDamageManager(false), _maxInCombatResCount(0), _combatResChargeTime(0), _nextCombatResChargeTime(0) +InstanceScript::InstanceScript(InstanceMap* map) : initDamageManager(false), _maxInCombatResCount(0), _combatResChargeTime(0), _nextCombatResChargeTime(0) { SetType(ZONE_TYPE_INSTANCE); instance = map; @@ -79,16 +75,6 @@ void InstanceScript::CreateInstance() initDamageManager = false; } -void InstanceScript::Load(char const* data) -{ - LoadBossState(data); -} - -std::string InstanceScript::GetSaveData() -{ - return GetBossSaveData(); -} - void InstanceScript::SaveToDB() { std::string data = GetSaveData(); @@ -140,6 +126,13 @@ bool InstanceScript::IsEncounterInProgress() const return false; } +void InstanceScript::SetHeaders(std::string const& dataHeaders) +{ + for (char header : dataHeaders) + if (isalpha(header)) + headers.push_back(header); +} + void InstanceScript::LoadMinionData(const MinionData* data) { while (data->entry) @@ -351,42 +344,102 @@ bool InstanceScript::SetBossState(uint32 id, EncounterState state) return false; } -EncounterState InstanceScript::GetBossState(uint32 id) const +void InstanceScript::Create() { - return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; + for (size_t i = 0; i < bosses.size(); ++i) + SetBossState(i, NOT_STARTED); } -BossBoundaryMap const* InstanceScript::GetBossBoundary(uint32 id) const +void InstanceScript::Load(char const* data) { - return id < bosses.size() ? &bosses[id].boundary : nullptr; + if (!data) + { + OUT_LOAD_INST_DATA_FAIL; + return; + } + + OUT_LOAD_INST_DATA(data); + + std::istringstream loadStream(data); + + if (ReadSaveDataHeaders(loadStream)) + { + ReadSaveDataBossStates(loadStream); + ReadSaveDataMore(loadStream); + } + else + OUT_LOAD_INST_DATA_FAIL; + + OUT_LOAD_INST_DATA_COMPLETE; } -std::string InstanceScript::LoadBossState(const char * data) +bool InstanceScript::ReadSaveDataHeaders(std::istringstream &data) { - if (!data) - return nullptr; + for (char header : headers) + { + char buff; + data >> buff; - std::istringstream loadStream(data); - uint32 buff; + if (header != buff) + return false; + } + + return true; +} + +void InstanceScript::ReadSaveDataBossStates(std::istringstream &data) +{ uint32 bossId = 0; for (auto i = bosses.begin(); i != bosses.end(); ++i, ++bossId) { - loadStream >> buff; + uint32 buff; + data >> buff; + if (buff == IN_PROGRESS || buff == SPECIAL) + buff = NOT_STARTED; + if (buff < TO_BE_DECIDED) - SetBossState(bossId, static_cast(buff)); + SetBossState(bossId, EncounterState(buff)); } - return loadStream.str(); } -std::string InstanceScript::GetBossSaveData() +std::string InstanceScript::GetSaveData() { + OUT_SAVE_INST_DATA; + std::ostringstream saveStream; - for (auto & bosse : bosses) - saveStream << static_cast(bosse.state) << ' '; + + WriteSaveDataHeaders(saveStream); + WriteSaveDataBossStates(saveStream); + WriteSaveDataMore(saveStream); + + OUT_SAVE_INST_DATA_COMPLETE; + return saveStream.str(); } -void InstanceScript::DoUseDoorOrButton(ObjectGuid uiGuid, uint32 uiWithRestoreTime, bool bUseAlternativeState) +void InstanceScript::WriteSaveDataHeaders(std::ostringstream &data) +{ + for (char header : headers) + data << header << ' '; +} + +void InstanceScript::WriteSaveDataBossStates(std::ostringstream &data) +{ + for (BossInfo const& bossInfo : bosses) + data << uint32(bossInfo.state) << ' '; +} + +EncounterState InstanceScript::GetBossState(uint32 id) const +{ + return id < bosses.size() ? bosses[id].state : TO_BE_DECIDED; +} + +BossBoundaryMap const* InstanceScript::GetBossBoundary(uint32 id) const +{ + return id < bosses.size() ? &bosses[id].boundary : nullptr; +} + +void InstanceScript::DoUseDoorOrButton(ObjectGuid uiGuid, uint32 withRestoreTime, bool useAlternativeState) { if (!instance) return; @@ -399,26 +452,37 @@ void InstanceScript::DoUseDoorOrButton(ObjectGuid uiGuid, uint32 uiWithRestoreTi if (go->GetGoType() == GAMEOBJECT_TYPE_DOOR || go->GetGoType() == GAMEOBJECT_TYPE_BUTTON) { if (go->getLootState() == GO_READY) - go->UseDoorOrButton(uiWithRestoreTime, bUseAlternativeState); + go->UseDoorOrButton(withRestoreTime, useAlternativeState); else if (go->getLootState() == GO_ACTIVATED) go->ResetDoorOrButton(); } else - TC_LOG_ERROR("misc", "SD2: Script call DoUseDoorOrButton, but gameobject entry %u is type %u.", go->GetEntry(), go->GetGoType()); + TC_LOG_ERROR("scripts", "InstanceScript: Script DoUseDoorOrButton can't use gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType()); } + else + TC_LOG_DEBUG("scripts", "InstanceScript: HandleGameObject failed"); } -void InstanceScript::DoRespawnGameObject(ObjectGuid uiGuid, uint32 uiTimeToDespawn) +void InstanceScript::DoRespawnGameObject(ObjectGuid guid, uint32 uiTimeToDespawn/*= MINUTE*/) { if (!instance) return; - if (GameObject* go = instance->GetGameObject(uiGuid)) + if (GameObject* go = instance->GetGameObject(guid)) { //not expect any of these should ever be handled - if (go->GetGoType() == GAMEOBJECT_TYPE_FISHINGNODE || go->GetGoType() == GAMEOBJECT_TYPE_DOOR || - go->GetGoType() == GAMEOBJECT_TYPE_BUTTON || go->GetGoType() == GAMEOBJECT_TYPE_TRAP) - return; + switch (go->GetGoType()) + { + case GAMEOBJECT_TYPE_DOOR: + case GAMEOBJECT_TYPE_BUTTON: + case GAMEOBJECT_TYPE_TRAP: + case GAMEOBJECT_TYPE_FISHINGNODE: + // not expect any of these should ever be handled + TC_LOG_ERROR("scripts", "InstanceScript: DoRespawnGameObject can't respawn gameobject entry %u, because type is %u.", go->GetEntry(), go->GetGoType()); + return; + default: + break; + } if (go->isSpawned()) return; @@ -794,6 +858,12 @@ void InstanceScript::SendEncounterUnit(uint32 type, Unit* unit /*= nullptr*/, ui } } +void InstanceScript::SendBossKillCredit(uint32 encounterId) +{ + WorldPackets::Instance::BossKillCredit bossKillCreditMessage(encounterId); + instance->SendToPlayers(bossKillCreditMessage.Write()); +} + bool InstanceScript::IsWipe() const { if (!instance) diff --git a/src/server/game/Instances/InstanceScript.h b/src/server/game/Instances/InstanceScript.h index 1268d6da..521b2ced 100644 --- a/src/server/game/Instances/InstanceScript.h +++ b/src/server/game/Instances/InstanceScript.h @@ -39,7 +39,7 @@ namespace WorldPackets #define OUT_LOAD_INST_DATA_COMPLETE TC_LOG_DEBUG("scripts", "Instance Data Load for Instance %s (Map %d, Instance Id: %d) is complete.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) #define OUT_LOAD_INST_DATA_FAIL TC_LOG_ERROR("scripts", "Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).", instance->GetMapName(), instance->GetId(), instance->GetInstanceId()) -class Map; +class InstanceMap; class Unit; class Player; class GameObject; @@ -74,6 +74,21 @@ enum EncounterState TO_BE_DECIDED = 5, }; +enum DoorType +{ + DOOR_TYPE_ROOM = 0, // Door can open if encounter is not in progress + DOOR_TYPE_PASSAGE = 1, // Door can open if encounter is done + DOOR_TYPE_SPAWN_HOLE = 2, // Door can open if encounter is in progress, typically used for spawning places + MAX_DOOR_TYPES +}; + +struct DoorData +{ + uint32 entry, bossId; + DoorType type; + uint32 boundary; +}; + static constexpr uint32 MAX_DUNGEON_ENCOUNTERS_PER_BOSS = 4; struct DungeonEncounterData @@ -87,6 +102,19 @@ struct MinionData uint32 entry, bossId; }; +struct DamageManager +{ + uint32 entry; + Creature* creature; + ObjectGuid guid; +}; + +struct ObjectData +{ + uint32 entry; + uint32 type; +}; + struct BossInfo { BossInfo() : state(TO_BE_DECIDED) { DungeonEncounters.fill(nullptr); } @@ -102,7 +130,8 @@ struct BossInfo struct DoorInfo { - explicit DoorInfo(BossInfo* _bossInfo, DoorType _type, BoundaryType _boundary); + explicit DoorInfo(BossInfo* _bossInfo, DoorType _type, BoundaryType _boundary) + : bossInfo(_bossInfo), type(_type), boundary(_boundary) { } BossInfo* bossInfo; DoorType type; BoundaryType boundary; @@ -110,23 +139,10 @@ struct DoorInfo struct MinionInfo { - explicit MinionInfo(BossInfo* _bossInfo) : bossInfo(_bossInfo) {} + explicit MinionInfo(BossInfo* _bossInfo) : bossInfo(_bossInfo) { } BossInfo* bossInfo; }; -struct DamageManager -{ - uint32 entry; - Creature* creature; - ObjectGuid guid; -}; - -struct ObjectData -{ - uint32 entry; - uint32 type; -}; - typedef std::multimap DoorInfoMap; typedef std::map MinionInfoMap; typedef std::map ObjectGuidMap; @@ -142,23 +158,28 @@ static uint32 const ChallengeModeDoor = 239323; class InstanceScript : public ZoneScript { public: - explicit InstanceScript(Map* map); + explicit InstanceScript(InstanceMap* map); ~InstanceScript() override; - Map* instance; + InstanceMap* instance; - //On creation, NOT load. - virtual void Initialize() {} + // On creation, NOT load. + // PLEASE INITIALIZE FIELDS IN THE CONSTRUCTOR INSTEAD !!! + // KEEPING THIS METHOD ONLY FOR BACKWARD COMPATIBILITY !!! + virtual void Initialize() { } - //On delete InstanceScript + // On delete InstanceScript static void DestroyInstance(); void CreateInstance(); - //On load + // On instance load, exactly ONE of these methods will ALWAYS be called: + // if we're starting without any saved instance data + virtual void Create(); + // if we're loading existing instance save data virtual void Load(char const* data); - //When save is needed, this function generates the data + // When save is needed, this function generates the data virtual std::string GetSaveData(); void SaveToDB(); @@ -174,11 +195,11 @@ class InstanceScript : public ZoneScript Creature* GetCreatureByEntry(uint32 entry); GameObject* GetGameObjectByEntry(uint32 entry); - //Used by the map's CanEnter function. - //This is to prevent players from entering during boss encounters. + // Used by the map's CanEnter function. + // This is to prevent players from entering during boss encounters. virtual bool IsEncounterInProgress() const; - //Called when a player successfully enters the instance. + // Called when a player successfully enters the instance. virtual void OnPlayerEnter(Player* /*player*/) {} virtual void OnPlayerLeave(Player* /*player*/) {} virtual void OnPlayerDies(Player* /*player*/) {} @@ -211,16 +232,16 @@ class InstanceScript : public ZoneScript void OnUnitCharmed(Unit* unit, Unit* charmer) override; void OnUnitRemoveCharmed(Unit* unit, Unit* charmer) override; - //Handle open / close objects + // Handle open / close objects void HandleGameObject(ObjectGuid guid, bool open, GameObject* go = nullptr); - //change active state of doors or buttons + // change active state of doors or buttons void DoUseDoorOrButton(ObjectGuid guid, uint32 withRestoreTime = 0, bool useAlternativeState = false); - //Respawns a GO having negative spawntimesecs in gameobject-table + // Respawns a GO having negative spawntimesecs in gameobject-table void DoRespawnGameObject(ObjectGuid guid, uint32 timeToDespawn = MINUTE); - //sends world state update to all players in instance + // sends world state update to all players in instance void DoUpdateWorldState(WorldStates variableID, uint32 value); // Send Notify to all players in instance @@ -278,8 +299,15 @@ class InstanceScript : public ZoneScript void SetCompletedEncountersMask(uint32 newMask); uint32 GetCompletedEncounterMask() const; + // Only used by areatriggers that inherit from OnlyOnceAreaTriggerScript + void MarkAreaTriggerDone(uint32 id) { _activatedAreaTriggers.insert(id); } + void ResetAreaTriggerDone(uint32 id) { _activatedAreaTriggers.erase(id); } + bool IsAreaTriggerDone(uint32 id) const { return _activatedAreaTriggers.find(id) != _activatedAreaTriggers.end(); } + void SendEncounterUnit(uint32 type, Unit* unit = nullptr, uint8 param1 = 0, uint8 param2 = 0); + void SendBossKillCredit(uint32 encounterId); + bool IsAllowingRelease; // Check if all players are dead (except gamemasters) @@ -334,6 +362,7 @@ class InstanceScript : public ZoneScript void SetDisabledBosses(uint32 p_DisableMask); BossInfo* GetBossInfo(uint32 id); protected: + void SetHeaders(std::string const& dataHeaders); static void LoadObjectData(ObjectData const* creatureData, ObjectInfoMap& objectInfo); void LoadObjectData(ObjectData const* creatureData, ObjectData const* gameObjectData); template @@ -355,12 +384,18 @@ class InstanceScript : public ZoneScript void UpdateDoorState(GameObject* door); static void UpdateMinionState(Creature* minion, EncounterState state); - std::string LoadBossState(char const* data); - std::string GetBossSaveData(); + // Instance Load and Save + bool ReadSaveDataHeaders(std::istringstream& data); + void ReadSaveDataBossStates(std::istringstream& data); + virtual void ReadSaveDataMore(std::istringstream& /*data*/) { } + void WriteSaveDataHeaders(std::ostringstream& data); + void WriteSaveDataBossStates(std::ostringstream& data); + virtual void WriteSaveDataMore(std::ostringstream& /*data*/) { } private: void LoadDungeonEncounterData(uint32 bossId, std::array const& dungeonEncounterIds); + std::vector headers; Challenge* _challenge; std::vector bosses; DoorInfoMap doors; @@ -377,6 +412,7 @@ class InstanceScript : public ZoneScript ObjectInfoMap _creatureInfo; ObjectInfoMap _gameObjectInfo; ObjectGuidMap _objectGuids; + std::unordered_set _activatedAreaTriggers; WorldObjectMap _creatureData; // Now is only one object peer entry, if need all object in this entry, change guid to vector WorldObjectMap _gameObjectData; // Now is only one object peer entry, if need all object in this entry, change guid to vector LogsSystem::MainData _logData; diff --git a/src/server/game/Maps/Map.cpp b/src/server/game/Maps/Map.cpp index 6b56f2b4..c8c94da8 100644 --- a/src/server/game/Maps/Map.cpp +++ b/src/server/game/Maps/Map.cpp @@ -4335,7 +4335,11 @@ void InstanceMap::CreateInstanceData(InstanceSave* save) #endif i_data->Load(data.c_str()); } + else + i_data->Create(); } + else + i_data->Create(); } /* diff --git a/src/server/game/Maps/ZoneScript.cpp b/src/server/game/Maps/ZoneScript.cpp index 0e6c90de..26ab6466 100644 --- a/src/server/game/Maps/ZoneScript.cpp +++ b/src/server/game/Maps/ZoneScript.cpp @@ -1,22 +1,7 @@ #include "ZoneScript.h" #include "Creature.h" -#include "WorldStatePackets.h" - -ZoneScript::ZoneScript(): m_type(ZONE_TYPE_MAP) { } - -void ZoneScript::SetType(uint8 type) -{ - m_type = type; -} uint32 ZoneScript::GetCreatureEntry(uint32, CreatureData const* data) { return data->id; } - -InstanceScript* ZoneScript::ToInstanceScript() -{ - if (m_type == ZONE_TYPE_INSTANCE) - return reinterpret_cast(this); - return nullptr; -} diff --git a/src/server/game/Maps/ZoneScript.h b/src/server/game/Maps/ZoneScript.h index cce5f65f..5ca6b260 100644 --- a/src/server/game/Maps/ZoneScript.h +++ b/src/server/game/Maps/ZoneScript.h @@ -40,10 +40,10 @@ class ZoneScript { uint8 m_type; public: - ZoneScript(); + ZoneScript() : m_type(ZONE_TYPE_MAP) { } virtual ~ZoneScript() = default; - void SetType(uint8 type); + void SetType(uint8 type) { m_type = type; } virtual uint32 GetCreatureEntry(uint32 /*guidlow*/, CreatureData const* data); virtual uint32 GetGameObjectEntry(uint32 /*guidlow*/, uint32 entry) { return entry; } @@ -77,8 +77,6 @@ class ZoneScript virtual void SetData(uint32 /*DataId*/, uint32 /*Value*/) {} virtual void ProcessEvent(WorldObject* /*obj*/, uint32 /*eventId*/) {} - - InstanceScript* ToInstanceScript(); }; #endif diff --git a/src/server/game/Scenarios/Scenario.cpp b/src/server/game/Scenarios/Scenario.cpp index 1712c59c..86bbf4b4 100644 --- a/src/server/game/Scenarios/Scenario.cpp +++ b/src/server/game/Scenarios/Scenario.cpp @@ -146,27 +146,24 @@ void Scenario::CreateChallenge(Player* player) if (!player || !map) return; + InstanceMap* instanceMap = map->ToInstanceMap(); + ASSERT(instanceMap); + MapChallengeModeEntry const* m_challengeEntry = player->GetGroup() ? player->GetGroup()->m_challengeEntry : player->m_challengeKeyInfo.challengeEntry; if (!m_challengeEntry) return; - _challenge = new Challenge(map, player, GetInstanceId(), this); + _challenge = new Challenge(instanceMap, player, GetInstanceId(), this); // TC_LOG_DEBUG("challenge", "CreateChallenge _challenge %u _canRun %u", bool(_challenge), bool(_challenge->_canRun)); if (!_challenge || !_challenge->_canRun) return; - if (Map* map_ = GetMap()) + if (InstanceScript* script = instanceMap->GetInstanceScript()) { - if (InstanceMap* instanceMap = map_->ToInstanceMap()) - { - if (InstanceScript* script = instanceMap->GetInstanceScript()) - { - script->SetChallenge(_challenge); - _challenge->SetInstanceScript(script); - } - } + script->SetChallenge(_challenge); + _challenge->SetInstanceScript(script); } if (ScenarioData const* scenarioData = sObjectMgr->GetScenarioOnMap(map->GetId(), DIFFICULTY_MYTHIC_KEYSTONE)) diff --git a/src/server/game/Scripting/ScriptMgr.cpp b/src/server/game/Scripting/ScriptMgr.cpp index 1f07cb73..5f0d930d 100644 --- a/src/server/game/Scripting/ScriptMgr.cpp +++ b/src/server/game/Scripting/ScriptMgr.cpp @@ -29,6 +29,7 @@ #include "EventObject.h" #include "GameObject.h" #include "GossipDef.h" +#include "InstanceScript.h" #include "Item.h" #include "LFGScripts.h" #include "Log.h" @@ -1550,11 +1551,30 @@ WorldStateScript::WorldStateScript(std::string name) : ScriptObject(name) ScriptRegistry::AddScript(this); } +AreaTriggerScript::~AreaTriggerScript() = default; + AreaTriggerScript::AreaTriggerScript(std::string name) : ScriptObject(name) { ScriptRegistry::AddScript(this); } +OnlyOnceAreaTriggerScript::~OnlyOnceAreaTriggerScript() = default; + +bool OnlyOnceAreaTriggerScript::OnTrigger(Player* player, AreaTriggerEntry const* trigger, bool /*enter*/) +{ + uint32 const triggerId = trigger->ID; + InstanceScript* instance = player->GetInstanceScript(); + if (instance && instance->IsAreaTriggerDone(triggerId)) + return true; + + if (TryHandleOnce(player, trigger) && instance) + instance->MarkAreaTriggerDone(triggerId); + + return true; +} +void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(InstanceScript* instance, uint32 triggerId) { instance->ResetAreaTriggerDone(triggerId); } +void OnlyOnceAreaTriggerScript::ResetAreaTriggerDone(Player const* player, AreaTriggerEntry const* trigger) { if (InstanceScript* instance = player->GetInstanceScript()) ResetAreaTriggerDone(instance, trigger->ID); } + SceneTriggerScript::SceneTriggerScript(std::string name) : ScriptObject(name) { ScriptRegistry::AddScript(this); diff --git a/src/server/game/Scripting/ScriptMgr.h b/src/server/game/Scripting/ScriptMgr.h index 20aeafda..b119a484 100644 --- a/src/server/game/Scripting/ScriptMgr.h +++ b/src/server/game/Scripting/ScriptMgr.h @@ -396,10 +396,12 @@ class AreaTriggerScript : public ScriptObject { protected: - AreaTriggerScript(std::string name); + explicit AreaTriggerScript(std::string name); public: + ~AreaTriggerScript(); + bool IsDatabaseBound() const override { return true; } // Called when the area trigger is activated by a player. @@ -409,6 +411,23 @@ class AreaTriggerScript : public ScriptObject virtual AreaTriggerAI* GetAI(AreaTrigger* /*at*/) const { return nullptr; } }; +class OnlyOnceAreaTriggerScript : public AreaTriggerScript +{ + using AreaTriggerScript::AreaTriggerScript; + + public: + + ~OnlyOnceAreaTriggerScript(); + + bool OnTrigger(Player* player, AreaTriggerEntry const* trigger, bool enter) final; + + protected: + // returns true if the trigger was successfully handled, false if we should try again next time + virtual bool TryHandleOnce(Player* player, AreaTriggerEntry const* trigger) = 0; + void ResetAreaTriggerDone(InstanceScript* instance, uint32 triggerId); + void ResetAreaTriggerDone(Player const* player, AreaTriggerEntry const* trigger); +}; + class SceneTriggerScript : public ScriptObject { protected: diff --git a/src/server/game/Spells/SpellScript.cpp b/src/server/game/Spells/SpellScript.cpp index 6d4eb76f..6d34c949 100644 --- a/src/server/game/Spells/SpellScript.cpp +++ b/src/server/game/Spells/SpellScript.cpp @@ -488,7 +488,7 @@ bool SpellScript::IsInEffectHook() const return (m_currentScriptState >= SPELL_SCRIPT_HOOK_EFFECT_LAUNCH && m_currentScriptState <= SPELL_SCRIPT_HOOK_EFFECT_HIT_TARGET) || m_currentScriptState == SPELL_SCRIPT_HOOK_EFFECT_SUCCESSFUL_DISPEL; } -Unit* SpellScript::GetCaster() +Unit* SpellScript::GetCaster() const { return m_spell->GetCaster(); } @@ -540,7 +540,7 @@ Item* SpellScript::GetExplTargetItem() return m_spell->m_targets.GetItemTarget(); } -Unit* SpellScript::GetHitUnit() +Unit* SpellScript::GetHitUnit() const { if (!IsInTargetHook()) { @@ -745,7 +745,7 @@ void SpellScript::PreventHitDefaultEffect(SpellEffIndex effIndex) m_hitPreventDefaultEffectMask |= 1 << effIndex; } -int32 SpellScript::GetEffectValue() +int32 SpellScript::GetEffectValue() const { if (!IsInEffectHook()) { diff --git a/src/server/game/Spells/SpellScript.h b/src/server/game/Spells/SpellScript.h index b6c01660..0364af1d 100644 --- a/src/server/game/Spells/SpellScript.h +++ b/src/server/game/Spells/SpellScript.h @@ -375,7 +375,7 @@ class SpellScript : public _SpellScript // methods allowing interaction with Spell object // // methods useable during all spell handling phases - Unit* GetCaster(); + Unit* GetCaster() const; Unit* GetOriginalCaster(); SpellInfo const* GetSpellInfo(); SpellValue const* GetSpellValue(); @@ -411,7 +411,7 @@ class SpellScript : public _SpellScript // methods useable only during spell hit on target, or during spell launch on target: // returns: target of current effect if it was Unit otherwise NULL - Unit* GetHitUnit(); + Unit* GetHitUnit() const; Unit* GetOriginalTarget(); // returns: target of current effect if it was Creature otherwise NULL Creature* GetHitCreature(); @@ -456,7 +456,7 @@ class SpellScript : public _SpellScript void PreventHitDefaultEffect(SpellEffIndex effIndex); // method avalible only in EffectHandler method - int32 GetEffectValue(); + int32 GetEffectValue() const; void SetEffectValue(int32 val); // returns: cast item if present. diff --git a/src/server/scripts/Draenor/Auchindoun/auchindoun.hpp b/src/server/scripts/Draenor/Auchindoun/auchindoun.hpp index a69b3671..1c5f73e5 100644 --- a/src/server/scripts/Draenor/Auchindoun/auchindoun.hpp +++ b/src/server/scripts/Draenor/Auchindoun/auchindoun.hpp @@ -10,6 +10,8 @@ #include "Common.h" +#define DataHeader "AD" + static void DespawnCreaturesInArea(uint32 entry, WorldObject* object) { std::list creatures; diff --git a/src/server/scripts/Draenor/Auchindoun/instance_auchindoun.cpp b/src/server/scripts/Draenor/Auchindoun/instance_auchindoun.cpp index ed530a42..a606b753 100644 --- a/src/server/scripts/Draenor/Auchindoun/instance_auchindoun.cpp +++ b/src/server/scripts/Draenor/Auchindoun/instance_auchindoun.cpp @@ -18,8 +18,9 @@ class instance_auchindoun : public InstanceMapScript struct instance_auchindoun_InstanceMapScript : InstanceScript { - instance_auchindoun_InstanceMapScript(Map* map) : InstanceScript(map) + instance_auchindoun_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); m_KaatharDied = false; m_TuulaniSummoned = true; } diff --git a/src/server/scripts/Draenor/BlackrockFoundry/blackrock_foundry.h b/src/server/scripts/Draenor/BlackrockFoundry/blackrock_foundry.h index 8f219117..34573f64 100644 --- a/src/server/scripts/Draenor/BlackrockFoundry/blackrock_foundry.h +++ b/src/server/scripts/Draenor/BlackrockFoundry/blackrock_foundry.h @@ -1,6 +1,8 @@ #ifndef DEF_BLACKROCK_FOUNDRY_H #define DEF_BLACKROCK_FOUNDRY_H +#define DataHeader "BRF" + enum DataTypes { DataGruul = 0, diff --git a/src/server/scripts/Draenor/BlackrockFoundry/instance_blackrock_foundry.cpp b/src/server/scripts/Draenor/BlackrockFoundry/instance_blackrock_foundry.cpp index 0872c686..1a8bf5e9 100644 --- a/src/server/scripts/Draenor/BlackrockFoundry/instance_blackrock_foundry.cpp +++ b/src/server/scripts/Draenor/BlackrockFoundry/instance_blackrock_foundry.cpp @@ -7,12 +7,13 @@ class instance_blackrock_foundry : public InstanceMapScript struct instance_blackrock_foundry_InstanceMapScript : public InstanceScript { - instance_blackrock_foundry_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_blackrock_foundry_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(MaxBossData); } diff --git a/src/server/scripts/Draenor/BloodmaulSlagMines/bloodmaul_slag_mines.h b/src/server/scripts/Draenor/BloodmaulSlagMines/bloodmaul_slag_mines.h index 7a90b01e..730d7f6f 100644 --- a/src/server/scripts/Draenor/BloodmaulSlagMines/bloodmaul_slag_mines.h +++ b/src/server/scripts/Draenor/BloodmaulSlagMines/bloodmaul_slag_mines.h @@ -27,6 +27,8 @@ #ifndef DEF_BLOODMAUL_SLAG_MINES_H #define DEF_BLOODMAUL_SLAG_MINES_H +#define DataHeader "BSM" + enum DataTypes { DATA_SLAVE_WATCHER_CRUSHTO = 1, diff --git a/src/server/scripts/Draenor/BloodmaulSlagMines/bloodmaul_slag_mines_instance.cpp b/src/server/scripts/Draenor/BloodmaulSlagMines/bloodmaul_slag_mines_instance.cpp index 00d69fd2..7e5a24f7 100644 --- a/src/server/scripts/Draenor/BloodmaulSlagMines/bloodmaul_slag_mines_instance.cpp +++ b/src/server/scripts/Draenor/BloodmaulSlagMines/bloodmaul_slag_mines_instance.cpp @@ -27,10 +27,11 @@ class instance_bloodmaul_slag_mines : public InstanceMapScript struct instance_bloodmaul_slag_mines_InstanceScript : public InstanceScript { - instance_bloodmaul_slag_mines_InstanceScript(Map* map) : InstanceScript(map) { } + instance_bloodmaul_slag_mines_InstanceScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); crushtoEvent = 0; gogduhEvent = 0; diff --git a/src/server/scripts/Draenor/HellfireCitadel/hellfire_citadel.h b/src/server/scripts/Draenor/HellfireCitadel/hellfire_citadel.h index d7cc8d0b..67708ab8 100644 --- a/src/server/scripts/Draenor/HellfireCitadel/hellfire_citadel.h +++ b/src/server/scripts/Draenor/HellfireCitadel/hellfire_citadel.h @@ -1,6 +1,8 @@ #ifndef DEF_HELLFIRE_CITADEL_H #define DEF_HELLFIRE_CITADEL_H +#define DataHeader "HFC" + enum DataTypes { DATA_HELLFIRE_ASSAULT = 0, diff --git a/src/server/scripts/Draenor/HellfireCitadel/instance_hellfire_citadel.cpp b/src/server/scripts/Draenor/HellfireCitadel/instance_hellfire_citadel.cpp index 28f7ba38..7c9883ef 100644 --- a/src/server/scripts/Draenor/HellfireCitadel/instance_hellfire_citadel.cpp +++ b/src/server/scripts/Draenor/HellfireCitadel/instance_hellfire_citadel.cpp @@ -7,12 +7,13 @@ class instance_hellfire_citadel : public InstanceMapScript struct instance_hellfire_citadel_InstanceMapScript : public InstanceScript { - instance_hellfire_citadel_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_hellfire_citadel_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Draenor/Highmaul/highmaul.hpp b/src/server/scripts/Draenor/Highmaul/highmaul.hpp index 623f4ce3..329fde0a 100644 --- a/src/server/scripts/Draenor/Highmaul/highmaul.hpp +++ b/src/server/scripts/Draenor/Highmaul/highmaul.hpp @@ -24,6 +24,8 @@ #ifndef HIGHMAUL_HPP #define HIGHMAUL_HPP +#define DataHeader "HM" + Position const g_PlayScenePos = { 3448.069f, 7573.542f, 55.30419f, 0.3921495f }; static void CastSpellToPlayers(Map* map, Unit* caster, uint32 spellID, bool triggered) diff --git a/src/server/scripts/Draenor/Highmaul/instance_highmaul.cpp b/src/server/scripts/Draenor/Highmaul/instance_highmaul.cpp index e35f2bda..e83ad2f3 100644 --- a/src/server/scripts/Draenor/Highmaul/instance_highmaul.cpp +++ b/src/server/scripts/Draenor/Highmaul/instance_highmaul.cpp @@ -62,8 +62,10 @@ class instance_highmaul : public InstanceMapScript struct instance_highmaul_InstanceMapScript : public InstanceScript { - instance_highmaul_InstanceMapScript(Map* map) : InstanceScript(map) + instance_highmaul_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); + m_ArenaElevatorActivated = false; m_BrackensporeAchievement = false; m_DrunkenBileslingerCount = 0; diff --git a/src/server/scripts/Draenor/IronDocks/instance_iron_docks.cpp b/src/server/scripts/Draenor/IronDocks/instance_iron_docks.cpp index 55d064fc..d5ecdc00 100644 --- a/src/server/scripts/Draenor/IronDocks/instance_iron_docks.cpp +++ b/src/server/scripts/Draenor/IronDocks/instance_iron_docks.cpp @@ -16,7 +16,7 @@ class instance_iron_docks : public InstanceMapScript struct instance_iron_docks_InstanceMapScript : public InstanceScript { - instance_iron_docks_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_iron_docks_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} std::list oshirGUIDconteiner; std::map skullocGUIDconteiner; @@ -29,6 +29,7 @@ class instance_iron_docks : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); enforCount = 0; @@ -254,57 +255,22 @@ class instance_iron_docks : public InstanceMapScript return 0; } - std::string GetDialogSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; for (uint8 i = 0; i < 7; i++) - saveStream << (uint32)m_uiDialogs[i] << " "; - return saveStream.str(); + data << (uint32)m_uiDialogs[i] << " "; } - std::string GetSaveData() + void ReadSaveDataMore(std::istringstream& data) override { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "I D " << GetDialogSaveData(); - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) override - { - if (!in) + for (uint8 i = 0; i < 5; i++) { - OUT_LOAD_INST_DATA_FAIL; - return; + uint32 tmpDlg; + data >> tmpDlg; + if (tmpDlg != DONE) + tmpDlg = NOT_STARTED; + m_uiDialogs[i] = tmpDlg; } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - - if (dataHead1 == 'I' && dataHead2 == 'D') - { - for (uint8 i = 0; i < 5; i++) - { - uint32 tmpDlg; - loadStream >> tmpDlg; - if (tmpDlg != DONE) - tmpDlg = NOT_STARTED; - m_uiDialogs[i] = tmpDlg; - } - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; } }; }; diff --git a/src/server/scripts/Draenor/IronDocks/iron_docks.h b/src/server/scripts/Draenor/IronDocks/iron_docks.h index 8ba23009..21104f53 100644 --- a/src/server/scripts/Draenor/IronDocks/iron_docks.h +++ b/src/server/scripts/Draenor/IronDocks/iron_docks.h @@ -5,6 +5,8 @@ #ifndef IRON_DOCKS_H_ #define IRON_DOCKS_H_ +#define DataHeader "ID" + enum eData { DATA_NOKGAR = 0, diff --git a/src/server/scripts/Draenor/ShadowmoonBurialGrounds/instance_shadowmoon_burial_grounds.cpp b/src/server/scripts/Draenor/ShadowmoonBurialGrounds/instance_shadowmoon_burial_grounds.cpp index 6da0ec07..3026f168 100644 --- a/src/server/scripts/Draenor/ShadowmoonBurialGrounds/instance_shadowmoon_burial_grounds.cpp +++ b/src/server/scripts/Draenor/ShadowmoonBurialGrounds/instance_shadowmoon_burial_grounds.cpp @@ -25,8 +25,9 @@ class instance_shadowmoon_burial_grounds : public InstanceMapScript struct instance_shadowmoon_burial_grounds_InstanceMapScript : public InstanceScript { - instance_shadowmoon_burial_grounds_InstanceMapScript(Map* map) : InstanceScript(map) + instance_shadowmoon_burial_grounds_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Draenor/ShadowmoonBurialGrounds/shadowmoon_burial_grounds.h b/src/server/scripts/Draenor/ShadowmoonBurialGrounds/shadowmoon_burial_grounds.h index 52f6a987..fe2af346 100644 --- a/src/server/scripts/Draenor/ShadowmoonBurialGrounds/shadowmoon_burial_grounds.h +++ b/src/server/scripts/Draenor/ShadowmoonBurialGrounds/shadowmoon_burial_grounds.h @@ -5,6 +5,8 @@ #ifndef SHADOWMOON_BURIAL_GROUNDS_H_ #define SHADOWMOON_BURIAL_GROUNDS_H_ +#define DataHeader "SBG" + enum eData { DATA_SADANA = 0, diff --git a/src/server/scripts/Draenor/Skyreach/instance_skyreach.cpp b/src/server/scripts/Draenor/Skyreach/instance_skyreach.cpp index 4514fd7f..b646d30f 100644 --- a/src/server/scripts/Draenor/Skyreach/instance_skyreach.cpp +++ b/src/server/scripts/Draenor/Skyreach/instance_skyreach.cpp @@ -31,8 +31,9 @@ class instance_skyreach : public InstanceMapScript struct instance_skyreach_InstanceMapScript : public InstanceScript { - instance_skyreach_InstanceMapScript(Map* map) : InstanceScript(map) + instance_skyreach_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Draenor/Skyreach/skyreach.h b/src/server/scripts/Draenor/Skyreach/skyreach.h index a61063a8..f1356275 100644 --- a/src/server/scripts/Draenor/Skyreach/skyreach.h +++ b/src/server/scripts/Draenor/Skyreach/skyreach.h @@ -5,6 +5,8 @@ #ifndef UPPER_SKYREACH_H_ #define UPPER_SKYREACH_H_ +#define DataHeader "SR" + enum eData { DATA_RANJIT = 0, diff --git a/src/server/scripts/Draenor/TheEverbloom/instance_the_everbloom.cpp b/src/server/scripts/Draenor/TheEverbloom/instance_the_everbloom.cpp index 58d2a311..5df0c1ba 100644 --- a/src/server/scripts/Draenor/TheEverbloom/instance_the_everbloom.cpp +++ b/src/server/scripts/Draenor/TheEverbloom/instance_the_everbloom.cpp @@ -23,8 +23,9 @@ class instance_the_everbloom : public InstanceMapScript struct instance_the_everbloom_InstanceMapScript : public InstanceScript { - instance_the_everbloom_InstanceMapScript(Map* map) : InstanceScript(map) + instance_the_everbloom_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Draenor/TheEverbloom/the_everbloom.h b/src/server/scripts/Draenor/TheEverbloom/the_everbloom.h index 0c108647..e33ddd39 100644 --- a/src/server/scripts/Draenor/TheEverbloom/the_everbloom.h +++ b/src/server/scripts/Draenor/TheEverbloom/the_everbloom.h @@ -5,6 +5,8 @@ #ifndef THE_EVERBLOOM_H_ #define THE_EVERBLOOM_H_ +#define DataHeader "EB" + enum eData { DATA_WITHERBARK = 0, diff --git a/src/server/scripts/Draenor/UpperBlackrockSpire/instance_upper_blackrock_spire.cpp b/src/server/scripts/Draenor/UpperBlackrockSpire/instance_upper_blackrock_spire.cpp index 6a9855dd..cebd498d 100644 --- a/src/server/scripts/Draenor/UpperBlackrockSpire/instance_upper_blackrock_spire.cpp +++ b/src/server/scripts/Draenor/UpperBlackrockSpire/instance_upper_blackrock_spire.cpp @@ -32,8 +32,9 @@ class instance_upper_blackrock_spire : public InstanceMapScript struct instance_upper_blackrock_spire_InstanceMapScript : public InstanceScript { - instance_upper_blackrock_spire_InstanceMapScript(Map* map) : InstanceScript(map) + instance_upper_blackrock_spire_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Draenor/UpperBlackrockSpire/upper_blackrock_spire.h b/src/server/scripts/Draenor/UpperBlackrockSpire/upper_blackrock_spire.h index 4189bd3c..d025b816 100644 --- a/src/server/scripts/Draenor/UpperBlackrockSpire/upper_blackrock_spire.h +++ b/src/server/scripts/Draenor/UpperBlackrockSpire/upper_blackrock_spire.h @@ -5,6 +5,8 @@ #ifndef UPPER_BLACKROCK_SPIRE_H_ #define UPPER_BLACKROCK_SPIRE_H_ +#define DataHeader "UBRS" + enum eData { DATA_GORASHAN = 0, diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/baradin_hold.h b/src/server/scripts/EasternKingdoms/BaradinHold/baradin_hold.h index 35ead644..1ade2d58 100644 --- a/src/server/scripts/EasternKingdoms/BaradinHold/baradin_hold.h +++ b/src/server/scripts/EasternKingdoms/BaradinHold/baradin_hold.h @@ -1,6 +1,8 @@ #ifndef DEF_BARADINHOLD_H #define DEF_BARADINHOLD_H +#define DataHeader "BH" + #define MAX_ENCOUNTER 3 enum Creatures diff --git a/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp b/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp index fd063400..c821768b 100644 --- a/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp +++ b/src/server/scripts/EasternKingdoms/BaradinHold/instance_baradin_hold.cpp @@ -20,8 +20,9 @@ class instance_baradin_hold : public InstanceMapScript struct instance_baradin_hold_InstanceMapScript : public InstanceScript { - instance_baradin_hold_InstanceMapScript(Map* map) : InstanceScript(map) + instance_baradin_hold_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doorData); } @@ -45,49 +46,6 @@ class instance_baradin_hold : public InstanceMapScript break; } } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "B H " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - 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 == 'B' && dataHead2 == 'H') - { - 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } - }; }; diff --git a/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h b/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h index 1c52abb9..d5371633 100644 --- a/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h +++ b/src/server/scripts/EasternKingdoms/BastionOfTwilight/bastion_of_twilight.h @@ -1,6 +1,7 @@ #ifndef DEF_BASTION_OF_TWILIGHT_H #define DEF_BASTION_OF_TWILIGHT_H +#define DataHeader "BT" #define BTScriptName "instance_bastion_of_twilight" enum Data diff --git a/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp b/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp index d23a3011..c41a3db9 100644 --- a/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp +++ b/src/server/scripts/EasternKingdoms/BastionOfTwilight/instance_bastion_of_twilight.cpp @@ -26,8 +26,9 @@ class instance_bastion_of_twilight : public InstanceMapScript struct instance_bastion_of_twilight_InstanceMapScript: public InstanceScript { - instance_bastion_of_twilight_InstanceMapScript(Map* map) : InstanceScript(map) + instance_bastion_of_twilight_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doordata); uiWyrmbreakerGUID.Clear(); @@ -292,65 +293,22 @@ class instance_bastion_of_twilight : public InstanceMapScript return true; } - std::string GetDialogSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; - for (uint8 i = 0; i < 8; i++) - saveStream << (uint32)m_uiDialogs[i] << " "; - return saveStream.str(); - } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "B T " << GetBossSaveData() << GetDialogSaveData(); - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + for (unsigned int m_uiDialog : m_uiDialogs) + data << (uint32)m_uiDialog << " "; } - void Load(const char* in) + void ReadSaveDataMore(std::istringstream& data) override { - if (!in) + for (uint8 i = 0; i < 8; i++) { - OUT_LOAD_INST_DATA_FAIL; - return; + uint32 tmpDlg; + data >> tmpDlg; + if (tmpDlg != DONE) + tmpDlg = NOT_STARTED; + m_uiDialogs[i] = tmpDlg; } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - - if (dataHead1 == 'B' && dataHead2 == 'T') - { - 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)); - } - for (uint8 i = 0; i < 8; i++) - { - uint32 tmpDlg; - loadStream >> tmpDlg; - if (tmpDlg != DONE) - tmpDlg = NOT_STARTED; - m_uiDialogs[i] = tmpDlg; - } - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; } private: diff --git a/src/server/scripts/EasternKingdoms/BlackrockCaverns/blackrock_caverns.h b/src/server/scripts/EasternKingdoms/BlackrockCaverns/blackrock_caverns.h index c1b40e06..d394085f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockCaverns/blackrock_caverns.h +++ b/src/server/scripts/EasternKingdoms/BlackrockCaverns/blackrock_caverns.h @@ -1,6 +1,8 @@ #ifndef DEF_BLACKROCK_CAVERNS_H #define DEF_BLACKROCK_CAVERNS_H +#define DataHeader "BC" + enum Data { DATA_ROMOGG = 1, diff --git a/src/server/scripts/EasternKingdoms/BlackrockCaverns/instance_blackrock_caverns.cpp b/src/server/scripts/EasternKingdoms/BlackrockCaverns/instance_blackrock_caverns.cpp index b6e533ea..6d1561dc 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockCaverns/instance_blackrock_caverns.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockCaverns/instance_blackrock_caverns.cpp @@ -27,13 +27,14 @@ class instance_blackrock_caverns : public InstanceMapScript void Initialize() { - uiRomoggGUID.Clear(); - uiCorlaGUID.Clear(); - uiKarshGUID.Clear(); - uiBeautyGUID.Clear(); - uiLordObsidiusGUID.Clear(); - for (int32 i = 0; i < 4; ++i) - m_uiPortalGUID[i].Clear(); + SetHeaders(DataHeader); + uiRomoggGUID.Clear(); + uiCorlaGUID.Clear(); + uiKarshGUID.Clear(); + uiBeautyGUID.Clear(); + uiLordObsidiusGUID.Clear(); + for (int32 i = 0; i < 4; ++i) + m_uiPortalGUID[i].Clear(); } void OnCreatureCreate(Creature* pCreature) diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.h b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.h index a1e97516..7c2ba54e 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.h +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/blackrock_depths.h @@ -19,6 +19,8 @@ #ifndef DEF_BRD_H #define DEF_BRD_H +#define DataHeader "BRD" + #define FACTION_NEUTRAL 734 #define FACTION_HOSTILE 754 #define FACTION_FRIEND 35 diff --git a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp index cf183d23..60981e28 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockDepths/instance_blackrock_depths.cpp @@ -71,7 +71,7 @@ class instance_blackrock_depths : public InstanceMapScript struct instance_blackrock_depths_InstanceMapScript : public InstanceScript { - instance_blackrock_depths_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_blackrock_depths_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } uint32 encounter[MAX_ENCOUNTER]; std::string str_data; @@ -112,6 +112,7 @@ class instance_blackrock_depths : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&encounter, 0, sizeof(encounter)); EmperorGUID.Clear(); diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h index ee084290..35d53d90 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/blackrock_spire.h @@ -18,6 +18,8 @@ #ifndef DEF_BLACKROCK_SPIRE_H #define DEF_BLACKROCK_SPIRE_H +#define DataHeader "BS" + enum Data { DATA_OMOKK, diff --git a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp index 61a5e0f5..2e99286f 100644 --- a/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp +++ b/src/server/scripts/EasternKingdoms/BlackrockSpire/instance_blackrock_spire.cpp @@ -34,7 +34,6 @@ class instance_blackrock_spire : public InstanceMapScript instance_blackrock_spireMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 encounter[MAX_ENCOUNTER]; - std::string m_strInstData; ObjectGuid HighlordOmokk; ObjectGuid ShadowHunterVoshgajin; ObjectGuid WarMasterVoone; @@ -53,11 +52,12 @@ class instance_blackrock_spire : public InstanceMapScript ObjectGuid go_doors; ObjectGuid go_emberseerout; ObjectGuid go_roomrunes[MAX_DRAGONSPIRE_HALL_RUNES]; - uint8 Runemaxprotectors[MAX_DRAGONSPIRE_HALL_RUNES]; - uint8 Runeprotectorsdead[MAX_DRAGONSPIRE_HALL_RUNES]; + //uint8 Runemaxprotectors[MAX_DRAGONSPIRE_HALL_RUNES]; + //uint8 Runeprotectorsdead[MAX_DRAGONSPIRE_HALL_RUNES]; void Initialize() { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); HighlordOmokk.Clear(); ShadowHunterVoshgajin.Clear(); @@ -278,48 +278,7 @@ class instance_blackrock_spire : public InstanceMapScript return ObjectGuid::Empty; } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "B S " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - 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 == 'B' && dataHead2 == 'S') - { - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - } - } - - OUT_LOAD_INST_DATA_COMPLETE; - } }; - }; void AddSC_instance_blackrock_spire() diff --git a/src/server/scripts/EasternKingdoms/BlackwingDescent/blackwing_descent.h b/src/server/scripts/EasternKingdoms/BlackwingDescent/blackwing_descent.h index 3b3040e0..3eb96706 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingDescent/blackwing_descent.h +++ b/src/server/scripts/EasternKingdoms/BlackwingDescent/blackwing_descent.h @@ -1,6 +1,7 @@ #ifndef DEF_BLACKWING_DESCENT_H #define DEF_BLACKWING_DESCENT_H +#define DataHeader "BD" #define BDScriptName "instance_blackwing_descent" enum Data diff --git a/src/server/scripts/EasternKingdoms/BlackwingDescent/instance_blackwing_descent.cpp b/src/server/scripts/EasternKingdoms/BlackwingDescent/instance_blackwing_descent.cpp index 61111595..81d386be 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingDescent/instance_blackwing_descent.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingDescent/instance_blackwing_descent.cpp @@ -21,8 +21,9 @@ class instance_blackwing_descent : public InstanceMapScript struct instance_blackwing_descent_InstanceMapScript : public InstanceScript { - instance_blackwing_descent_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + instance_blackwing_descent_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doorData); omnotronHealth = 0; @@ -42,7 +43,7 @@ class instance_blackwing_descent : public InstanceMapScript m_uiOmnotronGUID[i].Clear(); } - void BeforePlayerEnter(Player* player) + void OnPlayerEnter(Player* player) override { if (!uiTeamInInstance) uiTeamInInstance = player->GetTeam(); @@ -243,52 +244,6 @@ class instance_blackwing_descent : public InstanceMapScript return true; } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "B D " << GetBossSaveData(); - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - 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 == 'B' && dataHead2 == 'D') - { - 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } - private: uint32 omnotronHealth; uint32 uiAberCount; diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/blackwing_lair.h b/src/server/scripts/EasternKingdoms/BlackwingLair/blackwing_lair.h index 4f50dd24..8d9f8c37 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/blackwing_lair.h +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/blackwing_lair.h @@ -18,6 +18,8 @@ #ifndef DEF_BLACKWING_LAIR_H #define DEF_BLACKWING_LAIR_H +#define DataHeader "BWL" + uint32 const EncounterCount = 8; enum BWLEncounter diff --git a/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp b/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp index 52aabc4c..d5b4590e 100644 --- a/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp +++ b/src/server/scripts/EasternKingdoms/BlackwingLair/instance_blackwing_lair.cpp @@ -70,8 +70,9 @@ class instance_blackwing_lair : public InstanceMapScript struct instance_blackwing_lair_InstanceMapScript : public InstanceScript { - instance_blackwing_lair_InstanceMapScript(Map* map) : InstanceScript(map) + instance_blackwing_lair_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); } diff --git a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h index 807196e1..61322c30 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h +++ b/src/server/scripts/EasternKingdoms/Deadmines/deadmines.h @@ -1,6 +1,7 @@ #ifndef DEF_DEADMINES_H #define DEF_DEADMINES_H +#define DataHeader "DM" #define DMScriptName "instance_deadmines" enum CannonState diff --git a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp index 85949de1..76303311 100644 --- a/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp +++ b/src/server/scripts/EasternKingdoms/Deadmines/instance_deadmines.cpp @@ -35,8 +35,9 @@ class instance_deadmines : public InstanceMapScript struct instance_deadmines_InstanceMapScript : public InstanceScript { - instance_deadmines_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + instance_deadmines_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doordata); LoadDungeonEncounterData(encounters); @@ -267,60 +268,22 @@ class instance_deadmines : public InstanceMapScript return true; } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::string str_data; - std::ostringstream saveStream; - saveStream << "D M " << GetBossSaveData() << State << " " << uiVanessaEvent << " "; - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + data << State << " " << uiVanessaEvent; } - void Load(const char* in) + void ReadSaveDataMore(std::istringstream& data) override { - 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 == 'D' && dataHead2 == 'M') - { - - 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)); - } + data >> State; - loadStream >> State; - - if (State == CANNON_BLAST_INITIATED) - if (GameObject *pIronCladDoor = instance->GetGameObject(IronCladDoorGUID)) - pIronCladDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - - loadStream >> uiVanessaEvent; - if (uiVanessaEvent != DONE) - uiVanessaEvent = NOT_STARTED; - - } - else OUT_LOAD_INST_DATA_FAIL; + if (State == CANNON_BLAST_INITIATED) + if (GameObject *pIronCladDoor = instance->GetGameObject(IronCladDoorGUID)) + pIronCladDoor->SetGoState(GO_STATE_ACTIVE_ALTERNATIVE); - OUT_LOAD_INST_DATA_COMPLETE; + data >> uiVanessaEvent; + if (uiVanessaEvent != DONE) + uiVanessaEvent = NOT_STARTED; } private: diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h index 1b799d50..742e6bc5 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/gnomeregan.h @@ -18,6 +18,8 @@ #ifndef DEF_GNOMEREGAN_H #define DEF_GNOMEREGAN_H +#define DataHeader "GNO" + enum eGameObjects { GO_CAVE_IN_LEFT = 146085, diff --git a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp index 4bbabfde..ac022abd 100644 --- a/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp +++ b/src/server/scripts/EasternKingdoms/Gnomeregan/instance_gnomeregan.cpp @@ -33,8 +33,9 @@ class instance_gnomeregan : public InstanceMapScript struct instance_gnomeregan_InstanceMapScript : public InstanceScript { - instance_gnomeregan_InstanceMapScript(Map* map) : InstanceScript(map) + instance_gnomeregan_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); } uint32 m_auiEncounter[MAX_ENCOUNTER]; diff --git a/src/server/scripts/EasternKingdoms/GrimBatol/grim_batol.h b/src/server/scripts/EasternKingdoms/GrimBatol/grim_batol.h index ee382e4d..b7e1b767 100644 --- a/src/server/scripts/EasternKingdoms/GrimBatol/grim_batol.h +++ b/src/server/scripts/EasternKingdoms/GrimBatol/grim_batol.h @@ -1,6 +1,8 @@ #ifndef DEF_GRIMBATOL_H_ #define DEF_GRIMBATOL_H_ +#define DataHeader "GB" + enum Npcs { NPC_GENERAL_UMBRISS = 39625, diff --git a/src/server/scripts/EasternKingdoms/GrimBatol/instance_grim_batol.cpp b/src/server/scripts/EasternKingdoms/GrimBatol/instance_grim_batol.cpp index 2cdd1143..f028f8fa 100644 --- a/src/server/scripts/EasternKingdoms/GrimBatol/instance_grim_batol.cpp +++ b/src/server/scripts/EasternKingdoms/GrimBatol/instance_grim_batol.cpp @@ -12,7 +12,7 @@ class instance_grim_batol : public InstanceMapScript struct instance_grim_batol_InstanceMapScript : public InstanceScript { - instance_grim_batol_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_grim_batol_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} ObjectGuid uiGeneralUmbrissGUID; ObjectGuid uiForgemasterThrongusGUID; @@ -21,6 +21,7 @@ class instance_grim_batol : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); uiGeneralUmbrissGUID.Clear(); @@ -63,49 +64,6 @@ class instance_grim_batol : public InstanceMapScript } return ObjectGuid::Empty; } - - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "G B " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) override - { - 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 == 'G' && dataHead2 == 'B') - { - 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } }; }; diff --git a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp index 68e36165..6b4319c2 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp +++ b/src/server/scripts/EasternKingdoms/Karazhan/instance_karazhan.cpp @@ -56,7 +56,7 @@ class instance_karazhan : public InstanceMapScript struct instance_karazhan_InstanceMapScript : public InstanceScript { - instance_karazhan_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_karazhan_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string strSaveData; @@ -82,6 +82,7 @@ class instance_karazhan : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); // 1 - OZ, 2 - HOOD, 3 - RAJ, this never gets altered. diff --git a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h index e2b6d9b0..4f1dfb26 100644 --- a/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h +++ b/src/server/scripts/EasternKingdoms/Karazhan/karazhan.h @@ -19,6 +19,8 @@ #ifndef DEF_KARAZHAN_H #define DEF_KARAZHAN_H +#define DataHeader "KZ" + enum eEnums { TYPE_ATTUMEN = 1, diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp index 790f8476..1301c32a 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/instance_magisters_terrace.cpp @@ -67,7 +67,7 @@ class instance_magisters_terrace : public InstanceMapScript struct instance_magisters_terrace_InstanceMapScript : public InstanceScript { - instance_magisters_terrace_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_magisters_terrace_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 Encounter[MAX_ENCOUNTER]; uint32 DelrissaDeathCount; @@ -89,6 +89,7 @@ class instance_magisters_terrace : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&Encounter, 0, sizeof(Encounter)); FelCrystals.clear(); diff --git a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h index 78aa14b9..9b8c4f7f 100644 --- a/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h +++ b/src/server/scripts/EasternKingdoms/MagistersTerrace/magisters_terrace.h @@ -20,7 +20,8 @@ #define DEF_MAGISTERS_TERRACE_H #define ERROR_INST_DATA "TSCR Error: Instance Data not set properly for Magister's Terrace instance (map 585). Encounters will be buggy." -#endif + +#define DataHeader "MT" enum Data { @@ -47,3 +48,5 @@ enum Data DATA_ESCAPE_ORB = 16 }; + +#endif diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp index 4465bd7f..82009f58 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp +++ b/src/server/scripts/EasternKingdoms/MoltenCore/instance_molten_core.cpp @@ -50,29 +50,23 @@ class instance_molten_core : public InstanceMapScript struct instance_molten_core_InstanceMapScript : public InstanceScript { - instance_molten_core_InstanceMapScript(Map* map) : InstanceScript(map) + instance_molten_core_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); _golemaggTheIncineratorGUID.Clear(); _majordomoExecutusGUID.Clear(); _cacheOfTheFirelordGUID.Clear(); - _executusSchedule = false; - _deadBossCount = 0; _ragnarosAddDeaths = 0; - _isLoading = false; - _summonedExecutus = false; } - void OnPlayerEnter(Player* /*player*/) + void OnPlayerEnter(Player* /*player*/) override { if (_executusSchedule) - { - SummonMajordomoExecutus(_executusSchedule); - _executusSchedule = false; - } + SummonMajordomoExecutus(); } - void OnCreatureCreate(Creature* creature) + void OnCreatureCreate(Creature* creature) override { switch (creature->GetEntry()) { @@ -87,7 +81,7 @@ class instance_molten_core : public InstanceMapScript } } - void OnGameObjectCreate(GameObject* go) + void OnGameObjectCreate(GameObject* go) override { switch (go->GetEntry()) { @@ -99,7 +93,7 @@ class instance_molten_core : public InstanceMapScript } } - void SetData(uint32 type, uint32 data) + void SetData(uint32 type, uint32 data) override { if (type == DATA_RAGNAROS_ADDS) { @@ -121,7 +115,7 @@ class instance_molten_core : public InstanceMapScript return 0; } - ObjectGuid GetGuidData(uint32 type) const + ObjectGuid GetGuidData(uint32 type) const override { switch (type) { @@ -134,19 +128,14 @@ class instance_molten_core : public InstanceMapScript return ObjectGuid::Empty; } - bool SetBossState(uint32 bossId, EncounterState state) + bool SetBossState(uint32 bossId, EncounterState state) override { if (!InstanceScript::SetBossState(bossId, state)) return false; if (state == DONE && bossId < BOSS_MAJORDOMO_EXECUTUS) - ++_deadBossCount; - - if (_isLoading) - return true; - - if (_deadBossCount == 8) - SummonMajordomoExecutus(false); + if (CheckMajordomoExecutus()) + SummonMajordomoExecutus(); if (bossId == BOSS_MAJORDOMO_EXECUTUS && state == DONE) DoRespawnGameObject(_cacheOfTheFirelordGUID, 7 * DAY); @@ -154,13 +143,13 @@ class instance_molten_core : public InstanceMapScript return true; } - void SummonMajordomoExecutus(bool done) + void SummonMajordomoExecutus() { - if (_summonedExecutus) + _executusSchedule = false; + if (_majordomoExecutusGUID) return; - _summonedExecutus = true; - if (!done) + if (GetBossState(BOSS_MAJORDOMO_EXECUTUS) != DONE) { instance->SummonCreature(NPC_MAJORDOMO_EXECUTUS, SummonPositions[0]); instance->SummonCreature(NPC_FLAMEWAKER_HEALER, SummonPositions[1]); @@ -173,65 +162,25 @@ class instance_molten_core : public InstanceMapScript instance->SummonCreature(NPC_FLAMEWAKER_ELITE, SummonPositions[8]); } else if (TempSummon* summon = instance->SummonCreature(NPC_MAJORDOMO_EXECUTUS, RagnarosTelePos)) - summon->AI()->DoAction(ACTION_START_RAGNAROS_ALT); + summon->AI()->DoAction(ACTION_START_RAGNAROS_ALT); } - std::string GetSaveData() + bool CheckMajordomoExecutus() const { - OUT_SAVE_INST_DATA; + if (GetBossState(BOSS_MAJORDOMO_EXECUTUS) == DONE) + return false; - std::ostringstream saveStream; - saveStream << "M C " << GetBossSaveData(); + for (uint8 i = 0; i < BOSS_MAJORDOMO_EXECUTUS; ++i) + if (GetBossState(i) != DONE) + return false; - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); + return true; } - void Load(char const* data) + void ReadSaveDataMore(std::istringstream& /*data*/) override { - if (!data) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - _isLoading = true; - OUT_LOAD_INST_DATA(data); - - char dataHead1, dataHead2; - - std::istringstream loadStream(data); - loadStream >> dataHead1 >> dataHead2; - - if (dataHead1 == 'M' && dataHead2 == 'C') - { - EncounterState states[MAX_ENCOUNTER]; - uint8 executusCounter = 0; - - // need 2 loops to check spawning executus/ragnaros - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > TO_BE_DECIDED) - tmpState = NOT_STARTED; - states[i] = EncounterState(tmpState); - - if (tmpState == DONE && i < BOSS_MAJORDOMO_EXECUTUS) - ++executusCounter; - } - - if (executusCounter >= 8 && states[BOSS_RAGNAROS] != DONE) - _executusSchedule = bool(states[BOSS_MAJORDOMO_EXECUTUS] == DONE); - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - SetBossState(i, states[i]); - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - _isLoading = false; + if (CheckMajordomoExecutus()) + _executusSchedule = true; } private: @@ -239,10 +188,7 @@ class instance_molten_core : public InstanceMapScript ObjectGuid _majordomoExecutusGUID; ObjectGuid _cacheOfTheFirelordGUID; bool _executusSchedule; - uint8 _deadBossCount; uint8 _ragnarosAddDeaths; - bool _isLoading; - bool _summonedExecutus; }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.h b/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.h index bd6685b2..9d65f823 100644 --- a/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.h +++ b/src/server/scripts/EasternKingdoms/MoltenCore/molten_core.h @@ -19,6 +19,8 @@ #ifndef DEF_MOLTEN_CORE_H #define DEF_MOLTEN_CORE_H +#define DataHeader "MC" + enum Encounters { BOSS_LUCIFRON = 0, diff --git a/src/server/scripts/EasternKingdoms/ScarletHalls/instance_scarlet_halls.cpp b/src/server/scripts/EasternKingdoms/ScarletHalls/instance_scarlet_halls.cpp index 493d9ecf..22898cee 100644 --- a/src/server/scripts/EasternKingdoms/ScarletHalls/instance_scarlet_halls.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletHalls/instance_scarlet_halls.cpp @@ -39,8 +39,9 @@ class instance_scarlet_halls : public InstanceMapScript struct instance_scarlet_halls_InstanceMapScript : public InstanceScript { - instance_scarlet_halls_InstanceMapScript(Map* map) : InstanceScript(map) + instance_scarlet_halls_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/EasternKingdoms/ScarletHalls/scarlet_halls.h b/src/server/scripts/EasternKingdoms/ScarletHalls/scarlet_halls.h index d22f7427..10ac4818 100644 --- a/src/server/scripts/EasternKingdoms/ScarletHalls/scarlet_halls.h +++ b/src/server/scripts/EasternKingdoms/ScarletHalls/scarlet_halls.h @@ -19,6 +19,8 @@ #ifndef DEF_SCARLET_H #define DEF_SCARLET_H +#define DataHeader "SH" + enum Data { DATA_BRAUN = 0, diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp index b4dac011..a67dcc66 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/instance_scarlet_monastery.cpp @@ -38,7 +38,7 @@ class instance_scarlet_monastery : public InstanceMapScript struct instance_scarlet_monastery_InstanceMapScript : public InstanceScript { - instance_scarlet_monastery_InstanceMapScript(Map* map) : InstanceScript(map) + instance_scarlet_monastery_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { SetBossNumber(MAX_ENCOUNTER); } @@ -56,6 +56,7 @@ class instance_scarlet_monastery : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); LoadDoorData(doorData); memset(&encounter, 0, sizeof(encounter)); diff --git a/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h b/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h index 004cc991..2cd8b769 100644 --- a/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h +++ b/src/server/scripts/EasternKingdoms/ScarletMonastery/scarlet_monastery.h @@ -19,6 +19,8 @@ #ifndef DEF_SCARLET_M #define DEF_SCARLET_M +#define DataHeader "SM" + enum eEnums { DATA_THALNOS = 1, diff --git a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_chillheart.cpp b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_chillheart.cpp index 98bf495a..154bb70e 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_chillheart.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/boss_instructor_chillheart.cpp @@ -95,9 +95,11 @@ class boss_instructor_chillheart : public CreatureScript if (me->HasUnitState(UNIT_STATE_CASTING)) return; + // wrack soul is heroic only if (wracktimer <= diff) { - if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true)) + Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 30.0f, true); + if (GetDifficultyID() == DIFFICULTY_HEROIC && target) DoCast(target, SPELL_WRACK_SOUL); wracktimer = 12000; } diff --git a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp index d71a4855..0f988bc3 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp +++ b/src/server/scripts/EasternKingdoms/Scholomance/instance_scholomance.cpp @@ -38,6 +38,15 @@ enum GameObjectId GO_LAST_DOOR = 210789 }; +DungeonEncounterData const encounters[] = +{ + { DATA_INSTRUCTOR, {{ 1426 }} }, + { DATA_BAROV, {{ 1427 }} }, + { DATA_RATTLEGORE, {{ 1428 }} }, + { DATA_LILIAN, {{ 1429 }} }, + { DATA_DARKMASTER, {{ 1430 }} } +}; + class instance_scholomance : public InstanceMapScript { public: @@ -50,7 +59,7 @@ class instance_scholomance : public InstanceMapScript struct instance_scholomance_InstanceMapScript : public InstanceScript { - instance_scholomance_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_scholomance_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} //Creature ObjectGuid chillheartGuid; @@ -71,7 +80,10 @@ class instance_scholomance : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); SetBossNumber(5); + LoadDungeonEncounterData(encounters); + //Creature chillheartGuid.Clear(); barovGuid.Clear(); diff --git a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h index fa59cccf..b6bb4b40 100644 --- a/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h +++ b/src/server/scripts/EasternKingdoms/Scholomance/scholomance.h @@ -19,10 +19,7 @@ #ifndef DEF_SCHOLOMANCE_H #define DEF_SCHOLOMANCE_H -#include "SpellScript.h" -#include "Map.h" -#include "Creature.h" -#include "CreatureAIImpl.h" +#define DataHeader "SC" enum DataTyped { diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp index 7300f454..93f28fd0 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/instance_shadowfang_keep.cpp @@ -20,8 +20,9 @@ class instance_shadowfang_keep : public InstanceMapScript struct instance_shadowfang_keep_InstanceMapScript : public InstanceScript { - instance_shadowfang_keep_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + instance_shadowfang_keep_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); uiAshburyGUID.Clear(); @@ -32,13 +33,13 @@ class instance_shadowfang_keep : public InstanceMapScript teamInInstance = 0; }; - void BeforePlayerEnter(Player* pPlayer) + void OnPlayerEnter(Player* player) override { if (!teamInInstance) - teamInInstance = pPlayer->GetTeam(); + teamInInstance = player->GetTeam(); } - void OnCreatureCreate(Creature* pCreature) + void OnCreatureCreate(Creature* creature) { if (!teamInInstance) { @@ -48,50 +49,50 @@ class instance_shadowfang_keep : public InstanceMapScript teamInInstance = player->GetTeam(); } - switch(pCreature->GetEntry()) + switch(creature->GetEntry()) { case NPC_BELMONT: if (teamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_IVAR); + creature->UpdateEntry(NPC_IVAR); break; case NPC_GUARD_HORDE1: if (teamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_GUARD_ALLY); + creature->UpdateEntry(NPC_GUARD_ALLY); break; case NPC_GUARD_HORDE2: if (teamInInstance == ALLIANCE) - pCreature->UpdateEntry(NPC_GUARD_ALLY); + creature->UpdateEntry(NPC_GUARD_ALLY); break; case NPC_CROMUSH: if (teamInInstance == ALLIANCE) - pCreature->SetPhaseMask(2, true); + creature->SetPhaseMask(2, true); break; case NPC_ASHBURY: - uiAshburyGUID = pCreature->GetGUID(); + uiAshburyGUID = creature->GetGUID(); break; case NPC_SILVERLAINE: - uiSilverlaineGUID = pCreature->GetGUID(); + uiSilverlaineGUID = creature->GetGUID(); break; case NPC_SPRINGVALE: - uiSpringvaleGUID = pCreature->GetGUID(); + uiSpringvaleGUID = creature->GetGUID(); break; case NPC_VALDEN: - uiValdenGUID = pCreature->GetGUID(); + uiValdenGUID = creature->GetGUID(); break; case NPC_GODFREY: - uiGodfreyGUID = pCreature->GetGUID(); + uiGodfreyGUID = creature->GetGUID(); break; } } - void OnGameObjectCreate(GameObject* pGo) + void OnGameObjectCreate(GameObject* go) { - switch(pGo->GetEntry()) + switch(go->GetEntry()) { case GO_COURTYARD_DOOR: case GO_SORCERER_DOOR: case GO_ARUGAL_DOOR: - AddDoor(pGo, true); + AddDoor(go, true); break; } } @@ -111,17 +112,6 @@ class instance_shadowfang_keep : public InstanceMapScript return 0; } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "S K " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - ObjectGuid GetGuidData(uint32 data) const { switch (data) @@ -135,38 +125,6 @@ class instance_shadowfang_keep : public InstanceMapScript return ObjectGuid::Empty; } - 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 == 'S' && dataHead2 == 'K') - { - 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 - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - private: ObjectGuid uiAshburyGUID; ObjectGuid uiSilverlaineGUID; diff --git a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h index 35b61ac7..b9d6d8dc 100644 --- a/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h +++ b/src/server/scripts/EasternKingdoms/ShadowfangKeep/shadowfang_keep.h @@ -1,6 +1,8 @@ #ifndef DEF_SHADOWFANG_KEEP_H #define DEF_SHADOWFANG_KEEP_H +#define DataHeader "SK" + uint32 const EncounterCount = 5; enum eData diff --git a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp index 51bc619f..e62d788e 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp +++ b/src/server/scripts/EasternKingdoms/Stratholme/instance_stratholme.cpp @@ -64,8 +64,9 @@ class instance_stratholme : public InstanceMapScript struct instance_stratholme_InstanceMapScript : public InstanceScript { - instance_stratholme_InstanceMapScript(Map* map) : InstanceScript(map) + instance_stratholme_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); } uint32 EncounterState[MAX_ENCOUNTER]; diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h index b28271f5..aab5a7e8 100644 --- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h +++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h @@ -19,6 +19,8 @@ #ifndef DEF_STRATHOLME_H #define DEF_STRATHOLME_H +#define DataHeader "STR" + #define TYPE_BARON_RUN 1 #define TYPE_BARONESS 2 #define TYPE_NERUB 3 diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp index 67826c8e..90573aea 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/instance_sunken_temple.cpp @@ -52,8 +52,9 @@ class instance_sunken_temple : public InstanceMapScript struct instance_sunken_temple_InstanceMapScript : public InstanceScript { - instance_sunken_temple_InstanceMapScript(Map* map) : InstanceScript(map) + instance_sunken_temple_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); } ObjectGuid GOAtalaiStatue1; diff --git a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h index 6b93ef03..dd2f0e2c 100644 --- a/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h +++ b/src/server/scripts/EasternKingdoms/SunkenTemple/sunken_temple.h @@ -19,6 +19,8 @@ #ifndef DEF_SUNKEN_TEMPLE_H #define DEF_SUNKEN_TEMPLE_H +#define DataHeader "ST" + #define TROLLBOSS1_DEATH 1 #define TROLLBOSS2_DEATH 2 #define TROLLBOSS3_DEATH 3 diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp index 0b8d555f..342cc64b 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/instance_sunwell_plateau.cpp @@ -50,8 +50,9 @@ class instance_sunwell_plateau : public InstanceMapScript struct instance_sunwell_plateau_InstanceMapScript : public InstanceScript { - instance_sunwell_plateau_InstanceMapScript(Map* map) : InstanceScript(map) + instance_sunwell_plateau_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h index 2ef646ac..cdb81916 100644 --- a/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h +++ b/src/server/scripts/EasternKingdoms/SunwellPlateau/sunwell_plateau.h @@ -19,6 +19,8 @@ #ifndef DEF_SUNWELLPLATEAU_H #define DEF_SUNWELLPLATEAU_H +#define DataHeader "SWP" + /*** Encounters ***/ enum Data { diff --git a/src/server/scripts/EasternKingdoms/TheStonecore/instance_the_stonecore.cpp b/src/server/scripts/EasternKingdoms/TheStonecore/instance_the_stonecore.cpp index 4ce94cf2..6244dd00 100644 --- a/src/server/scripts/EasternKingdoms/TheStonecore/instance_the_stonecore.cpp +++ b/src/server/scripts/EasternKingdoms/TheStonecore/instance_the_stonecore.cpp @@ -12,12 +12,11 @@ class instance_the_stonecore : public InstanceMapScript struct instance_the_stonecore_InstanceMapScript : public InstanceScript { - instance_the_stonecore_InstanceMapScript(Map* map) : InstanceScript(map) {}; - - uint32 uiTeamInInstance; + instance_the_stonecore_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {}; void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } @@ -28,49 +27,6 @@ class instance_the_stonecore : public InstanceMapScript return true; } - - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "P S " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) override - { - 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 == 'P' && dataHead2 == 'S') - { - 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } }; }; diff --git a/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.h b/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.h index 2c30b184..c6a8d4ae 100644 --- a/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.h +++ b/src/server/scripts/EasternKingdoms/TheStonecore/the_stonecore.h @@ -1,6 +1,8 @@ #ifndef DEF_THESTONECORE_H_ #define DEF_THESTONECORE_H_ +#define DataHeader "PS" + enum eData { DATA_CORBORUS = 0, diff --git a/src/server/scripts/EasternKingdoms/ThroneoftheTides/instance_throne_of_the_tides.cpp b/src/server/scripts/EasternKingdoms/ThroneoftheTides/instance_throne_of_the_tides.cpp index 7347cd72..9c3481c7 100644 --- a/src/server/scripts/EasternKingdoms/ThroneoftheTides/instance_throne_of_the_tides.cpp +++ b/src/server/scripts/EasternKingdoms/ThroneoftheTides/instance_throne_of_the_tides.cpp @@ -22,8 +22,9 @@ class instance_throne_of_the_tides : public InstanceMapScript struct instance_throne_of_the_tides_InstanceMapScript : public InstanceScript { - instance_throne_of_the_tides_InstanceMapScript(Map* map) : InstanceScript(map) + instance_throne_of_the_tides_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doordata); uiLadyNazjarGUID.Clear(); @@ -269,58 +270,23 @@ class instance_throne_of_the_tides : public InstanceMapScript return true; } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "T o t T " << GetBossSaveData() << m_uiEvents[0] << " " << m_uiEvents[1] << " " << m_uiEvents[2] << " " << archaeologyQuestAura; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + data << m_uiEvents[0] << " " << m_uiEvents[1] << " " << m_uiEvents[2] << " " << archaeologyQuestAura; } - void Load(const char* in) + void ReadSaveDataMore(std::istringstream& data) override { - if (!in) + for (uint8 i = 0; i < 3; ++i) { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2, dataHead3, dataHead4; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> dataHead3 >> dataHead4; - - if (dataHead1 == 'T' && dataHead2 == 'o' && dataHead3 == 't' && dataHead4 == 'T') - { - 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)); - } - for (uint8 i = 0; i < 3; ++i) - { - uint32 tmpEvent; - loadStream >> tmpEvent; - if (tmpEvent == IN_PROGRESS || tmpEvent > SPECIAL) + uint32 tmpEvent; + data >> tmpEvent; + if (tmpEvent == IN_PROGRESS || tmpEvent > SPECIAL) tmpEvent = NOT_STARTED; - m_uiEvents[i] = tmpEvent; - } - loadStream >> archaeologyQuestAura; - } else OUT_LOAD_INST_DATA_FAIL; + m_uiEvents[i] = tmpEvent; + } - OUT_LOAD_INST_DATA_COMPLETE; + data >> archaeologyQuestAura; } private: diff --git a/src/server/scripts/EasternKingdoms/ThroneoftheTides/throne_of_the_tides.h b/src/server/scripts/EasternKingdoms/ThroneoftheTides/throne_of_the_tides.h index 8e3c3aee..21895619 100644 --- a/src/server/scripts/EasternKingdoms/ThroneoftheTides/throne_of_the_tides.h +++ b/src/server/scripts/EasternKingdoms/ThroneoftheTides/throne_of_the_tides.h @@ -1,6 +1,8 @@ #ifndef DEF_THRONEOFTHETIDES_H_ #define DEF_THRONEOFTHETIDES_H_ +#define DataHeader "TotT" + enum CreatureIds { NPC_LADY_NAZJAR_EVENT = 39959, diff --git a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp index 3e991b1f..bf234725 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp +++ b/src/server/scripts/EasternKingdoms/Uldaman/instance_uldaman.cpp @@ -43,12 +43,13 @@ class instance_uldaman : public InstanceMapScript struct instance_uldaman_InstanceMapScript : public InstanceScript { - instance_uldaman_InstanceMapScript(Map* map) : InstanceScript(map) + instance_uldaman_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); uiArchaedasGUID.Clear(); diff --git a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h index 2cd88ca3..946e9f49 100644 --- a/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h +++ b/src/server/scripts/EasternKingdoms/Uldaman/uldaman.h @@ -19,6 +19,8 @@ #ifndef DEF_ULDAMAN_H #define DEF_ULDAMAN_H +#define DataHeader "UD" + enum eObjects { GO_ARCHAEDAS_TEMPLE_DOOR = 141869, diff --git a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp index 8280ee9e..e631a218 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp +++ b/src/server/scripts/EasternKingdoms/ZulAman/instance_zulaman.cpp @@ -23,8 +23,9 @@ class instance_zulaman : public InstanceMapScript struct instance_zulaman_InstanceMapScript : public InstanceScript { - instance_zulaman_InstanceMapScript(Map* map) : InstanceScript(map) + instance_zulaman_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doordata); @@ -281,51 +282,19 @@ class instance_zulaman : public InstanceMapScript } } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::ostringstream ss; - ss << "ZA " << GetBossSaveData() << uiMainGate << " " << QuestMinute << " " << uiVendor1 << " " << uiVendor2 << " " << archaeologyQuestAura; - - OUT_SAVE_INST_DATA_COMPLETE; - return ss.str(); + data << uiMainGate << " " << QuestMinute << " " << uiVendor1 << " " << uiVendor2 << " " << archaeologyQuestAura; } - void Load(const char* in) + void ReadSaveDataMore(std::istringstream& data) override { - 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 == 'Z' && dataHead2 == 'A') - { - 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)); - } - loadStream >> uiMainGate; - loadStream >> QuestMinute; - DoUpdateWorldState(static_cast(3104), QuestMinute); - loadStream >> uiVendor1; - loadStream >> uiVendor2; - loadStream >> archaeologyQuestAura; - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + data >> uiMainGate; + data >> QuestMinute; + DoUpdateWorldState(static_cast(3104), QuestMinute); + data >> uiVendor1; + data >> uiVendor2; + data >> archaeologyQuestAura; } private: diff --git a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h index c5ed25b4..d6fda7d9 100644 --- a/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h +++ b/src/server/scripts/EasternKingdoms/ZulAman/zulaman.h @@ -1,6 +1,8 @@ #ifndef DEF_ZULAMAN_H #define DEF_ZULAMAN_H +#define DataHeader "ZA" + enum Data { DATA_AKILZON = 0, diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp index c2378f05..8861756f 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp +++ b/src/server/scripts/EasternKingdoms/ZulGurub/instance_zulgurub.cpp @@ -25,7 +25,7 @@ class instance_zulgurub : public InstanceMapScript struct instance_zulgurub_InstanceMapScript : public InstanceScript { - instance_zulgurub_InstanceMapScript(Map* map) : InstanceScript(map) + instance_zulgurub_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { SetBossNumber(EncounterCount); LoadDoorData(doordata); @@ -114,6 +114,7 @@ class instance_zulgurub : public InstanceMapScript return uiBosses; return 0; } + ObjectGuid GetGuidData(uint32 type) const { switch (type) @@ -144,51 +145,16 @@ class instance_zulgurub : public InstanceMapScript return ObjectGuid::Empty; } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "Z G " << uiBosses << " " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); + data << uiBosses; } - void Load(char const* str) + void ReadSaveDataMore(std::istringstream& data) 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 == 'Z' && dataHead2 == 'G') - { - loadStream >> uiBosses; - if (uiBosses > 5) - uiBosses = 0; - for (uint8 i = 0; i < EncounterCount; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - - SetBossState(i, EncounterState(tmpState)); - } - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + data >> uiBosses; + if (uiBosses > 5) + uiBosses = 0; } protected: diff --git a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h index 98a29ec6..f5d6a919 100644 --- a/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h +++ b/src/server/scripts/EasternKingdoms/ZulGurub/zulgurub.h @@ -1,6 +1,7 @@ #ifndef DEF_ZULGURUB_H #define DEF_ZULGURUB_H +#define DataHeader "ZG" #define ZGScriptName "instance_zulgurub" uint32 const EncounterCount = 5; diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h index 21768b15..39484f43 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/blackfathom_deeps.h @@ -19,6 +19,8 @@ #ifndef DEF_BFD_H #define DEF_BFD_H +#define DataHeader "BFD" + enum Data64 { DATA_SHRINE1, diff --git a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp index c7b5a8c7..b549abdf 100644 --- a/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp +++ b/src/server/scripts/Kalimdor/BlackfathomDeeps/instance_blackfathom_deeps.cpp @@ -64,7 +64,7 @@ class instance_blackfathom_deeps : public InstanceMapScript struct instance_blackfathom_deeps_InstanceMapScript : public InstanceScript { - instance_blackfathom_deeps_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_blackfathom_deeps_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} ObjectGuid twilightLordKelrisGUID; ObjectGuid shrine1GUID; @@ -81,6 +81,7 @@ class instance_blackfathom_deeps : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&encounter, 0, sizeof(encounter)); twilightLordKelrisGUID.Clear(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h index 2cfba474..b22aa8e4 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/hyjal.h @@ -21,6 +21,8 @@ #define ERROR_INST_DATA "TSCR: Instance data not set properly for Mount Hyjal. Encounters will be buggy." +#define DataHeader "HJ" + enum Types { DATA_ANETHERON = 1, diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp index 07d9d614..bac2a005 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/BattleForMountHyjal/instance_hyjal.cpp @@ -54,7 +54,7 @@ class instance_hyjal : public InstanceMapScript struct instance_mount_hyjal_InstanceMapScript : public InstanceScript { - instance_mount_hyjal_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_mount_hyjal_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; @@ -85,6 +85,7 @@ class instance_hyjal : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); m_uiAncientGemGUID.clear(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h index 2032e3ee..a2f58140 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/culling_of_stratholme.h @@ -1,6 +1,8 @@ #ifndef DEF_CULLING_OF_STRATHOLME_H #define DEF_CULLING_OF_STRATHOLME_H +#define DataHeader "CS" + enum Data { DATA_MEATHOOK_EVENT, diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp index 189d8ec2..dd833592 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/CullingOfStratholme/instance_culling_of_stratholme.cpp @@ -45,8 +45,9 @@ class instance_culling_of_stratholme : public InstanceMapScript struct instance_culling_of_stratholme_InstanceMapScript : public InstanceScript { - instance_culling_of_stratholme_InstanceMapScript(Map* map) : InstanceScript(map) + instance_culling_of_stratholme_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); _arthasGUID.Clear(); _meathookGUID.Clear(); _salrammGUID.Clear(); diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.h b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.h index d438137f..93e2990c 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/dark_portal.h @@ -19,6 +19,8 @@ #ifndef DEF_DARKPORTAL_H #define DEF_DARKPORTAL_H +#define DataHeader "DP" + #define TYPE_MEDIVH 1 #define TYPE_RIFT 2 diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp index 85e0458e..db73e8b8 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DarkPortal/instance_dark_portal.cpp @@ -74,8 +74,9 @@ class instance_dark_portal : public InstanceMapScript struct instance_dark_portal_InstanceMapScript : public InstanceScript { - instance_dark_portal_InstanceMapScript(Map* map) : InstanceScript(map) + instance_dark_portal_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); } uint32 m_auiEncounter[MAX_ENCOUNTER]; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/dragon_soul.h b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/dragon_soul.h index 1d061692..ad8b0fa7 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/dragon_soul.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/dragon_soul.h @@ -10,6 +10,8 @@ // 106093 - summit teleport aoe // 106092 - temple teleport aoe +#define DataHeader "DS" + enum Datas { DATA_MORCHOK = 0, diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/instance_dragon_soul.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/instance_dragon_soul.cpp index adeceb87..b3ad85b2 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/instance_dragon_soul.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/DragonSoul/instance_dragon_soul.cpp @@ -36,8 +36,9 @@ class instance_dragon_soul : public InstanceMapScript struct instance_dragon_soul_InstanceMapScript : public InstanceScript, public instance_dragon_soul_trash_accessor { - instance_dragon_soul_InstanceMapScript(Map* map) : InstanceScript(map) + instance_dragon_soul_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); uiMorchokGUID.Clear(); @@ -761,76 +762,40 @@ class instance_dragon_soul : public InstanceMapScript ActivatePortal(Teleports); } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "D S " << GetBossSaveData() << uiOpenPortalEvent << " " << bHagaraEvent << " " << uiDragonSoulEvent << " " << uiUltraxionTrash << " "; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + data << uiOpenPortalEvent << " " << bHagaraEvent << " " << uiDragonSoulEvent << " " << uiUltraxionTrash; } - void Load(const char* in) + void ReadSaveDataMore(std::istringstream& data) override { - 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 == 'D' && dataHead2 == 'S') - { - 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 tmpEvent; - loadStream >> tmpEvent; - if (tmpEvent != DONE) - tmpEvent = NOT_STARTED; - uiOpenPortalEvent = tmpEvent; - - loadStream >> tmpEvent; - if (tmpEvent != DONE) - tmpEvent = NOT_STARTED; - bHagaraEvent = tmpEvent; - - loadStream >> tmpEvent; - if (tmpEvent != DONE) - tmpEvent = NOT_STARTED; - uiDragonSoulEvent = tmpEvent; - - loadStream >> tmpEvent; - if (tmpEvent != DONE) - tmpEvent = NOT_STARTED; - uiUltraxionTrash = tmpEvent; - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + uint32 tmpEvent; + data >> tmpEvent; + if (tmpEvent != DONE) + tmpEvent = NOT_STARTED; + uiOpenPortalEvent = tmpEvent; + + data >> tmpEvent; + if (tmpEvent != DONE) + tmpEvent = NOT_STARTED; + bHagaraEvent = tmpEvent; + + data >> tmpEvent; + if (tmpEvent != DONE) + tmpEvent = NOT_STARTED; + uiDragonSoulEvent = tmpEvent; + + data >> tmpEvent; + if (tmpEvent != DONE) + tmpEvent = NOT_STARTED; + uiUltraxionTrash = tmpEvent; } bool IsLFR() const { return isLfr; } + bool IsFallOfDeathwing() const { return isLfr && isFallOfDeathwing; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EndTime/end_time.h b/src/server/scripts/Kalimdor/CavernsOfTime/EndTime/end_time.h index ccd5deba..c95def1f 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EndTime/end_time.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EndTime/end_time.h @@ -1,6 +1,7 @@ #ifndef DEF_ENDTIME_H #define DEF_ENDTIME_H +#define DataHeader "ET" #define ETScriptName "instance_end_time" #define MAX_FRAGMENTS_COUNT 12 diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EndTime/instance_end_time.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EndTime/instance_end_time.cpp index ac3a3222..7bb3f046 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EndTime/instance_end_time.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EndTime/instance_end_time.cpp @@ -15,8 +15,9 @@ class instance_end_time : public InstanceMapScript struct instance_end_time_InstanceMapScript : public InstanceScript { - instance_end_time_InstanceMapScript(Map* map) : InstanceScript(map) + instance_end_time_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); uiTeamInInstance = 0; uiFragmentsCollected = 0; @@ -239,90 +240,51 @@ class instance_end_time : public InstanceMapScript packet.Worldstates.emplace_back(WorldStates::WORLDSTATE_FRAGMENTS_COLLECTED, uiFragmentsCollected); } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "E T " << GetBossSaveData() - << first_echo << ' ' << second_echo << ' ' - << first_encounter << ' ' << second_encounter << ' ' - << jaina_event << ' ' << tyrande_event << ' ' - << nozdormu_dialog[0] << ' ' << nozdormu_dialog[1] << ' ' - << nozdormu_dialog[2] << ' ' << nozdormu_dialog[3] << ' '; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + data << first_echo << ' ' << second_echo << ' ' + << first_encounter << ' ' << second_encounter << ' ' + << jaina_event << ' ' << tyrande_event << ' ' + << nozdormu_dialog[0] << ' ' << nozdormu_dialog[1] << ' ' + << nozdormu_dialog[2] << ' ' << nozdormu_dialog[3]; } - void Load(const char* in) + void ReadSaveDataMore(std::istringstream& data) override { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); + uint32 temp_echo1 = 0; + data >> temp_echo1; + first_echo = temp_echo1; - char dataHead1, dataHead2; + uint32 temp_echo2 = 0; + data >> temp_echo2; + second_echo = temp_echo2; - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2; - - if (dataHead1 == 'E' && dataHead2 == 'T') - { - 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 temp_enc1 = 0; + data >> temp_enc1; + first_encounter = temp_enc1; - uint32 temp_echo1 = 0; - loadStream >> temp_echo1; - first_echo = temp_echo1; + uint32 temp_enc2 = 0; + data >> temp_enc2; + second_encounter = temp_enc2; - uint32 temp_echo2 = 0; - loadStream >> temp_echo2; - second_echo = temp_echo2; + uint32 temp = 0; + data >> temp; + jaina_event = temp ? DONE : NOT_STARTED; - uint32 temp_enc1 = 0; - loadStream >> temp_enc1; - first_encounter = temp_enc1; + uint32 temp_event = 0; + data >> temp_event; + if (temp_event == IN_PROGRESS || temp_event > SPECIAL) + temp_event = NOT_STARTED; + tyrande_event = temp_event; - uint32 temp_enc2 = 0; - loadStream >> temp_enc2; - second_encounter = temp_enc2; - - uint32 temp = 0; - loadStream >> temp; - jaina_event = temp ? DONE : NOT_STARTED; - - uint32 temp_event = 0; - loadStream >> temp_event; - if (temp_event == IN_PROGRESS || temp_event > SPECIAL) - temp_event = NOT_STARTED; - tyrande_event = temp_event; - - for (uint8 i = 0; i < 4; ++i) - { - uint32 tmpDialog; - loadStream >> tmpDialog; - if (tmpDialog == IN_PROGRESS || tmpDialog > SPECIAL) - tmpDialog = NOT_STARTED; - nozdormu_dialog[i] = tmpDialog; - } - - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + for (uint8 i = 0; i < 4; ++i) + { + uint32 tmpDialog; + data >> tmpDialog; + if (tmpDialog == IN_PROGRESS || tmpDialog > SPECIAL) + tmpDialog = NOT_STARTED; + nozdormu_dialog[i] = tmpDialog; + } } private: diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp index be06938c..e2848a73 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/instance_old_hillsbrad.cpp @@ -51,7 +51,7 @@ class instance_old_hillsbrad : public InstanceMapScript struct instance_old_hillsbrad_InstanceMapScript : public InstanceScript { - instance_old_hillsbrad_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_old_hillsbrad_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; uint32 mBarrelCount; @@ -63,6 +63,7 @@ class instance_old_hillsbrad : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); mBarrelCount = 0; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h index 2a7b4703..a203fc46 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/EscapeFromDurnholdeKeep/old_hillsbrad.h @@ -19,6 +19,8 @@ #ifndef DEF_OLD_HILLSBRAD_H #define DEF_OLD_HILLSBRAD_H +#define DataHeader "OH" + #define TYPE_BARREL_DIVERSION 1 #define TYPE_THRALL_EVENT 2 #define TYPE_THRALL_PART1 3 diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/hour_of_twilight.h b/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/hour_of_twilight.h index 84c6d9a9..76359ed5 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/hour_of_twilight.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/hour_of_twilight.h @@ -1,6 +1,8 @@ #ifndef DEF_HOUROFTWILIGHT_H #define DEF_HOUROFTWILIGHT_H +#define DataHeader "HOT" + const Position drakePos = {4292.110840f, 577.053528f, -6.63f, 3.54f}; const Position teleportPos = {3938.491211f, 274.222351f, 13.97f, 3.26f}; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/instance_hour_of_twilight.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/instance_hour_of_twilight.cpp index 860a5bac..58bb83dd 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/instance_hour_of_twilight.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/HourofTwilight/instance_hour_of_twilight.cpp @@ -21,8 +21,9 @@ class instance_hour_of_twilight : public InstanceMapScript struct instance_hour_of_twilight_InstanceMapScript : public InstanceScript { - instance_hour_of_twilight_InstanceMapScript(Map* map) : InstanceScript(map) + instance_hour_of_twilight_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doordata); @@ -65,51 +66,6 @@ class instance_hour_of_twilight : public InstanceMapScript return true; } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "H o T " << GetBossSaveData(); - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - 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 == 'H' && dataHead2 == 'o' && dataHead3 == 'T') - { - 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } - private: ObjectGuid uiAsira; }; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/WellofEternity/instance_well_of_eternity.cpp b/src/server/scripts/Kalimdor/CavernsOfTime/WellofEternity/instance_well_of_eternity.cpp index 37d755f8..d32ffe8d 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/WellofEternity/instance_well_of_eternity.cpp +++ b/src/server/scripts/Kalimdor/CavernsOfTime/WellofEternity/instance_well_of_eternity.cpp @@ -15,8 +15,9 @@ class instance_well_of_eternity : public InstanceMapScript struct instance_well_of_eternity_InstanceMapScript : public InstanceScript { - instance_well_of_eternity_InstanceMapScript(Map* map) : InstanceScript(map) + instance_well_of_eternity_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); //LoadDoorData(doordata); } @@ -53,50 +54,6 @@ class instance_well_of_eternity : public InstanceMapScript return true; } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "W o T " << GetBossSaveData(); - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - void Load(const char* in) - { - 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 == 'W' && dataHead2 == 'o' && dataHead3 == 'T') - { - 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } - private: uint32 uiTeamInInstance; diff --git a/src/server/scripts/Kalimdor/CavernsOfTime/WellofEternity/well_of_eternity.h b/src/server/scripts/Kalimdor/CavernsOfTime/WellofEternity/well_of_eternity.h index e69de29b..0b59aedd 100644 --- a/src/server/scripts/Kalimdor/CavernsOfTime/WellofEternity/well_of_eternity.h +++ b/src/server/scripts/Kalimdor/CavernsOfTime/WellofEternity/well_of_eternity.h @@ -0,0 +1,6 @@ +#ifndef DEF_WELLOFETERNITY_H +#define DEF_WELLOFETERNITY_H + +#define DataHeader "WoT" + +#endif \ No newline at end of file diff --git a/src/server/scripts/Kalimdor/Firelands/firelands.h b/src/server/scripts/Kalimdor/Firelands/firelands.h index c82bd6f9..24471a8a 100644 --- a/src/server/scripts/Kalimdor/Firelands/firelands.h +++ b/src/server/scripts/Kalimdor/Firelands/firelands.h @@ -1,6 +1,8 @@ #ifndef DEF_FIRELANDS_H #define DEF_FIRELANDS_H +#define DataHeader "FL" + const Position FLEntrancePos = {-547.313f, 318.42f, 115.473f, 5.91667f}; // Firelands Entrance enum Data diff --git a/src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp b/src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp index 6795730b..c43fa764 100644 --- a/src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp +++ b/src/server/scripts/Kalimdor/Firelands/instance_firelands.cpp @@ -32,8 +32,9 @@ class instance_firelands : public InstanceMapScript struct instance_firelands_InstanceMapScript : public InstanceScript { - instance_firelands_InstanceMapScript(Map* map) : InstanceScript(map) + instance_firelands_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doordata); uiShannoxGUID.Clear(); @@ -287,54 +288,16 @@ class instance_firelands : public InstanceMapScript } } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::string str_data; - - std::ostringstream saveStream; - saveStream << "F L " << GetBossSaveData() << uiEvent << ' '; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + data << uiEvent; } - void Load(const char* in) + void ReadSaveDataMore(std::istringstream& data) override { - 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 == 'F' && dataHead2 == 'L') - { - 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 tempEvent = 0; - loadStream >> tempEvent; - uiEvent = (tempEvent != DONE ? 0 : DONE); - - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + uint32 tempEvent = 0; + data >> tempEvent; + uiEvent = (tempEvent != DONE ? 0 : DONE); } private: diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h b/src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h index 61fd5563..133c2be2 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/halls_of_origination.h @@ -1,6 +1,7 @@ #ifndef DEF_HALLS_OF_ORIGINATION_H #define DEF_HALLS_OF_ORIGINATION_H +#define DataHeader "HOO" #define HOScriptName "instance_halls_of_origination" enum Data diff --git a/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp b/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp index e7c2c879..96e13dca 100644 --- a/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp +++ b/src/server/scripts/Kalimdor/HallsOfOrigination/instance_halls_of_origination.cpp @@ -26,6 +26,7 @@ class instance_halls_of_origination : public InstanceMapScript { instance_halls_of_origination_InstanceMapScript(InstanceMap *map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doorData); uiTempleGuardianAnhuurGUID.Clear(); @@ -202,50 +203,18 @@ class instance_halls_of_origination : public InstanceMapScript SaveToDB(); } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "H O" << GetBossSaveData() << uiWardensDone << " "; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); + data << uiWardensDone; } - void Load(const char* in) + void ReadSaveDataMore(std::istringstream& data) override { - 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 == 'H' && dataHead2 == 'O') - { - 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 wardens = 0; - loadStream >> wardens; - //uiWardensDone = wardens; - if (wardens > 4) wardens = 4; - SetData(DATA_WARDENS, wardens); - }else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + uint32 wardens = 0; + data >> wardens; + //uiWardensDone = wardens; + if (wardens > 4) wardens = 4; + SetData(DATA_WARDENS, wardens); } private: diff --git a/src/server/scripts/Kalimdor/LostCityOfTheTolvir/instance_lost_city_of_the_tolvir.cpp b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/instance_lost_city_of_the_tolvir.cpp index 7b5ad920..905e6216 100644 --- a/src/server/scripts/Kalimdor/LostCityOfTheTolvir/instance_lost_city_of_the_tolvir.cpp +++ b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/instance_lost_city_of_the_tolvir.cpp @@ -35,6 +35,7 @@ class instance_lost_city_of_the_tolvir : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&Encounter, 0, sizeof(Encounter)); memset(&uiTunnelGUID, 0, sizeof(uiTunnelGUID)); uiTunnelFlag = 0; diff --git a/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.h b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.h index 00093a9d..3bfb36d2 100644 --- a/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.h +++ b/src/server/scripts/Kalimdor/LostCityOfTheTolvir/lost_city_of_the_tolvir.h @@ -1,6 +1,8 @@ #ifndef DEF_LOST_CITY_OF_THE_TOLVIR_H #define DEF_LOST_CITY_OF_THE_TOLVIR_H +#define DataHeader "LCT" + enum Data64 { DATA_GENERAL_HUSAM, diff --git a/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp b/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp index 51420ba3..fd865f19 100644 --- a/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp +++ b/src/server/scripts/Kalimdor/Maraudon/instance_maraudon.cpp @@ -24,6 +24,7 @@ gets instead the deserter debuff. #include "ScriptMgr.h" #include "InstanceScript.h" +#include "maraudon.h" class instance_maraudon : public InstanceMapScript { @@ -37,7 +38,10 @@ class instance_maraudon : public InstanceMapScript struct instance_maraudon_InstanceMapScript : public InstanceScript { - instance_maraudon_InstanceMapScript(Map* map) : InstanceScript(map) { } + instance_maraudon_InstanceMapScript(InstanceMap* map) : InstanceScript(map) + { + SetHeaders(DataHeader); + } }; }; diff --git a/src/server/scripts/Kalimdor/Maraudon/maraudon.h b/src/server/scripts/Kalimdor/Maraudon/maraudon.h new file mode 100644 index 00000000..f08aafb7 --- /dev/null +++ b/src/server/scripts/Kalimdor/Maraudon/maraudon.h @@ -0,0 +1,6 @@ +#ifndef DEF_MARAUDON_H +#define DEF_MARAUDON_H + +#define DataHeader "MD" + +#endif \ No newline at end of file diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp index 7d3f5e36..5c1f7a10 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp +++ b/src/server/scripts/Kalimdor/OnyxiasLair/instance_onyxias_lair.cpp @@ -43,7 +43,7 @@ class instance_onyxias_lair : public InstanceMapScript struct instance_onyxias_lair_InstanceMapScript : public InstanceScript { - instance_onyxias_lair_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_onyxias_lair_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} //Eruption is a BFS graph problem //One map to remember all floor, one map to keep floor that still need to erupt and one queue to know what needs to be removed @@ -62,6 +62,7 @@ class instance_onyxias_lair : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&Encounter, 0, sizeof(Encounter)); OnyxiasGUID.Clear(); diff --git a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h index a24bb627..b31040c5 100644 --- a/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h +++ b/src/server/scripts/Kalimdor/OnyxiasLair/onyxias_lair.h @@ -18,6 +18,8 @@ #ifndef DEF_ONYXIAS_LAIR_H #define DEF_ONYXIAS_LAIR_H +#define DataHeader "OL" + enum Data64 { DATA_ONYXIA_GUID, diff --git a/src/server/scripts/Kalimdor/RagefireChasm/boss_adarogg.cpp b/src/server/scripts/Kalimdor/RagefireChasm/boss_adarogg.cpp new file mode 100644 index 00000000..bb913ea3 --- /dev/null +++ b/src/server/scripts/Kalimdor/RagefireChasm/boss_adarogg.cpp @@ -0,0 +1,33 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "TaskScheduler.h" +#include "ragefire_chasm.h" + +// 61408 - Adarogg +// this is a placeholder to allow boss kill credit/messaging from BossAI::JustDied +struct boss_adarogg : public BossAI +{ + boss_adarogg(Creature* creature) : BossAI(creature, BOSS_ADAROGG) { } +}; + +void AddSC_boss_adarogg() +{ + RegisterRagefireChasmCreatureAI(boss_adarogg); +} diff --git a/src/server/scripts/Kalimdor/RagefireChasm/boss_dark_shaman_koranthal.cpp b/src/server/scripts/Kalimdor/RagefireChasm/boss_dark_shaman_koranthal.cpp new file mode 100644 index 00000000..55b0d85d --- /dev/null +++ b/src/server/scripts/Kalimdor/RagefireChasm/boss_dark_shaman_koranthal.cpp @@ -0,0 +1,146 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "InstanceScript.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "SpellScript.h" +#include "ragefire_chasm.h" + +enum KoranthalSpells +{ + SPELL_SHADOW_VORTEX = 119928, + SPELL_TWISTED_ELEMENTS = 119300, + SPELL_SHADOW_STORM = 119971 +}; + +enum KoranthalTexts +{ + SAY_AGGRO = 0, + SAY_SHADOW_STORM = 1, + SAY_DEATH = 2 +}; + +enum KoranthalEvents +{ + EVENT_TWISTED_ELEMENTS = 1, + EVENT_SHADOW_STORM = 2 +}; + +// 61412 - Dark Shaman Koranthal +struct boss_dark_shaman_koranthal : public BossAI +{ + boss_dark_shaman_koranthal(Creature* creature) : BossAI(creature, BOSS_DARK_SHAMAN_KORANTHAL) { } + + void JustRespawned() override + { + me->CastSpell(me, SPELL_SHADOW_VORTEX, true); + } + + void Reset() override + { + _Reset(); + } + + void EnterEvadeMode(/*why*/) override + { + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + + _EnterEvadeMode(); + _DespawnAtEvade(); + } + + void EnterCombat(Unit* who) override + { + BossAI::EnterCombat(who); + + Talk(SAY_AGGRO); + me->RemoveAurasDueToSpell(SPELL_SHADOW_VORTEX); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1); + + events.ScheduleEvent(EVENT_TWISTED_ELEMENTS, 6s); + events.ScheduleEvent(EVENT_SHADOW_STORM, 20500ms); + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + Talk(SAY_DEATH); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_TWISTED_ELEMENTS: + { + DoCastVictim(SPELL_TWISTED_ELEMENTS); + events.RepeatEvent(7300); + break; + } + case EVENT_SHADOW_STORM: + { + Talk(SAY_SHADOW_STORM); + DoCast(SPELL_SHADOW_STORM); + events.RescheduleEvent(EVENT_TWISTED_ELEMENTS, 15700); + events.RepeatEvent(47200); + break; + } + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + + DoMeleeAttackIfReady(); + } +}; + +// 119973 - Shadow Storm +class spell_dark_shaman_koranthal_shadow_storm : public SpellScript +{ + PrepareSpellScript(spell_dark_shaman_koranthal_shadow_storm); + + void HandleScript(SpellEffIndex /*effIndex*/) + { + GetCaster()->CastSpell(GetHitUnit(), GetEffectValue(), true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_dark_shaman_koranthal_shadow_storm::HandleScript, EFFECT_0, SPELL_EFFECT_DUMMY); + } +}; + +void AddSC_boss_dark_shaman_koranthal() +{ + RegisterRagefireChasmCreatureAI(boss_dark_shaman_koranthal); + RegisterSpellScript(spell_dark_shaman_koranthal_shadow_storm); +} diff --git a/src/server/scripts/Kalimdor/RagefireChasm/boss_lava_guard_gordoth.cpp b/src/server/scripts/Kalimdor/RagefireChasm/boss_lava_guard_gordoth.cpp new file mode 100644 index 00000000..eb11b51e --- /dev/null +++ b/src/server/scripts/Kalimdor/RagefireChasm/boss_lava_guard_gordoth.cpp @@ -0,0 +1,240 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "GameObject.h" +#include "InstanceScript.h" +#include "MotionMaster.h" +#include "Player.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "TaskScheduler.h" +#include "ragefire_chasm.h" + +enum GordothSpells +{ + // Intro + SPELL_JAIL_BREAK = 120025, + SPELL_GROUND_SLAM = 120023, + SPELL_MEAT_EXPLOSION_1 = 111778, + SPELL_MEAT_EXPLOSION_2 = 111779, + SPELL_MEAT_EXPLOSION_3 = 111780, + SPELL_BLOODY_SUICIDE = 120022, + + SPELL_GROUND_RUPTURE = 119999, + SPELL_SEISMIC_SLAM = 120024, + SPELL_ENRAGE = 50420 +}; + +enum GordothEvents +{ + EVENT_GROUND_RUPTURE = 1, + EVENT_SEISMIC_SLAM = 2 +}; + +enum GordothActions +{ + ACTION_JUMP = 1 +}; + +enum GordothMisc +{ + NPC_DARK_SHAMAN_RESEARCHER = 61644, + + GO_GORDOTH_CAGE = 211792, + GO_LAB_VIAL = 211784, + + ANIMKIT_GORDOTH_NONE = 0, + + POINT_JUMP = 1 +}; + +static const Position GordothJumpPos = { -363.5392f, 203.36604f, -22.005634f, 0.308123469352722167f }; + +// Areatrigger - 7899 +class at_lava_guard_gordoth_intro : public OnlyOnceAreaTriggerScript +{ +public: + at_lava_guard_gordoth_intro() : OnlyOnceAreaTriggerScript("at_lava_guard_gordoth_intro") { } + + bool TryHandleOnce(Player* player, AreaTriggerEntry const* /*areaTrigger*/) override + { + if (player->isGameMaster()) + return false; + + InstanceScript* instance = player->GetInstanceScript(); + if (!instance) + return false; + + Creature* gordoth = instance->GetCreature(BOSS_LAVA_GUARD_GORDOTH); + if (!gordoth) + return false; + + gordoth->AI()->DoAction(ACTION_JUMP); + + return true; + } +}; + +// 61528 - Lava Guard Gordoth +struct boss_lava_guard_gordoth : public BossAI +{ + boss_lava_guard_gordoth(Creature* creature) : BossAI(creature, BOSS_LAVA_GUARD_GORDOTH), _enrageTriggered(false) { } + + void InitializeAI() override + { + if (instance->GetBossState(BOSS_LAVA_GUARD_GORDOTH) != NOT_STARTED) + me->Relocate(GordothJumpPos); + } + + void Reset() override + { + _Reset(); + + _enrageTriggered = false; + } + + void EnterEvadeMode(/*EvadeReason*/ /*why*/) override + { + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + + _EnterEvadeMode(); + _DespawnAtEvade(); + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + } + + void EnterCombat(Unit* who) override + { + BossAI::EnterCombat(who); + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1); + events.ScheduleEvent(EVENT_GROUND_RUPTURE, 7300ms); + events.ScheduleEvent(EVENT_SEISMIC_SLAM, 13300ms); + } + + void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/) override + { + if (_enrageTriggered) + return; + + if (me->HealthBelowPctDamaged(31, damage)) + { + _enrageTriggered = true; + DoCastSelf(SPELL_ENRAGE); + } + } + + void DoAction(int32 action) override + { + if (action != ACTION_JUMP) + return; + + me->SetAnimKitId(ANIMKIT_GORDOTH_NONE); + DoCastSelf(SPELL_JAIL_BREAK); + me->GetMotionMaster()->MoveJump(GordothJumpPos, 50.0f, 55.5477f, POINT_JUMP, GordothJumpPos.GetOrientation()); + + scheduler.Schedule(30ms, [this](TaskContext /*task*/) + { + if (GameObject* go = GetClosestGameObjectWithEntry(me, GO_GORDOTH_CAGE, 50.0f)) + go->SetGoState(GO_STATE_ACTIVE); + }); + } + + void MovementInform(uint32 type, uint32 pointId) override + { + if (type != EFFECT_MOTION_TYPE) + return; + + if (pointId == POINT_JUMP) + { + DoCast(SPELL_GROUND_SLAM); + me->SetHomePosition(GordothJumpPos); + +// std::vector labVialsList; +// GetGameObjectListWithEntryInGrid(labVialsList, me, GO_LAB_VIAL, 25.0f); +// for (GameObject* vial : labVialsList) +// { +// vial->SetGoState(GO_STATE_DESTROYED); +// } + + std::list darkShamanResearcherList; + GetCreatureListWithEntryInGrid(darkShamanResearcherList, me, NPC_DARK_SHAMAN_RESEARCHER, 25.0f); + for (Creature* darkShamanResearcher : darkShamanResearcherList) + { + darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_1, true); + darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_1, true); + darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_2, true); + darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_2, true); + darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_3, true); + darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_3, true); + darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_MEAT_EXPLOSION_3, true); // According to sniff + darkShamanResearcher->CastSpell(darkShamanResearcher, SPELL_BLOODY_SUICIDE, false); + } + } + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + while (uint32 eventId = events.ExecuteEvent()) + { + switch (eventId) + { + case EVENT_GROUND_RUPTURE: + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + DoCast(target, SPELL_GROUND_RUPTURE); + events.RepeatEvent(12100); + break; + } + case EVENT_SEISMIC_SLAM: + { + DoCast(nullptr, SPELL_SEISMIC_SLAM, TriggerCastFlags(TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD)); // cast earlier than category cd + events.RepeatEvent(36300); + break; + } + default: + break; + } + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + } + + DoMeleeAttackIfReady(); + } + +private: + bool _enrageTriggered; +}; + +void AddSC_boss_lava_guard_gordoth() +{ + new at_lava_guard_gordoth_intro(); + + RegisterRagefireChasmCreatureAI(boss_lava_guard_gordoth); +} diff --git a/src/server/scripts/Kalimdor/RagefireChasm/boss_slagmaw.cpp b/src/server/scripts/Kalimdor/RagefireChasm/boss_slagmaw.cpp new file mode 100644 index 00000000..27c7bf8d --- /dev/null +++ b/src/server/scripts/Kalimdor/RagefireChasm/boss_slagmaw.cpp @@ -0,0 +1,166 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "Containers.h" +#include "InstanceScript.h" +#include "ScriptMgr.h" +#include "ScriptedCreature.h" +#include "ragefire_chasm.h" + +enum SlagmawSpells +{ + SPELL_LAVA_SPIT = 119434, + SPELL_MAGNAW_SUBMERGE = 120384, + SPELL_MAGNAW_TELEPORT_NORTH = 119424, // Serverside + SPELL_MAGNAW_TELEPORT_EAST = 119425, // Serverside + SPELL_MAGNAW_TELEPORT_SOUTH = 119426, // Serverside + SPELL_MAGNAW_TELEPORT_WEST = 119428 // Serverside +}; + +enum SlagmawEvents +{ + EVENT_LAVA_SPIT = 1, + EVENT_TELEPORT, + EVENT_EMERGE, + EVENT_BOUNDARY_CHECK, +}; + +std::array const SlagmawTeleportSpells = +{ + SPELL_MAGNAW_TELEPORT_NORTH, + SPELL_MAGNAW_TELEPORT_EAST, + SPELL_MAGNAW_TELEPORT_SOUTH, + SPELL_MAGNAW_TELEPORT_WEST +}; + +// 61463 - Slagmaw +struct boss_slagmaw : public BossAI +{ + boss_slagmaw(Creature* creature) : BossAI(creature, BOSS_SLAGMAW), _lavaSpitCounter(0), _lastTeleportSpell(SPELL_MAGNAW_TELEPORT_WEST) { } + + void Reset() override + { + _Reset(); + _lavaSpitCounter = 0; + _lastTeleportSpell = SPELL_MAGNAW_TELEPORT_WEST; + } + + void JustDied(Unit* /*killer*/) override + { + _JustDied(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + } + + void EnterEvadeMode() override + { + BossAI::EnterEvadeMode(); + _DespawnAtEvade(); + instance->SendEncounterUnit(ENCOUNTER_FRAME_DISENGAGE, me); + } + + void EnterCombat(Unit* who) override + { + BossAI::EnterCombat(who); + + instance->SendEncounterUnit(ENCOUNTER_FRAME_ENGAGE, me, 1); + + events.ScheduleEvent(EVENT_LAVA_SPIT, 1s); + events.ScheduleEvent(EVENT_BOUNDARY_CHECK, 2500ms); + } + + void HandleSubmergePhase() + { + DoCastSelf(SPELL_MAGNAW_SUBMERGE); + _lavaSpitCounter = 0; + + events.ScheduleEvent(EVENT_TELEPORT, 3s); + } + + uint32 GetNextTeleportSpell() + { + std::array teleportSpells = { }; + std::ranges::remove_copy(SlagmawTeleportSpells, teleportSpells.begin(), _lastTeleportSpell); + _lastTeleportSpell = Trinity::Containers::SelectRandomContainerElement(teleportSpells); + return _lastTeleportSpell; + } + + void UpdateAI(uint32 diff) override + { + if (!UpdateVictim()) + return; + + events.Update(diff); + + if (me->HasUnitState(UNIT_STATE_CASTING)) + return; + + switch (events.ExecuteEvent()) + { + case EVENT_LAVA_SPIT: + { + if (_lavaSpitCounter < 5) + { + if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) + { + DoCast(target, SPELL_LAVA_SPIT); + _lavaSpitCounter++; + } + events.RepeatEvent(1000); + break; + } + else if (_lavaSpitCounter == 5) + { + HandleSubmergePhase(); + break; + } + break; + } + case EVENT_TELEPORT: + { + DoCastSelf(GetNextTeleportSpell()); + events.ScheduleEvent(EVENT_EMERGE, 1s); + break; + } + case EVENT_EMERGE: + { + me->RemoveAurasDueToSpell(SPELL_MAGNAW_SUBMERGE); + events.ScheduleEvent(EVENT_LAVA_SPIT, 1s); + break; + } + case EVENT_BOUNDARY_CHECK: + { + if (me->getVictim()->GetDistance(me) > 50.0f) + EnterEvadeMode(); + events.ScheduleEvent(EVENT_BOUNDARY_CHECK, 2500ms); + break; + } + default: + break; + } + + DoMeleeAttackIfReady(); + } + +private: + uint8 _lavaSpitCounter; + uint32 _lastTeleportSpell; +}; + +void AddSC_boss_slagmaw() +{ + RegisterRagefireChasmCreatureAI(boss_slagmaw); +} diff --git a/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp b/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp new file mode 100644 index 00000000..9c5dc1fc --- /dev/null +++ b/src/server/scripts/Kalimdor/RagefireChasm/instance_ragefire_chasm.cpp @@ -0,0 +1,64 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#include "ScriptMgr.h" +#include "InstanceScript.h" +#include "ragefire_chasm.h" + +ObjectData const creatureData[] = +{ + { NPC_ADAROGG, BOSS_ADAROGG }, + { NPC_DARK_SHAMAN_KORANTHAL, BOSS_DARK_SHAMAN_KORANTHAL }, + { NPC_SLAGMAW, BOSS_SLAGMAW }, + { NPC_LAVA_GUARD_GORDOTH, BOSS_LAVA_GUARD_GORDOTH }, + { 0, 0 } // END +}; + +DungeonEncounterData const encounters[] = +{ + { BOSS_ADAROGG, {{ 1443 }} }, + { BOSS_DARK_SHAMAN_KORANTHAL, {{ 1444 }} }, + { BOSS_SLAGMAW, {{ 1445 }} }, + { BOSS_LAVA_GUARD_GORDOTH, {{ 1446 }} } +}; + +class instance_ragefire_chasm : public InstanceMapScript +{ +public: + instance_ragefire_chasm() : InstanceMapScript("instance_ragefire_chasm", 389) { } + + struct instance_ragefire_chasm_InstanceMapScript : public InstanceScript + { + instance_ragefire_chasm_InstanceMapScript(InstanceMap* map) : InstanceScript(map) + { + SetHeaders(DataHeader); + SetBossNumber(EncounterCount); + LoadObjectData(creatureData, nullptr); + LoadDungeonEncounterData(encounters); + } + }; + + InstanceScript* GetInstanceScript(InstanceMap* map) const override + { + return new instance_ragefire_chasm_InstanceMapScript(map); + } +}; + +void AddSC_instance_ragefire_chasm() +{ + new instance_ragefire_chasm(); +} diff --git a/src/server/scripts/Kalimdor/RagefireChasm/ragefire_chasm.h b/src/server/scripts/Kalimdor/RagefireChasm/ragefire_chasm.h new file mode 100644 index 00000000..9be5981e --- /dev/null +++ b/src/server/scripts/Kalimdor/RagefireChasm/ragefire_chasm.h @@ -0,0 +1,54 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see . + */ + +#ifndef _Ragefire_Chasm_h__ +#define _Ragefire_Chasm_h__ + +#include "CreatureAIImpl.h" + +constexpr char const* DataHeader = "RFC"; +constexpr char const* RfCScriptName = "instance_ragefire_chasm"; + +constexpr uint32 const EncounterCount = 4; + +enum RFCDataTypes +{ + // Encounters + BOSS_ADAROGG = 0, + BOSS_DARK_SHAMAN_KORANTHAL = 1, + BOSS_SLAGMAW = 2, + BOSS_LAVA_GUARD_GORDOTH = 3 +}; + +enum RFCCreatureIds +{ + // Bosses + NPC_ADAROGG = 61408, + NPC_DARK_SHAMAN_KORANTHAL = 61412, + NPC_SLAGMAW = 61463, + NPC_LAVA_GUARD_GORDOTH = 61528 +}; + +template +inline AI* GetRagefireChasmAI(T* obj) +{ + return GetInstanceAI(obj, RfCScriptName); +} + +#define RegisterRagefireChasmCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetRagefireChasmAI) + +#endif // _Ragefire_Chasm_h__ diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp index a8de3d0f..0af93836 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp +++ b/src/server/scripts/Kalimdor/RazorfenDowns/instance_razorfen_downs.cpp @@ -33,8 +33,9 @@ class instance_razorfen_downs : public InstanceMapScript struct instance_razorfen_downs_InstanceMapScript : public InstanceScript { - instance_razorfen_downs_InstanceMapScript(Map* map) : InstanceScript(map) + instance_razorfen_downs_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); } ObjectGuid uiGongGUID; @@ -54,49 +55,14 @@ class instance_razorfen_downs : public InstanceMapScript memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - - saveStream << "T C " << m_auiEncounter[0] - << ' ' << uiGongWaves; - - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; + data << uiGongWaves; } - void Load(const char* in) + void ReadSaveDataMore(std::istringstream& data) override { - if (!in) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(in); - - char dataHead1, dataHead2; - uint16 data0, data1; - - std::istringstream loadStream(in); - loadStream >> dataHead1 >> dataHead2 >> data0 >> data1; - - if (dataHead1 == 'T' && dataHead2 == 'C') - { - m_auiEncounter[0] = data0; - - for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) - if (m_auiEncounter[i] == IN_PROGRESS) - m_auiEncounter[i] = NOT_STARTED; - - uiGongWaves = data1; - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + data >> uiGongWaves; } void OnGameObjectCreate(GameObject* go) diff --git a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h index ef3f0a22..869f0c82 100644 --- a/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h +++ b/src/server/scripts/Kalimdor/RazorfenDowns/razorfen_downs.h @@ -18,6 +18,8 @@ #ifndef DEF_RAZORFEN_DOWNS_H #define DEF_RAZORFEN_DOWNS_H +#define DataHeader "RFD" + enum eData { BOSS_TUTEN_KASH, diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp index 6fbd0002..36d7fd6b 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp +++ b/src/server/scripts/Kalimdor/RazorfenKraul/instance_razorfen_kraul.cpp @@ -41,13 +41,14 @@ class instance_razorfen_kraul : public InstanceMapScript struct instance_razorfen_kraul_InstanceMapScript : public InstanceScript { - instance_razorfen_kraul_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_razorfen_kraul_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} ObjectGuid DoorWardGUID; int WardKeeperDeath; void Initialize() { + SetHeaders(DataHeader); WardKeeperDeath = 0; DoorWardGUID.Clear(); } diff --git a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h index abc1afb5..35a45952 100644 --- a/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h +++ b/src/server/scripts/Kalimdor/RazorfenKraul/razorfen_kraul.h @@ -19,5 +19,7 @@ #ifndef DEF_RAZORFEN_KRAUL_H #define DEF_RAZORFEN_KRAUL_H +#define DataHeader "RFK" + #define EVENT_WARD_KEEPER 1 #endif diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp index 003847c7..ce880721 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/instance_ruins_of_ahnqiraj.cpp @@ -27,8 +27,9 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript struct instance_ruins_of_ahnqiraj_InstanceMapScript : public InstanceScript { - instance_ruins_of_ahnqiraj_InstanceMapScript(Map* map) : InstanceScript(map) + instance_ruins_of_ahnqiraj_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); _kurinaxxGUID.Clear(); @@ -146,49 +147,6 @@ class instance_ruins_of_ahnqiraj : public InstanceMapScript return ObjectGuid::Empty; } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "R A" << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(char const* data) - { - 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 == 'R' && dataHead2 == 'A') - { - 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, EncounterState(tmpState)); - } - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - private: ObjectGuid _kurinaxxGUID; ObjectGuid _rajaxxGUID; diff --git a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h index b34b4b1b..9fab77c3 100644 --- a/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h +++ b/src/server/scripts/Kalimdor/RuinsOfAhnQiraj/ruins_of_ahnqiraj.h @@ -18,6 +18,8 @@ #ifndef DEF_RUINS_OF_AHNQIRAJ_H #define DEF_RUINS_OF_AHNQIRAJ_H +#define DataHeader "RA" + enum Encounters { BOSS_KURINNAXX = 0, diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp index 8fe9fe7e..1bef7ac5 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/instance_temple_of_ahnqiraj.cpp @@ -40,7 +40,7 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript struct instance_temple_of_ahnqiraj_InstanceMapScript : public InstanceScript { - instance_temple_of_ahnqiraj_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_temple_of_ahnqiraj_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} //If Vem is dead... bool IsBossDied[3]; @@ -64,6 +64,8 @@ class instance_temple_of_ahnqiraj : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); + IsBossDied[0] = false; IsBossDied[1] = false; IsBossDied[2] = false; diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h index 13c3d56d..e1340298 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/temple_of_ahnqiraj.h @@ -19,6 +19,8 @@ #ifndef DEF_TEMPLE_OF_AHNQIRAJ_H #define DEF_TEMPLE_OF_AHNQIRAJ_H +#define DataHeader "TA" + #define DATA_SKERAM 1 #define DATA_KRI 2 #define DATA_VEM 3 diff --git a/src/server/scripts/Kalimdor/TheVortexPinnacle/instance_the_vortex_pinnacle.cpp b/src/server/scripts/Kalimdor/TheVortexPinnacle/instance_the_vortex_pinnacle.cpp index a464312f..92d35215 100644 --- a/src/server/scripts/Kalimdor/TheVortexPinnacle/instance_the_vortex_pinnacle.cpp +++ b/src/server/scripts/Kalimdor/TheVortexPinnacle/instance_the_vortex_pinnacle.cpp @@ -23,6 +23,7 @@ class instance_the_vortex_pinnacle : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); uiGrandVizierErtanGUID.Clear(); uiAltairusGUID.Clear(); @@ -87,50 +88,6 @@ class instance_the_vortex_pinnacle : public InstanceMapScript } return ObjectGuid::Empty; } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::string str_data; - std::ostringstream saveStream; - saveStream << "V P" << GetBossSaveData(); - str_data = saveStream.str(); - - OUT_SAVE_INST_DATA_COMPLETE; - return str_data; - } - - 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 < 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } }; }; diff --git a/src/server/scripts/Kalimdor/TheVortexPinnacle/the_vortex_pinnacle.h b/src/server/scripts/Kalimdor/TheVortexPinnacle/the_vortex_pinnacle.h index bb9fb0e1..72f55ef8 100644 --- a/src/server/scripts/Kalimdor/TheVortexPinnacle/the_vortex_pinnacle.h +++ b/src/server/scripts/Kalimdor/TheVortexPinnacle/the_vortex_pinnacle.h @@ -1,6 +1,7 @@ #ifndef DEF_VORTEX_PINNACLE_H #define DEF_VORTEX_PINNACLE_H +#define DataHeader "VP" #define VPScriptName "instance_the_vortex_pinnacle" enum Data diff --git a/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/instance_throne_of_the_four_winds.cpp b/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/instance_throne_of_the_four_winds.cpp index 202faaf9..1c36e16b 100644 --- a/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/instance_throne_of_the_four_winds.cpp +++ b/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/instance_throne_of_the_four_winds.cpp @@ -26,6 +26,7 @@ class instance_throne_of_the_four_winds : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); uiAnshal.Clear(); uiNezir.Clear(); uiRohash.Clear(); diff --git a/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/throne_of_the_four_winds.h b/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/throne_of_the_four_winds.h index a673b16e..d7155b61 100644 --- a/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/throne_of_the_four_winds.h +++ b/src/server/scripts/Kalimdor/ThroneOfTheFourWinds/throne_of_the_four_winds.h @@ -1,6 +1,8 @@ #ifndef DEF_THRONEOFTHEFOURWINDS_H #define DEF_THRONEOFTHEFOURWINDS_H +#define DataHeader "TW" + enum Data { DATA_CONCLAVE_OF_WIND_EVENT, diff --git a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp index ad921490..a77913f3 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp +++ b/src/server/scripts/Kalimdor/WailingCaverns/instance_wailing_caverns.cpp @@ -41,7 +41,7 @@ class instance_wailing_caverns : public InstanceMapScript struct instance_wailing_caverns_InstanceMapScript : public InstanceScript { - instance_wailing_caverns_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_wailing_caverns_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; @@ -50,6 +50,7 @@ class instance_wailing_caverns : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); yelled = false; diff --git a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h index 071f318e..4bc6d41e 100644 --- a/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h +++ b/src/server/scripts/Kalimdor/WailingCaverns/wailing_caverns.h @@ -19,6 +19,8 @@ #ifndef DEF_WAILING_CAVERNS_H #define DEF_WAILING_CAVERNS_H +#define DataHeader "WC" + enum eTypes { TYPE_LORD_COBRAHN = 1, diff --git a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp index d9c408dd..d430fcb2 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp +++ b/src/server/scripts/Kalimdor/ZulFarrak/instance_zulfarrak.cpp @@ -100,7 +100,7 @@ class instance_zulfarrak : public InstanceMapScript struct instance_zulfarrak_InstanceMapScript : public InstanceScript { - instance_zulfarrak_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_zulfarrak_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 GahzRillaEncounter; ObjectGuid ZumrahGUID; @@ -118,6 +118,7 @@ class instance_zulfarrak : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); GahzRillaEncounter = NOT_STARTED; ZumrahGUID.Clear(); BlyGUID.Clear(); diff --git a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h index dfda6ef2..1cbb6efa 100644 --- a/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h +++ b/src/server/scripts/Kalimdor/ZulFarrak/zulfarrak.h @@ -5,6 +5,8 @@ #ifndef DEF_ZF_H #define DEF_ZF_H +#define DataHeader "ZF" + enum zfEntries { ENTRY_ZUMRAH = 7271, diff --git a/src/server/scripts/Legion/AntorusTheBurningThrone/antorus.h b/src/server/scripts/Legion/AntorusTheBurningThrone/antorus.h index ca0543c1..2ad500c8 100644 --- a/src/server/scripts/Legion/AntorusTheBurningThrone/antorus.h +++ b/src/server/scripts/Legion/AntorusTheBurningThrone/antorus.h @@ -1,6 +1,8 @@ #ifndef AntorusH_ #define AntorusH_ +#define DataHeader "ATBT" + enum eData { DATA_WORLDBREAKER = 0, diff --git a/src/server/scripts/Legion/AntorusTheBurningThrone/instance_antorus.cpp b/src/server/scripts/Legion/AntorusTheBurningThrone/instance_antorus.cpp index aae375f8..6f559733 100644 --- a/src/server/scripts/Legion/AntorusTheBurningThrone/instance_antorus.cpp +++ b/src/server/scripts/Legion/AntorusTheBurningThrone/instance_antorus.cpp @@ -79,8 +79,9 @@ class instance_antorus : public InstanceMapScript struct instance_antorus_InstanceMapScript : InstanceScript { - explicit instance_antorus_InstanceMapScript(Map* map) : InstanceScript(map) + explicit instance_antorus_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } @@ -490,46 +491,6 @@ class instance_antorus : public InstanceMapScript return true; } - std::string GetSaveData() override - { - std::ostringstream saveStream; - saveStream << "A T B T " << GetBossSaveData(); - return saveStream.str(); - } - - void Load(const char* data) override - { - if (!data) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(data); - - char dataHead1, dataHead2, dataHead3, dataHead4; - - std::istringstream loadStream(data); - loadStream >> dataHead1 >> dataHead2 >> dataHead3 >> dataHead4; - - if (dataHead1 == 'A' && dataHead2 == 'T' && dataHead3 == 'B' && dataHead4 == 'T') - { - for (uint32 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; - - OUT_LOAD_INST_DATA_COMPLETE; - - } - WorldLocation* GetClosestGraveYard(float x, float y, float z) override { Position playerPosition(x, y, z); diff --git a/src/server/scripts/Legion/BlackRookHoldDungeon/black_rook_hold_dungeon.h b/src/server/scripts/Legion/BlackRookHoldDungeon/black_rook_hold_dungeon.h index 15747869..027248da 100644 --- a/src/server/scripts/Legion/BlackRookHoldDungeon/black_rook_hold_dungeon.h +++ b/src/server/scripts/Legion/BlackRookHoldDungeon/black_rook_hold_dungeon.h @@ -5,6 +5,8 @@ #ifndef BLACK_ROOK_HOLD_DUNGEON_H_ #define BLACK_ROOK_HOLD_DUNGEON_H_ +#define DataHeader "BRH" + enum eData { DATA_AMALGAM = 0, diff --git a/src/server/scripts/Legion/BlackRookHoldDungeon/instance_black_rook_hold_dungeon.cpp b/src/server/scripts/Legion/BlackRookHoldDungeon/instance_black_rook_hold_dungeon.cpp index 768fda0d..a4667fce 100644 --- a/src/server/scripts/Legion/BlackRookHoldDungeon/instance_black_rook_hold_dungeon.cpp +++ b/src/server/scripts/Legion/BlackRookHoldDungeon/instance_black_rook_hold_dungeon.cpp @@ -31,8 +31,9 @@ class instance_black_rook_hold_dungeon : public InstanceMapScript struct instance_black_rook_hold_dungeon_InstanceMapScript : public InstanceScript { - instance_black_rook_hold_dungeon_InstanceMapScript(Map* map) : InstanceScript(map) + instance_black_rook_hold_dungeon_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } @@ -194,43 +195,14 @@ class instance_black_rook_hold_dungeon : public InstanceMapScript return &loc_res_pla; } - std::string GetSaveData() override + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; - saveStream << "B R H " << GetBossSaveData() << " " << AmalgamState << " " << illysannaIntroState; - return saveStream.str(); + data << AmalgamState << " " << illysannaIntroState; } - void Load(const char* data) override + void ReadSaveDataMore(std::istringstream& data) override { - if (!data) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(data); - - char dataHead1, dataHead2, dataHead3; - std::istringstream loadStream(data); - loadStream >> dataHead1 >> dataHead2 >> dataHead3; - - if (dataHead1 == 'B' && dataHead2 == 'R' && dataHead3 == 'H') - { - for (uint32 i = 0; i < MAX_ENCOUNTER; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - loadStream >> AmalgamState >> illysannaIntroState; - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + data >> AmalgamState >> illysannaIntroState; } bool HasPlayerUpperThan(float minZ) diff --git a/src/server/scripts/Legion/CathedralEternalNight/cathedral_of_eternal_night.h b/src/server/scripts/Legion/CathedralEternalNight/cathedral_of_eternal_night.h index d47b9b62..44f60f85 100644 --- a/src/server/scripts/Legion/CathedralEternalNight/cathedral_of_eternal_night.h +++ b/src/server/scripts/Legion/CathedralEternalNight/cathedral_of_eternal_night.h @@ -4,6 +4,8 @@ #ifndef CATHEDRAL_OF_ETERNAL_NIGHT_H_ #define CATHEDRAL_OF_ETERNAL_NIGHT_H_ +#define DataHeader "CEN" + enum eData { DATA_AGRONOX = 0, diff --git a/src/server/scripts/Legion/CathedralEternalNight/instance_cathedral_of_eternal_night.cpp b/src/server/scripts/Legion/CathedralEternalNight/instance_cathedral_of_eternal_night.cpp index ab099d1d..74cde414 100644 --- a/src/server/scripts/Legion/CathedralEternalNight/instance_cathedral_of_eternal_night.cpp +++ b/src/server/scripts/Legion/CathedralEternalNight/instance_cathedral_of_eternal_night.cpp @@ -21,8 +21,9 @@ class instance_cathedral_of_eternal_night : public InstanceMapScript struct instance_cathedral_of_eternal_night_InstanceMapScript : public InstanceScript { - instance_cathedral_of_eternal_night_InstanceMapScript(Map* map) : InstanceScript(map) + instance_cathedral_of_eternal_night_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/CourtofStars/court_of_stars.h b/src/server/scripts/Legion/CourtofStars/court_of_stars.h index 7a34846e..80c5341d 100644 --- a/src/server/scripts/Legion/CourtofStars/court_of_stars.h +++ b/src/server/scripts/Legion/CourtofStars/court_of_stars.h @@ -5,6 +5,8 @@ #ifndef COURT_OF_STARS_H_ #define COURT_OF_STARS_H_ +#define DataHeader "COS" + enum eData { DATA_CAPTAIN_GERDO = 0, diff --git a/src/server/scripts/Legion/CourtofStars/instance_court_of_stars.cpp b/src/server/scripts/Legion/CourtofStars/instance_court_of_stars.cpp index c70523f0..573be711 100644 --- a/src/server/scripts/Legion/CourtofStars/instance_court_of_stars.cpp +++ b/src/server/scripts/Legion/CourtofStars/instance_court_of_stars.cpp @@ -24,8 +24,9 @@ class instance_court_of_stars : public InstanceMapScript struct instance_court_of_stars_InstanceMapScript : public InstanceScript { - instance_court_of_stars_InstanceMapScript(Map* map) : InstanceScript(map) + instance_court_of_stars_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/DarkHeartThicket/darkheart_thicket.h b/src/server/scripts/Legion/DarkHeartThicket/darkheart_thicket.h index 0f761833..ad19011c 100644 --- a/src/server/scripts/Legion/DarkHeartThicket/darkheart_thicket.h +++ b/src/server/scripts/Legion/DarkHeartThicket/darkheart_thicket.h @@ -5,6 +5,8 @@ #ifndef DARKHEART_THICKET_H_ #define DARKHEART_THICKET_H_ +#define DataHeader "DHT" + enum eData { DATA_GLAIDALIS = 0, diff --git a/src/server/scripts/Legion/DarkHeartThicket/instance_darkheart_thicket.cpp b/src/server/scripts/Legion/DarkHeartThicket/instance_darkheart_thicket.cpp index ef89c15e..2af2960e 100644 --- a/src/server/scripts/Legion/DarkHeartThicket/instance_darkheart_thicket.cpp +++ b/src/server/scripts/Legion/DarkHeartThicket/instance_darkheart_thicket.cpp @@ -23,8 +23,9 @@ class instance_darkheart_thicket : public InstanceMapScript struct instance_darkheart_thicket_InstanceMapScript : public InstanceScript { - instance_darkheart_thicket_InstanceMapScript(Map* map) : InstanceScript(map) + instance_darkheart_thicket_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/EyeofAzshara/eye_of_azshara.h b/src/server/scripts/Legion/EyeofAzshara/eye_of_azshara.h index 4f1660a1..eadcdfb7 100644 --- a/src/server/scripts/Legion/EyeofAzshara/eye_of_azshara.h +++ b/src/server/scripts/Legion/EyeofAzshara/eye_of_azshara.h @@ -5,6 +5,8 @@ #ifndef EYE_OF_AZSHARA_H_ #define EYE_OF_AZSHARA_H_ +#define DataHeader "EOA" + enum eData { DATA_PARJESH = 0, diff --git a/src/server/scripts/Legion/EyeofAzshara/instance_eye_of_azshara.cpp b/src/server/scripts/Legion/EyeofAzshara/instance_eye_of_azshara.cpp index e86ad630..1479bef1 100644 --- a/src/server/scripts/Legion/EyeofAzshara/instance_eye_of_azshara.cpp +++ b/src/server/scripts/Legion/EyeofAzshara/instance_eye_of_azshara.cpp @@ -44,8 +44,9 @@ class instance_eye_of_azshara : public InstanceMapScript struct instance_eye_of_azshara_InstanceMapScript : public InstanceScript { - instance_eye_of_azshara_InstanceMapScript(Map* map) : InstanceScript(map) + instance_eye_of_azshara_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/HallsofValor/halls_of_valor.h b/src/server/scripts/Legion/HallsofValor/halls_of_valor.h index 87ccaeb2..e2092217 100644 --- a/src/server/scripts/Legion/HallsofValor/halls_of_valor.h +++ b/src/server/scripts/Legion/HallsofValor/halls_of_valor.h @@ -5,6 +5,8 @@ #ifndef HALLS_OF_VALOR_H_ #define HALLS_OF_VALOR_H_ +#define DataHeader "HOV" + enum eData { DATA_HYMDALL = 0, diff --git a/src/server/scripts/Legion/HallsofValor/instance_halls_of_valor.cpp b/src/server/scripts/Legion/HallsofValor/instance_halls_of_valor.cpp index 879d90b6..7810a4af 100644 --- a/src/server/scripts/Legion/HallsofValor/instance_halls_of_valor.cpp +++ b/src/server/scripts/Legion/HallsofValor/instance_halls_of_valor.cpp @@ -31,7 +31,7 @@ class instance_halls_of_valor : public InstanceMapScript struct instance_halls_of_valor_InstanceMapScript : public InstanceScript { - instance_halls_of_valor_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_halls_of_valor_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; @@ -56,6 +56,7 @@ class instance_halls_of_valor : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); LoadDoorData(doorData); @@ -327,49 +328,15 @@ class instance_halls_of_valor : public InstanceMapScript checkTimerAura -= diff; } - std::string GetSaveData() override + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "H V " << GetBossSaveData() << fenryrEventDone << " " << skovaldEventDone << " "; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); + data << fenryrEventDone << " " << skovaldEventDone; } - void Load(const char* in) override + void ReadSaveDataMore(std::istringstream& data) override { - 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 == 'H' && dataHead2 == 'V') - { - 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)); - } - - loadStream >> fenryrEventDone; - loadStream >> skovaldEventDone; - - } else OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + data >> fenryrEventDone; + data >> skovaldEventDone; } WorldLocation* GetClosestGraveYard(float x, float y, float z) override diff --git a/src/server/scripts/Legion/MawofSouls/instance_maw_of_souls.cpp b/src/server/scripts/Legion/MawofSouls/instance_maw_of_souls.cpp index 19307192..0da8cbf8 100644 --- a/src/server/scripts/Legion/MawofSouls/instance_maw_of_souls.cpp +++ b/src/server/scripts/Legion/MawofSouls/instance_maw_of_souls.cpp @@ -28,8 +28,9 @@ class instance_maw_of_souls : public InstanceMapScript struct instance_maw_of_souls_InstanceMapScript : public InstanceScript { - instance_maw_of_souls_InstanceMapScript(Map* map) : InstanceScript(map) + instance_maw_of_souls_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/MawofSouls/maw_of_souls.h b/src/server/scripts/Legion/MawofSouls/maw_of_souls.h index 722cb6a5..370abd01 100644 --- a/src/server/scripts/Legion/MawofSouls/maw_of_souls.h +++ b/src/server/scripts/Legion/MawofSouls/maw_of_souls.h @@ -5,6 +5,8 @@ #ifndef MAW_OF_SOULS_H_ #define MAW_OF_SOULS_H_ +#define DataHeader "MOS" + enum eData { DATA_YMIRON = 0, diff --git a/src/server/scripts/Legion/MicroHolidays/TrialofStyle.cpp b/src/server/scripts/Legion/MicroHolidays/TrialofStyle.cpp index d3e2ba83..75c0652f 100644 --- a/src/server/scripts/Legion/MicroHolidays/TrialofStyle.cpp +++ b/src/server/scripts/Legion/MicroHolidays/TrialofStyle.cpp @@ -1298,7 +1298,7 @@ class instance_trial_of_style : public InstanceMapScript struct instance_trial_of_style_InstanceMapScript : public InstanceScript { - instance_trial_of_style_InstanceMapScript(Map* map) : InstanceScript(map) + instance_trial_of_style_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/NeltharionsLair/instance_neltharions_lair.cpp b/src/server/scripts/Legion/NeltharionsLair/instance_neltharions_lair.cpp index d435bcb7..e30897e5 100644 --- a/src/server/scripts/Legion/NeltharionsLair/instance_neltharions_lair.cpp +++ b/src/server/scripts/Legion/NeltharionsLair/instance_neltharions_lair.cpp @@ -26,8 +26,9 @@ class instance_neltharions_lair : public InstanceMapScript struct instance_neltharions_lair_InstanceMapScript : public InstanceScript { - instance_neltharions_lair_InstanceMapScript(Map* map) : InstanceScript(map) + instance_neltharions_lair_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/NeltharionsLair/neltharions_lair.h b/src/server/scripts/Legion/NeltharionsLair/neltharions_lair.h index f7013d91..1395c839 100644 --- a/src/server/scripts/Legion/NeltharionsLair/neltharions_lair.h +++ b/src/server/scripts/Legion/NeltharionsLair/neltharions_lair.h @@ -5,6 +5,8 @@ #ifndef NELTHARIONS_LAIR_H_ #define NELTHARIONS_LAIR_H_ +#define DataHeader "NL" + enum eData { DATA_ROKMORA = 0, diff --git a/src/server/scripts/Legion/ReturnToKarazhan/instance_return_to_karazhan.cpp b/src/server/scripts/Legion/ReturnToKarazhan/instance_return_to_karazhan.cpp index 86533049..db625f74 100644 --- a/src/server/scripts/Legion/ReturnToKarazhan/instance_return_to_karazhan.cpp +++ b/src/server/scripts/Legion/ReturnToKarazhan/instance_return_to_karazhan.cpp @@ -28,8 +28,9 @@ class instance_return_to_karazhan : public InstanceMapScript struct instance_return_to_karazhan_InstanceMapScript : public InstanceScript { - instance_return_to_karazhan_InstanceMapScript(Map* map) : InstanceScript(map) + instance_return_to_karazhan_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } @@ -519,47 +520,14 @@ class instance_return_to_karazhan : public InstanceMapScript } } - std::string GetSaveData() override + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; - saveStream << "R K " << GetBossSaveData() << OperaHallScene << ' ' << dataPH2Door; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); + data << OperaHallScene << ' ' << dataPH2Door; } - void Load(const char* data) override + void ReadSaveDataMore(std::istringstream& 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 == 'R' && dataHead2 == 'K') - { - for (uint32 i = 0; i < MAX_ENCOUNTER; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - - loadStream >> OperaHallScene >> dataPH2Door; - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + data >> OperaHallScene >> dataPH2Door; } WorldLocation* GetClosestGraveYard(float x, float y, float z) override diff --git a/src/server/scripts/Legion/ReturnToKarazhan/return_to_karazhan.h b/src/server/scripts/Legion/ReturnToKarazhan/return_to_karazhan.h index b47ecfa9..867164be 100644 --- a/src/server/scripts/Legion/ReturnToKarazhan/return_to_karazhan.h +++ b/src/server/scripts/Legion/ReturnToKarazhan/return_to_karazhan.h @@ -3,6 +3,8 @@ #include "PrecompiledHeaders/ScriptPCH.h" +#define DataHeader "RKZ" + enum eData { DATA_OPERA_HALL = 0, diff --git a/src/server/scripts/Legion/TheArcway/instance_the_arcway.cpp b/src/server/scripts/Legion/TheArcway/instance_the_arcway.cpp index b151a724..cc0d5961 100644 --- a/src/server/scripts/Legion/TheArcway/instance_the_arcway.cpp +++ b/src/server/scripts/Legion/TheArcway/instance_the_arcway.cpp @@ -29,8 +29,9 @@ class instance_the_arcway : public InstanceMapScript struct instance_the_arcway_InstanceMapScript : public InstanceScript { - instance_the_arcway_InstanceMapScript(Map* map) : InstanceScript(map) + instance_the_arcway_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/TheArcway/the_arcway.h b/src/server/scripts/Legion/TheArcway/the_arcway.h index 653b9e71..dae9ac06 100644 --- a/src/server/scripts/Legion/TheArcway/the_arcway.h +++ b/src/server/scripts/Legion/TheArcway/the_arcway.h @@ -5,6 +5,8 @@ #ifndef THE_ARCWAY_H_ #define THE_ARCWAY_H_ +#define DataHeader "AW" + enum eData { DATA_IVANYR = 0, diff --git a/src/server/scripts/Legion/TheEmeraldNightmare/instance_the_emerald_nightmare.cpp b/src/server/scripts/Legion/TheEmeraldNightmare/instance_the_emerald_nightmare.cpp index 8f17ec37..18ed3e38 100644 --- a/src/server/scripts/Legion/TheEmeraldNightmare/instance_the_emerald_nightmare.cpp +++ b/src/server/scripts/Legion/TheEmeraldNightmare/instance_the_emerald_nightmare.cpp @@ -43,8 +43,9 @@ class instance_the_emerald_nightmare : public InstanceMapScript struct instance_the_emerald_nightmare_InstanceMapScript : public InstanceScript { - instance_the_emerald_nightmare_InstanceMapScript(Map* map) : InstanceScript(map) + instance_the_emerald_nightmare_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } @@ -254,46 +255,6 @@ class instance_the_emerald_nightmare : public InstanceMapScript } } - std::string GetSaveData() override - { - std::ostringstream saveStream; - saveStream << "E N " << GetBossSaveData(); - return saveStream.str(); - } - - void Load(const char* 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 == 'E' && dataHead2 == 'N') - { - for (uint32 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; - - OUT_LOAD_INST_DATA_COMPLETE; - - } - bool CheckFirstBosses() { if (GetBossState(DATA_NYTHENDRA) == DONE && diff --git a/src/server/scripts/Legion/TheEmeraldNightmare/the_emerald_nightmare.h b/src/server/scripts/Legion/TheEmeraldNightmare/the_emerald_nightmare.h index 1c1c829e..d53d9644 100644 --- a/src/server/scripts/Legion/TheEmeraldNightmare/the_emerald_nightmare.h +++ b/src/server/scripts/Legion/TheEmeraldNightmare/the_emerald_nightmare.h @@ -1,6 +1,8 @@ #ifndef THE_EMERALD_NIGHTMARE_H_ #define THE_EMERALD_NIGHTMARE_H_ +#define DataHeader "EN" + enum eData { DATA_NYTHENDRA = 0, diff --git a/src/server/scripts/Legion/TheNighthold/instance_the_nighthold.cpp b/src/server/scripts/Legion/TheNighthold/instance_the_nighthold.cpp index bef2dc85..a995ca54 100644 --- a/src/server/scripts/Legion/TheNighthold/instance_the_nighthold.cpp +++ b/src/server/scripts/Legion/TheNighthold/instance_the_nighthold.cpp @@ -75,8 +75,9 @@ class instance_the_nightnold : public InstanceMapScript struct instance_the_nightnold_InstanceMapScript : InstanceScript { - explicit instance_the_nightnold_InstanceMapScript(Map* map) : InstanceScript(map) + explicit instance_the_nightnold_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } @@ -406,45 +407,14 @@ class instance_the_nightnold : public InstanceMapScript return true; } - std::string GetSaveData() override + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; - saveStream << "N H " << GetBossSaveData() << trilliaxIntro << KrosusIntroTrash; - return saveStream.str(); + data << trilliaxIntro << " " << KrosusIntroTrash; } - void Load(const char* data) override + void ReadSaveDataMore(std::istringstream& 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 == 'N' && dataHead2 == 'H') - { - for (uint32 i = 0; i < MAX_ENCOUNTER; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - loadStream >> trilliaxIntro >> KrosusIntroTrash; - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - + data >> trilliaxIntro >> KrosusIntroTrash; } WorldLocation* GetClosestGraveYard(float x, float y, float z) override diff --git a/src/server/scripts/Legion/TheNighthold/the_nighthold.h b/src/server/scripts/Legion/TheNighthold/the_nighthold.h index efb64c24..8717fd6a 100644 --- a/src/server/scripts/Legion/TheNighthold/the_nighthold.h +++ b/src/server/scripts/Legion/TheNighthold/the_nighthold.h @@ -1,6 +1,8 @@ #ifndef ThiNightholdH_ #define ThiNightholdH_ +#define DataHeader "NH" + enum eData { DATA_SKORPYRON = 0, diff --git a/src/server/scripts/Legion/TheSeatOfTheTriumvirate/instance_the_seat_of_the_triumvirate.cpp b/src/server/scripts/Legion/TheSeatOfTheTriumvirate/instance_the_seat_of_the_triumvirate.cpp index 365bd01f..abed5fea 100644 --- a/src/server/scripts/Legion/TheSeatOfTheTriumvirate/instance_the_seat_of_the_triumvirate.cpp +++ b/src/server/scripts/Legion/TheSeatOfTheTriumvirate/instance_the_seat_of_the_triumvirate.cpp @@ -24,8 +24,9 @@ class instance_seat_of_the_triumvirate : public InstanceMapScript struct instance_seat_of_the_triumvirate_InstanceMapScript : public InstanceScript { - instance_seat_of_the_triumvirate_InstanceMapScript(Map* map) : InstanceScript(map) + instance_seat_of_the_triumvirate_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } @@ -161,45 +162,14 @@ class instance_seat_of_the_triumvirate : public InstanceMapScript } } - std::string GetSaveData() override + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; - saveStream << "S O T " << GetBossSaveData() << luraIntro << saprishPortals; - return saveStream.str(); + data << luraIntro << " " << saprishPortals; } - void Load(const char* data) override + void ReadSaveDataMore(std::istringstream& data) override { - if (!data) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(data); - - char dataHead1, dataHead2, dataHead3; - - std::istringstream loadStream(data); - loadStream >> dataHead1 >> dataHead2 >> dataHead3; - - if (dataHead1 == 'S' && dataHead2 == 'O' && dataHead3 == 'T') - { - for (uint32 i = 0; i < MAX_ENCOUNTER; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - loadStream >> saprishPortals >> luraIntro; - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - + data >> luraIntro >> saprishPortals; } void OnPlayerEnter(Player* player) override diff --git a/src/server/scripts/Legion/TheSeatOfTheTriumvirate/the_seat_of_the_triumvirate.h b/src/server/scripts/Legion/TheSeatOfTheTriumvirate/the_seat_of_the_triumvirate.h index 03708023..4e357fd4 100644 --- a/src/server/scripts/Legion/TheSeatOfTheTriumvirate/the_seat_of_the_triumvirate.h +++ b/src/server/scripts/Legion/TheSeatOfTheTriumvirate/the_seat_of_the_triumvirate.h @@ -5,6 +5,8 @@ #ifndef SEAT_OF_THE_TRIUMVIRATE_H_ #define SEAT_OF_THE_TRIUMVIRATE_H_ +#define DataHeader "SOTT" + enum eData { DATA_ZURAAL = 0, diff --git a/src/server/scripts/Legion/TombOfSargeras/instance_tomb_of_sargeras.cpp b/src/server/scripts/Legion/TombOfSargeras/instance_tomb_of_sargeras.cpp index a4e9603d..67aae43c 100644 --- a/src/server/scripts/Legion/TombOfSargeras/instance_tomb_of_sargeras.cpp +++ b/src/server/scripts/Legion/TombOfSargeras/instance_tomb_of_sargeras.cpp @@ -124,12 +124,12 @@ class instance_tomb_of_sargeras : public InstanceMapScript struct instance_tomb_of_sargeras_InstanceMapScript : InstanceScript { - instance_tomb_of_sargeras_InstanceMapScript(Map* map) : InstanceScript(map) + instance_tomb_of_sargeras_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } - std::vector addsIntro{}; std::set lunarArchersEvent{}; WorldLocation loc_res_pla{}; @@ -484,46 +484,6 @@ class instance_tomb_of_sargeras : public InstanceMapScript return &loc_res_pla; } - std::string GetSaveData() override - { - std::ostringstream saveStream; - saveStream << "T O S " << GetBossSaveData(); - return saveStream.str(); - } - - void Load(const char* data) override - { - if (!data) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(data); - - char dataHead1, dataHead2, dataHead3; - - std::istringstream loadStream(data); - loadStream >> dataHead1 >> dataHead2 >> dataHead3; - - if (dataHead1 == 'T' && dataHead2 == 'O' && dataHead3 == 'S') - { - for (uint32 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; - - OUT_LOAD_INST_DATA_COMPLETE; - - } - void Update(uint32 diff) override { if (checkTimer <= diff) diff --git a/src/server/scripts/Legion/TombOfSargeras/tomb_of_sargeras.h b/src/server/scripts/Legion/TombOfSargeras/tomb_of_sargeras.h index f8fd19e0..ac634e43 100644 --- a/src/server/scripts/Legion/TombOfSargeras/tomb_of_sargeras.h +++ b/src/server/scripts/Legion/TombOfSargeras/tomb_of_sargeras.h @@ -1,6 +1,8 @@ #ifndef TombOsSargeasH_ #define TombOsSargeasH_ +#define DataHeader "TOS" + enum eData { DATA_GOROTH = 0, diff --git a/src/server/scripts/Legion/TrialOfValor/instance_trial_of_valor.cpp b/src/server/scripts/Legion/TrialOfValor/instance_trial_of_valor.cpp index c3021ac4..a561cc8f 100644 --- a/src/server/scripts/Legion/TrialOfValor/instance_trial_of_valor.cpp +++ b/src/server/scripts/Legion/TrialOfValor/instance_trial_of_valor.cpp @@ -56,8 +56,9 @@ class instance_trial_of_valor : public InstanceMapScript uint32 checkTimer = 1000; uint32 checkTimerAura = 1000; - explicit instance_trial_of_valor_InstanceMapScript(Map* map) : InstanceScript(map) + explicit instance_trial_of_valor_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(Data::BossIDs::Max); } @@ -410,46 +411,14 @@ class instance_trial_of_valor : public InstanceMapScript return &loc_res_pla; } - std::string GetSaveData() override + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; - saveStream << "T O V " << GetBossSaveData() << OdynIntroEvent << OdynEvadeComplete; - return saveStream.str(); + data << OdynIntroEvent << " " << OdynEvadeComplete; } - void Load(const char* data) override + void ReadSaveDataMore(std::istringstream& data) override { - if (!data) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(data); - - char dataHead1, dataHead2, dataHead3; - std::istringstream loadStream(data); - loadStream >> dataHead1 >> dataHead2 >> dataHead3; - - if (dataHead1 == 'T' && dataHead2 == 'O' && dataHead3 == 'V') - { - for (uint32 i = 0; i < Data::BossIDs::Max; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - - SetBossState(i, EncounterState(tmpState)); - } - - loadStream >> OdynIntroEvent >> OdynEvadeComplete; - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + data >> OdynIntroEvent >> OdynEvadeComplete; } }; }; diff --git a/src/server/scripts/Legion/TrialOfValor/trial_of_valor.h b/src/server/scripts/Legion/TrialOfValor/trial_of_valor.h index 512d7cd3..d36441f0 100644 --- a/src/server/scripts/Legion/TrialOfValor/trial_of_valor.h +++ b/src/server/scripts/Legion/TrialOfValor/trial_of_valor.h @@ -1,6 +1,8 @@ #ifndef TrialOfValorH_ #define TrialOfValorH_ +#define DataHeader "TOV" + namespace Data { enum BossIDs diff --git a/src/server/scripts/Legion/VaultoftheWardens/instance_vault_of_the_wardens.cpp b/src/server/scripts/Legion/VaultoftheWardens/instance_vault_of_the_wardens.cpp index 5bc5969c..4e788d89 100644 --- a/src/server/scripts/Legion/VaultoftheWardens/instance_vault_of_the_wardens.cpp +++ b/src/server/scripts/Legion/VaultoftheWardens/instance_vault_of_the_wardens.cpp @@ -30,8 +30,9 @@ class instance_vault_of_the_wardens : public InstanceMapScript struct instance_vault_of_the_wardens_InstanceMapScript : public InstanceScript { - instance_vault_of_the_wardens_InstanceMapScript(Map* map) : InstanceScript(map) + instance_vault_of_the_wardens_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/VaultoftheWardens/vault_of_the_wardens.h b/src/server/scripts/Legion/VaultoftheWardens/vault_of_the_wardens.h index df71917e..c721d2d9 100644 --- a/src/server/scripts/Legion/VaultoftheWardens/vault_of_the_wardens.h +++ b/src/server/scripts/Legion/VaultoftheWardens/vault_of_the_wardens.h @@ -5,6 +5,8 @@ #ifndef VAULT_OF_THE_WARDENS_H_ #define VAULT_OF_THE_WARDENS_H_ +#define DataHeader "VOW" + enum eData { DATA_SALTHERIL = 0, diff --git a/src/server/scripts/Legion/VioletHoldLegion/instance_violet_hold_legion.cpp b/src/server/scripts/Legion/VioletHoldLegion/instance_violet_hold_legion.cpp index 16dfb2fa..60db4aa0 100644 --- a/src/server/scripts/Legion/VioletHoldLegion/instance_violet_hold_legion.cpp +++ b/src/server/scripts/Legion/VioletHoldLegion/instance_violet_hold_legion.cpp @@ -17,8 +17,9 @@ class instance_violet_hold_legion : public InstanceMapScript struct instance_violet_hold_legion_InstanceMapScript : public InstanceScript { - instance_violet_hold_legion_InstanceMapScript(Map* map) : InstanceScript(map) + instance_violet_hold_legion_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Legion/VioletHoldLegion/violet_hold_legion.h b/src/server/scripts/Legion/VioletHoldLegion/violet_hold_legion.h index 6717d7c6..bcb1cc2c 100644 --- a/src/server/scripts/Legion/VioletHoldLegion/violet_hold_legion.h +++ b/src/server/scripts/Legion/VioletHoldLegion/violet_hold_legion.h @@ -5,6 +5,8 @@ #ifndef VIOLET_HOLD_LEGION_H_ #define VIOLET_HOLD_LEGION_H_ +#define DataHeader "VHL" + enum eData { DATA_KAAHRJ = 0, diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h index 92d5c782..bd0f9b5d 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/ahnkahet.h @@ -18,6 +18,8 @@ #ifndef DEF_AHNKAHET_H #define DEF_AHNKAHET_H +#define DataHeader "AKH" + enum Data64 { DATA_ELDER_NADOX, diff --git a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp index 03d36cca..4d1819b3 100644 --- a/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/Ahnkahet/instance_ahnkahet.cpp @@ -42,7 +42,7 @@ class instance_ahnkahet : public InstanceMapScript struct instance_ahnkahet_InstanceScript : public InstanceScript { - instance_ahnkahet_InstanceScript(Map* map) : InstanceScript(map) {} + instance_ahnkahet_InstanceScript(InstanceMap* map) : InstanceScript(map) {} ObjectGuid Elder_Nadox; ObjectGuid Prince_Taldaram; @@ -68,6 +68,7 @@ class instance_ahnkahet : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); InitiandGUIDs.clear(); diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h index 6e865860..3fd66e55 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/azjol_nerub.h @@ -18,6 +18,8 @@ #ifndef DEF_AZJOL_NERUB_H #define DEF_AZJOL_NERUB_H +#define DataHeader "AJN" + enum Data64 { DATA_KRIKTHIR_THE_GATEWATCHER, diff --git a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp index efe55b14..e73cbec8 100644 --- a/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp +++ b/src/server/scripts/Northrend/AzjolNerub/AzjolNerub/instance_azjol_nerub.cpp @@ -30,11 +30,13 @@ class instance_azjol_nerub : public InstanceMapScript { public: - instance_azjol_nerub() : InstanceMapScript("instance_azjol_nerub", 601) { } + instance_azjol_nerub() : InstanceMapScript("instance_azjol_nerub", 601) + {} struct instance_azjol_nerub_InstanceScript : public InstanceScript { - instance_azjol_nerub_InstanceScript(Map* map) : InstanceScript(map) {} + instance_azjol_nerub_InstanceScript(InstanceMap *map) : InstanceScript(map) + {} ObjectGuid uiKrikthir; ObjectGuid uiHadronox; @@ -48,8 +50,9 @@ class instance_azjol_nerub : public InstanceMapScript uint32 auiEncounter[MAX_ENCOUNTER]; - void Initialize() override - { + void Initialize() override + { + SetHeaders(DataHeader); memset(&auiEncounter, 0, sizeof(auiEncounter)); memset(&uiAnubarakDoor, 0, sizeof(uiAnubarakDoor)); @@ -71,20 +74,32 @@ class instance_azjol_nerub : public InstanceMapScript return false; } - void OnCreatureCreate(Creature* creature) override + void OnCreatureCreate(Creature *creature) override { switch (creature->GetEntry()) { - case 28684: uiKrikthir = creature->GetGUID(); break; - case 28921: uiHadronox = creature->GetGUID(); break; - case 29120: uiAnubarak = creature->GetGUID(); break; - case 28730: uiWatcherGashra = creature->GetGUID(); break; - case 28731: uiWatcherSilthik = creature->GetGUID(); break; - case 28729: uiWatcherNarjil = creature->GetGUID(); break; + case 28684: + uiKrikthir = creature->GetGUID(); + break; + case 28921: + uiHadronox = creature->GetGUID(); + break; + case 29120: + uiAnubarak = creature->GetGUID(); + break; + case 28730: + uiWatcherGashra = creature->GetGUID(); + break; + case 28731: + uiWatcherSilthik = creature->GetGUID(); + break; + case 28729: + uiWatcherNarjil = creature->GetGUID(); + break; } } - void OnGameObjectCreate(GameObject* go) override + void OnGameObjectCreate(GameObject *go) override { switch (go->GetEntry()) { @@ -109,12 +124,18 @@ class instance_azjol_nerub : public InstanceMapScript { switch (identifier) { - case DATA_KRIKTHIR_THE_GATEWATCHER: return uiKrikthir; - case DATA_HADRONOX: return uiHadronox; - case DATA_ANUBARAK: return uiAnubarak; - case DATA_WATCHER_GASHRA: return uiWatcherGashra; - case DATA_WATCHER_SILTHIK: return uiWatcherSilthik; - case DATA_WATCHER_NARJIL: return uiWatcherNarjil; + case DATA_KRIKTHIR_THE_GATEWATCHER: + return uiKrikthir; + case DATA_HADRONOX: + return uiHadronox; + case DATA_ANUBARAK: + return uiAnubarak; + case DATA_WATCHER_GASHRA: + return uiWatcherGashra; + case DATA_WATCHER_SILTHIK: + return uiWatcherSilthik; + case DATA_WATCHER_NARJIL: + return uiWatcherNarjil; } return ObjectGuid::Empty; @@ -124,23 +145,23 @@ class instance_azjol_nerub : public InstanceMapScript { switch (type) { - case DATA_KRIKTHIR_THE_GATEWATCHER_EVENT: - auiEncounter[0] = data; - if (data == DONE) - HandleGameObject(uiKrikthirDoor, true); - break; - case DATA_HADRONOX_EVENT: - auiEncounter[1] = data; - break; - case DATA_ANUBARAK_EVENT: - auiEncounter[2] = data; - if (data == IN_PROGRESS) - for (uint8 i = 0; i < 3; ++i) - HandleGameObject(uiAnubarakDoor[i], false); - else if (data == NOT_STARTED || data == DONE) - for (uint8 i = 0; i < 3; ++i) - HandleGameObject(uiAnubarakDoor[i], true); - break; + case DATA_KRIKTHIR_THE_GATEWATCHER_EVENT: + auiEncounter[0] = data; + if (data == DONE) + HandleGameObject(uiKrikthirDoor, true); + break; + case DATA_HADRONOX_EVENT: + auiEncounter[1] = data; + break; + case DATA_ANUBARAK_EVENT: + auiEncounter[2] = data; + if (data == IN_PROGRESS) + for (uint8 i = 0; i < 3; ++i) + HandleGameObject(uiAnubarakDoor[i], false); + else if (data == NOT_STARTED || data == DONE) + for (uint8 i = 0; i < 3; ++i) + HandleGameObject(uiAnubarakDoor[i], true); + break; } if (data == DONE) @@ -153,27 +174,30 @@ class instance_azjol_nerub : public InstanceMapScript { switch (type) { - case DATA_KRIKTHIR_THE_GATEWATCHER_EVENT: return auiEncounter[0]; - case DATA_HADRONOX_EVENT: return auiEncounter[1]; - case DATA_ANUBARAK_EVENT: return auiEncounter[2]; + case DATA_KRIKTHIR_THE_GATEWATCHER_EVENT: + return auiEncounter[0]; + case DATA_HADRONOX_EVENT: + return auiEncounter[1]; + case DATA_ANUBARAK_EVENT: + return auiEncounter[2]; } return 0; } - std::string GetSaveData() override - { + std::string GetSaveData() override + { OUT_SAVE_INST_DATA; std::ostringstream saveStream; saveStream << "A N " << auiEncounter[0] << ' ' << auiEncounter[1] << ' ' - << auiEncounter[2]; + << auiEncounter[2]; OUT_SAVE_INST_DATA_COMPLETE; return saveStream.str(); } - void Load(const char* in) override + void Load(const char *in) override { if (!in) { @@ -183,7 +207,7 @@ class instance_azjol_nerub : public InstanceMapScript OUT_LOAD_INST_DATA(in); - char dataHead1, dataHead2; + char dataHead1, dataHead2; uint16 data0, data1, data2; std::istringstream loadStream(in); @@ -199,13 +223,14 @@ class instance_azjol_nerub : public InstanceMapScript if (auiEncounter[i] == IN_PROGRESS) auiEncounter[i] = NOT_STARTED; - } else OUT_LOAD_INST_DATA_FAIL; + } else + OUT_LOAD_INST_DATA_FAIL; OUT_LOAD_INST_DATA_COMPLETE; } }; - InstanceScript* GetInstanceScript(InstanceMap* map) const override + InstanceScript *GetInstanceScript(InstanceMap *map) const override { return new instance_azjol_nerub_InstanceScript(map); } diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp index c9670eb3..666e08ab 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/instance_obsidian_sanctum.cpp @@ -37,7 +37,7 @@ class instance_obsidian_sanctum : public InstanceMapScript struct instance_obsidian_sanctum_InstanceMapScript : public InstanceScript { - instance_obsidian_sanctum_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_obsidian_sanctum_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; ObjectGuid m_uiSartharionGUID; @@ -51,6 +51,7 @@ class instance_obsidian_sanctum : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); m_uiSartharionGUID.Clear(); diff --git a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h index a363758f..e0a27fea 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h +++ b/src/server/scripts/Northrend/ChamberOfAspects/ObsidianSanctum/obsidian_sanctum.h @@ -18,6 +18,8 @@ #ifndef DEF_OBSIDIAN_SANCTUM_H #define DEF_OBSIDIAN_SANCTUM_H +#define DataHeader "OS" + enum eTypes { TYPE_SARTHARION_EVENT = 1, diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp index bb925e75..00372728 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/instance_ruby_sanctum.cpp @@ -37,6 +37,7 @@ class instance_ruby_sanctum : public InstanceMapScript { instance_ruby_sanctum_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); BaltharusTheWarbornGUID.Clear(); @@ -294,17 +295,6 @@ class instance_ruby_sanctum : public InstanceMapScript return BaltharusSharedHealth; } - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "R S " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - void FillInitialWorldStates(WorldPackets::WorldState::InitWorldStates& packet) override { packet.Worldstates.emplace_back(WorldStates::WORLDSTATE_CORPOREALITY_MATERIAL, 50); @@ -312,39 +302,6 @@ class instance_ruby_sanctum : public InstanceMapScript packet.Worldstates.emplace_back(WorldStates::WORLDSTATE_CORPOREALITY_TOGGLE, 0); } - 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 == 'R' && dataHead2 == 'S') - { - for (uint8 i = 0; i < EncounterCount; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - - SetBossState(i, EncounterState(tmpState)); - } - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - protected: ObjectGuid BaltharusTheWarbornGUID; ObjectGuid GeneralZarithrianGUID; diff --git a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h index cf438d49..ef3566b4 100644 --- a/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h +++ b/src/server/scripts/Northrend/ChamberOfAspects/RubySanctum/ruby_sanctum.h @@ -23,6 +23,8 @@ #include "Creature.h" #include "GameObjectAI.h" +#define DataHeader "RS" + uint32 const EncounterCount = 4; Position const HalionControllerSpawnPos = {3156.037f, 533.2656f, 72.97205f, 0.0f}; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp index 849adac5..0e43fdf5 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/instance_trial_of_the_champion.cpp @@ -36,7 +36,7 @@ class instance_trial_of_the_champion : public InstanceMapScript struct instance_trial_of_the_champion_InstanceMapScript : public InstanceScript { - instance_trial_of_the_champion_InstanceMapScript(Map* pMap) : InstanceScript(pMap) {} + instance_trial_of_the_champion_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; uint32 grandChampionEntry[3]; @@ -63,6 +63,7 @@ class instance_trial_of_the_champion : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); uiAnnouncerGUID.Clear(); uiTirionGUID.Clear(); uiThrallGUID.Clear(); diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h index a7bbc247..ca7af2fc 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheChampion/trial_of_the_champion.h @@ -19,6 +19,8 @@ #ifndef DEF_TOC_H #define DEF_TOC_H +#define DataHeader "TOC" + enum eData { BOSS_GRAND_CHAMPIONS, diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp index f7710dc0..e36cbad9 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/instance_trial_of_the_crusader.cpp @@ -29,10 +29,11 @@ class instance_trial_of_the_crusader : public InstanceMapScript struct instance_trial_of_the_crusader_InstanceMapScript : public InstanceScript { - instance_trial_of_the_crusader_InstanceMapScript(Map* map) : InstanceScript(map) { } + instance_trial_of_the_crusader_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTERS); TrialCounter = 50; EventStage = 0; diff --git a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h index e2ede21f..6dbe811d 100644 --- a/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h +++ b/src/server/scripts/Northrend/CrusadersColiseum/TrialOfTheCrusader/trial_of_the_crusader.h @@ -5,6 +5,8 @@ #ifndef DEF_CRUSADER_H #define DEF_CRUSADER_H +#define DataHeader "TOTC" + enum DataTypes { BOSS_BEASTS = 0, diff --git a/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h b/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h index 9acd9c17..8f64d783 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h +++ b/src/server/scripts/Northrend/DraktharonKeep/drak_tharon_keep.h @@ -18,6 +18,8 @@ #ifndef DRAK_THARON_KEEP_H_ #define DRAK_THARON_KEEP_H_ +#define DataHeader "DTK" + uint32 const EncounterCount = 4; enum DataTypes diff --git a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp index 81f05274..3af69511 100644 --- a/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp +++ b/src/server/scripts/Northrend/DraktharonKeep/instance_drak_tharon_keep.cpp @@ -27,8 +27,9 @@ class instance_drak_tharon_keep : public InstanceMapScript struct instance_drak_tharon_keep_InstanceScript : public InstanceScript { - instance_drak_tharon_keep_InstanceScript(Map* map) : InstanceScript(map) + instance_drak_tharon_keep_InstanceScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); TrollgoreGUID.Clear(); @@ -159,49 +160,6 @@ class instance_drak_tharon_keep : public InstanceMapScript novos->AI()->DoAction(ACTION_CRYSTAL_HANDLER_DIED); } - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "D K " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - 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 == 'D' && dataHead2 == 'K') - { - 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 - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - protected: ObjectGuid TrollgoreGUID; ObjectGuid NovosGUID; diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h index ca68314d..1b5e05cf 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/forge_of_souls.h @@ -18,6 +18,7 @@ #ifndef DEF_FORGE_OF_SOULS_H #define DEF_FORGE_OF_SOULS_H +#define DataHeader "FOS" #define FoSScriptName "instance_forge_of_souls" enum Data diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp index 8279ad93..53ff876e 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/instance_forge_of_souls.cpp @@ -31,8 +31,9 @@ class instance_forge_of_souls : public InstanceMapScript struct instance_forge_of_souls_InstanceScript : public InstanceScript { - instance_forge_of_souls_InstanceScript(Map* map) : InstanceScript(map) + instance_forge_of_souls_InstanceScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); bronjahm.Clear(); devourerOfSouls.Clear(); @@ -98,47 +99,6 @@ class instance_forge_of_souls : public InstanceMapScript return ObjectGuid::Empty; } - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "F S " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) override - { - 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 == 'F' && dataHead2 == 'S') - { - 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } - private: ObjectGuid bronjahm; ObjectGuid devourerOfSouls; diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h index fe6b2fb3..255be4b2 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/halls_of_reflection.h @@ -18,6 +18,7 @@ #ifndef DEF_HALLS_OF_REFLECTION_H #define DEF_HALLS_OF_REFLECTION_H +#define DataHeader "HOR" #define HoRScriptName "instance_halls_of_reflection" #define MAX_ENCOUNTER 3 diff --git a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp index 6a5e9896..3fd9d45b 100644 --- a/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/HallsOfReflection/instance_halls_of_reflection.cpp @@ -73,10 +73,11 @@ class instance_halls_of_reflection : public InstanceMapScript struct instance_halls_of_reflection_InstanceMapScript : public InstanceScript { - instance_halls_of_reflection_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_halls_of_reflection_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); events.Reset(); _falricGUID.Clear(); @@ -524,70 +525,34 @@ class instance_halls_of_reflection : public InstanceMapScript return ObjectGuid::Empty; } - std::string GetSaveData() override + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "H R " << GetBossSaveData() << _introEvent << ' ' << _frostwornGeneral << ' ' << _escapeevent; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); + data << _introEvent << ' ' << _frostwornGeneral << ' ' << _escapeevent; } - void Load(char const* in) override + void ReadSaveDataMore(std::istringstream& data) override { - 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 == 'H' && dataHead2 == 'R') - { - 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 temp = 0; + data >> temp; + _introEvent = temp == DONE ? DONE : NOT_STARTED; + /*if (temp == DONE) + SetData(DATA_INTRO_EVENT, DONE); + else + SetData(DATA_INTRO_EVENT, NOT_STARTED);*/ - uint32 temp = 0; - loadStream >> temp; - _introEvent = temp == DONE ? DONE : NOT_STARTED; - /*if (temp == DONE) - SetData(DATA_INTRO_EVENT, DONE); - else - SetData(DATA_INTRO_EVENT, NOT_STARTED);*/ - - loadStream >> temp; - _frostwornGeneral = temp == DONE ? DONE : NOT_STARTED; - /*if (temp == DONE) - SetData(DATA_FROSWORN_EVENT, DONE); - else - SetData(DATA_FROSWORN_EVENT, NOT_STARTED);*/ - - loadStream >> temp; - _escapeevent = temp == DONE ? DONE : NOT_STARTED; - /*if (temp == DONE) - SetData(DATA_ESCAPE_EVENT, DONE); - else - SetData(DATA_ESCAPE_EVENT, NOT_STARTED);*/ - } + data >> temp; + _frostwornGeneral = temp == DONE ? DONE : NOT_STARTED; + /*if (temp == DONE) + SetData(DATA_FROSWORN_EVENT, DONE); else - OUT_LOAD_INST_DATA_FAIL; + SetData(DATA_FROSWORN_EVENT, NOT_STARTED);*/ - OUT_LOAD_INST_DATA_COMPLETE; + data >> temp; + _escapeevent = temp == DONE ? DONE : NOT_STARTED; + /*if (temp == DONE) + SetData(DATA_ESCAPE_EVENT, DONE); + else + SetData(DATA_ESCAPE_EVENT, NOT_STARTED);*/ } private: diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp index 92c3f4f7..2f7dd967 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/instance_pit_of_saron.cpp @@ -34,8 +34,9 @@ class instance_pit_of_saron : public InstanceMapScript struct instance_pit_of_saron_InstanceScript : public InstanceScript { - instance_pit_of_saron_InstanceScript(Map* map) : InstanceScript(map) + instance_pit_of_saron_InstanceScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); _teamInInstance = 0; } @@ -271,50 +272,6 @@ class instance_pit_of_saron : public InstanceMapScript return true; } - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "P S " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* in) override - { - 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 == 'P' && dataHead2 == 'S') - { - 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } - private: ObjectGuid _garfrostGUID; ObjectGuid _krickGUID; diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h index c431bd6b..9491ff0d 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/pit_of_saron.h @@ -18,6 +18,7 @@ #ifndef DEF_PIT_OF_SARON_H #define DEF_PIT_OF_SARON_H +#define DataHeader "POS" #define PoSScriptName "instance_pit_of_saron" #define MAX_ENCOUNTER 3 diff --git a/src/server/scripts/Northrend/Gundrak/gundrak.h b/src/server/scripts/Northrend/Gundrak/gundrak.h index aeb4e46f..c364915f 100644 --- a/src/server/scripts/Northrend/Gundrak/gundrak.h +++ b/src/server/scripts/Northrend/Gundrak/gundrak.h @@ -18,6 +18,8 @@ #ifndef DEF_GUNDRAK_H #define DEF_GUNDRAK_H +#define DataHeader "GD" + enum Data { DATA_SLAD_RAN_EVENT, diff --git a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp index 1c0f4c65..8012b3fc 100644 --- a/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp +++ b/src/server/scripts/Northrend/Gundrak/instance_gundrak.cpp @@ -41,7 +41,7 @@ class instance_gundrak : public InstanceMapScript struct instance_gundrak_InstanceMapScript : public InstanceScript { - instance_gundrak_InstanceMapScript(Map* map) : InstanceScript(map) + instance_gundrak_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { bHeroicMode = map->IsHeroic(); } @@ -88,6 +88,7 @@ class instance_gundrak : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); spawnSupport = false; timer = 0; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h index 417edacf..6d349157 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h +++ b/src/server/scripts/Northrend/IcecrownCitadel/icecrown_citadel.h @@ -22,6 +22,7 @@ #include "Map.h" #include "Creature.h" +#define DataHeader "ICC" #define ICCScriptName "instance_icecrown_citadel" uint32 const EncounterCount = 13; diff --git a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp index c383c5f9..d026e04c 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/instance_icecrown_citadel.cpp @@ -19,7 +19,6 @@ #include "ScriptMgr.h" #include "InstanceScript.h" #include "ScriptedCreature.h" -#include "Map.h" #include "MapManager.h" #include "Transport.h" #include "PoolMgr.h" @@ -101,6 +100,7 @@ class instance_icecrown_citadel : public InstanceMapScript { instance_icecrown_citadel_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); TeamInInstance = 0; @@ -1222,58 +1222,23 @@ class instance_icecrown_citadel : public InstanceMapScript } } - std::string GetSaveData() override + void WriteSaveDataMore(std::ostringstream& data) override { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "I C " << GetBossSaveData() << HeroicAttempts << ' ' - << ColdflameJetsState << ' ' << BloodQuickeningState << ' ' << BloodQuickeningMinutes; - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); + data << HeroicAttempts << ' ' << ColdflameJetsState << ' ' + << BloodQuickeningState << ' ' << BloodQuickeningMinutes; } - void Load(const char* str) override + void ReadSaveDataMore(std::istringstream& data) override { - if (!str) - { - OUT_LOAD_INST_DATA_FAIL; - return; - } - - OUT_LOAD_INST_DATA(str); - - char dataHead1, dataHead2; - - std::istringstream loadStream(str); - loadStream >> dataHead1 >> dataHead2; + data >> HeroicAttempts; - if (dataHead1 == 'I' && dataHead2 == 'C') - { - for (uint32 i = 0; i < EncounterCount; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - - loadStream >> HeroicAttempts; - - uint32 temp = 0; - loadStream >> temp; - ColdflameJetsState = temp ? DONE : NOT_STARTED; - - loadStream >> temp; - BloodQuickeningState = temp ? DONE : NOT_STARTED; // DONE means finished (not success/fail) - loadStream >> BloodQuickeningMinutes; - } - else - OUT_LOAD_INST_DATA_FAIL; + uint32 temp = 0; + data >> temp; + ColdflameJetsState = temp ? DONE : NOT_STARTED; - OUT_LOAD_INST_DATA_COMPLETE; + data >> temp; + BloodQuickeningState = temp ? DONE : NOT_STARTED; // DONE means finished (not success/fail) + data >> BloodQuickeningMinutes; } void Update(uint32 diff) override diff --git a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp index 6c5b18f8..8021933e 100644 --- a/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp +++ b/src/server/scripts/Northrend/Naxxramas/instance_naxxramas.cpp @@ -146,8 +146,9 @@ class instance_naxxramas : public InstanceMapScript struct instance_naxxramas_InstanceMapScript : public InstanceScript { - instance_naxxramas_InstanceMapScript(Map* map) : InstanceScript(map) + instance_naxxramas_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_BOSS_NUMBER); LoadDoorData(doorData); LoadMinionData(minionData); @@ -706,22 +707,17 @@ class instance_naxxramas : public InstanceMapScript return false; } - std::string GetSaveData() override + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; - saveStream << GetBossSaveData() << " " << gothikDoorState << " " << bImmortal; - return saveStream.str(); + data << gothikDoorState << " " << bImmortal; } - void Load(const char * data) override + void ReadSaveDataMore(std::istringstream& data) override { - std::istringstream loadStream(LoadBossState(data)); uint32 buff; - for (uint32 i=0; i> buff; - loadStream >> buff; + data >> buff; gothikDoorState = GOState(buff); - loadStream >> bImmortal; + data >> bImmortal; } void Update(uint32 diff) override diff --git a/src/server/scripts/Northrend/Naxxramas/naxxramas.h b/src/server/scripts/Northrend/Naxxramas/naxxramas.h index 70e6757d..00295244 100644 --- a/src/server/scripts/Northrend/Naxxramas/naxxramas.h +++ b/src/server/scripts/Northrend/Naxxramas/naxxramas.h @@ -18,6 +18,8 @@ #ifndef DEF_NAXXRAMAS_H #define DEF_NAXXRAMAS_H +#define DataHeader "NAXX" + enum Encounter { BOSS_ANUBREKHAN, diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h b/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h index db879eab..8d0979eb 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/eye_of_eternity.h @@ -18,6 +18,8 @@ #ifndef DEF_EYE_OF_ETERNITY_H #define DEF_EYE_OF_ETERNITY_H +#define DataHeader "EOE" + enum InstanceData { DATA_MALYGOS_EVENT, diff --git a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp index 2bdae98d..4bad7e67 100644 --- a/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp +++ b/src/server/scripts/Northrend/Nexus/EyeOfEternity/instance_eye_of_eternity.cpp @@ -30,8 +30,9 @@ class instance_eye_of_eternity : public InstanceMapScript struct instance_eye_of_eternity_InstanceMapScript : public InstanceScript { - instance_eye_of_eternity_InstanceMapScript(Map* map) : InstanceScript(map) + instance_eye_of_eternity_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); vortexTriggers.clear(); @@ -274,48 +275,6 @@ class instance_eye_of_eternity : public InstanceMapScript return ObjectGuid::Empty; } - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "E E " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - void Load(const char* 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 == 'E' && dataHead2 == 'E') - { - for (int32 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; - - OUT_LOAD_INST_DATA_COMPLETE; - } - private: GuidList vortexTriggers; GuidList portalTriggers; diff --git a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp index aaff958f..6d3a0859 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp +++ b/src/server/scripts/Northrend/Nexus/Nexus/instance_nexus.cpp @@ -37,7 +37,7 @@ class instance_nexus : public InstanceMapScript struct instance_nexus_InstanceMapScript : public InstanceScript { - instance_nexus_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_nexus_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[NUMBER_OF_ENCOUNTERS]; @@ -52,6 +52,7 @@ class instance_nexus : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); Anomalus.Clear(); diff --git a/src/server/scripts/Northrend/Nexus/Nexus/nexus.h b/src/server/scripts/Northrend/Nexus/Nexus/nexus.h index 7aa228c1..71722e91 100644 --- a/src/server/scripts/Northrend/Nexus/Nexus/nexus.h +++ b/src/server/scripts/Northrend/Nexus/Nexus/nexus.h @@ -18,6 +18,8 @@ #ifndef DEF_NEXUS_H #define DEF_NEXUS_H +#define DataHeader "NX" + enum eTypes { DATA_MAGUS_TELESTRA_EVENT, diff --git a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp index 1d19eb34..314caaf2 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp +++ b/src/server/scripts/Northrend/Nexus/Oculus/instance_oculus.cpp @@ -37,8 +37,9 @@ class instance_oculus : public InstanceMapScript struct instance_oculus_InstanceMapScript : public InstanceScript { - instance_oculus_InstanceMapScript(Map* map) : InstanceScript(map) + instance_oculus_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); @@ -283,49 +284,6 @@ class instance_oculus : public InstanceMapScript gwhelp->SetPhaseMask(1, true); } - std::string GetSaveData() override - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "T O " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - 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 == 'T' && 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)); - } - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - protected: ObjectGuid DrakosGUID; ObjectGuid VarosGUID; diff --git a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h index 00b4b9e7..10bf90fe 100644 --- a/src/server/scripts/Northrend/Nexus/Oculus/oculus.h +++ b/src/server/scripts/Northrend/Nexus/Oculus/oculus.h @@ -18,6 +18,8 @@ #ifndef OCULUS_H_ #define OCULUS_H_ +#define DataHeader "OC" + uint32 const EncounterCount = 4; enum DataTypes diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h index d5bca9c2..337b3a9c 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/halls_of_lightning.h @@ -19,6 +19,8 @@ #ifndef DEF_HALLS_OF_LIGHTNING_H #define DEF_HALLS_OF_LIGHTNING_H +#define DataHeader "HOL" + enum eTypes { MAX_ENCOUNTER = 4, diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp index 9cc46e36..0fd07563 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfLightning/instance_halls_of_lightning.cpp @@ -46,7 +46,7 @@ class instance_halls_of_lightning : public InstanceMapScript struct instance_halls_of_lightning_InstanceMapScript : public InstanceScript { - instance_halls_of_lightning_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_halls_of_lightning_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; @@ -63,6 +63,7 @@ class instance_halls_of_lightning : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); m_uiGeneralBjarngrimGUID.Clear(); diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h index a6f1eb86..519aeb0a 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/halls_of_stone.h @@ -17,6 +17,9 @@ #ifndef DEF_HALLS_OF_STONE_H #define DEF_HALLS_OF_STONE_H + +#define DataHeader "HOS" + enum Data { DATA_KRYSTALLUS_EVENT, diff --git a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp index 1898b2b1..59cb3f05 100644 --- a/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp +++ b/src/server/scripts/Northrend/Ulduar/HallsOfStone/instance_halls_of_stone.cpp @@ -40,7 +40,7 @@ class instance_halls_of_stone : public InstanceMapScript struct instance_halls_of_stone_InstanceMapScript : public InstanceScript { - instance_halls_of_stone_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_halls_of_stone_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} ObjectGuid uiMaidenOfGrief; ObjectGuid uiKrystallus; @@ -67,6 +67,8 @@ class instance_halls_of_stone : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); + uiMaidenOfGrief.Clear(); uiKrystallus.Clear(); uiSjonnir.Clear(); diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp index f8f11ebe..5e474262 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/instance_ulduar.cpp @@ -50,8 +50,9 @@ class instance_ulduar : public InstanceMapScript struct instance_ulduar_InstanceMapScript : public InstanceScript { - instance_ulduar_InstanceMapScript(Map* pMap) : InstanceScript(pMap) + instance_ulduar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_BOSS_NUMBER); LoadDoorData(doorData); ShieldCheck = 0; @@ -789,21 +790,15 @@ class instance_ulduar : public InstanceMapScript } } } - - std::string GetSaveData() override + + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; - saveStream << GetBossSaveData() << " " << Immortal; - return saveStream.str(); + data << Immortal; } - void Load(const char * data) override + void ReadSaveDataMore(std::istringstream& data) override { - std::istringstream loadStream(LoadBossState(data)); - uint32 buff; - for (uint32 i=0; i> buff; - loadStream >> Immortal; + data >> Immortal; } bool CheckRequiredBosses(uint32 bossId, uint32 entry, Player const* player = NULL) const override diff --git a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h index c582db2a..2d246361 100644 --- a/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h +++ b/src/server/scripts/Northrend/Ulduar/Ulduar/ulduar.h @@ -19,6 +19,8 @@ #define DEF_ULDUAR_H #include "ObjectMgr.h" + +#define DataHeader "UD" #define UlduarScriptName "instance_ulduar" enum Encounter diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp index 47a7e3de..32979e0a 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/instance_utgarde_keep.cpp @@ -59,7 +59,7 @@ class instance_utgarde_keep : public InstanceMapScript struct instance_utgarde_keep_InstanceMapScript : public InstanceScript { - instance_utgarde_keep_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_utgarde_keep_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} ObjectGuid Keleseth; ObjectGuid Skarvald; @@ -77,6 +77,7 @@ class instance_utgarde_keep : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); Keleseth.Clear(); diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h index 971dab98..51d03e8a 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardeKeep/utgarde_keep.h @@ -18,6 +18,8 @@ #ifndef DEF_UTGARDE_KEEP_H #define DEF_UTGARDE_KEEP_H +#define DataHeader "UK" + #define DATA_PRINCEKELESETH 1 #define DATA_SKARVALD 3 #define DATA_DALRONN 4 diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp index 1938cb1a..09af92cb 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/instance_pinnacle.cpp @@ -47,7 +47,7 @@ class instance_utgarde_pinnacle : public InstanceMapScript struct instance_pinnacle : public InstanceScript { - instance_pinnacle(Map* map) : InstanceScript(map) {} + instance_pinnacle(InstanceMap* map) : InstanceScript(map) { } ObjectGuid uiSvalaSorrowgrave; ObjectGuid uiGortokPalehoof; @@ -73,6 +73,8 @@ class instance_utgarde_pinnacle : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); + for (uint8 i = 0; i < MAX_ENCOUNTER; ++i) m_auiEncounter[i] = NOT_STARTED; diff --git a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h index 872314ee..602931a3 100644 --- a/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h +++ b/src/server/scripts/Northrend/UtgardeKeep/UtgardePinnacle/utgarde_pinnacle.h @@ -18,6 +18,8 @@ #ifndef DEF_PINNACLE_H #define DEF_PINNACLE_H +#define DataHeader "UP" + enum Data { DATA_SVALA_SORROWGRAVE_EVENT, diff --git a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp index b220e524..101e247c 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp +++ b/src/server/scripts/Northrend/VaultOfArchavon/instance_vault_of_archavon.cpp @@ -33,8 +33,9 @@ class instance_vault_of_archavon : public InstanceMapScript struct instance_vault_of_archavon_InstanceMapScript : public InstanceScript { - instance_vault_of_archavon_InstanceMapScript(Map* map) : InstanceScript(map) + instance_vault_of_archavon_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); EmalonGUID.Clear(); diff --git a/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h b/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h index 7bc20b2a..2e6ec8af 100644 --- a/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h +++ b/src/server/scripts/Northrend/VaultOfArchavon/vault_of_archavon.h @@ -18,6 +18,8 @@ #ifndef DEF_ARCHAVON_H #define DEF_ARCHAVON_H +#define DataHeader "VOA" + uint32 const EncounterCount = 4; enum Data diff --git a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp index 8437e2b2..f5ac9206 100644 --- a/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp +++ b/src/server/scripts/Northrend/VioletHold/instance_violet_hold.cpp @@ -107,7 +107,7 @@ class instance_violet_hold : public InstanceMapScript struct instance_violet_hold_InstanceMapScript : public InstanceScript { - instance_violet_hold_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_violet_hold_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} ObjectGuid uiMoragg; ObjectGuid uiErekem; @@ -165,6 +165,8 @@ class instance_violet_hold : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); + uiMoragg.Clear(); uiErekem.Clear(); uiIchoron.Clear(); diff --git a/src/server/scripts/Northrend/VioletHold/violet_hold.h b/src/server/scripts/Northrend/VioletHold/violet_hold.h index 3388fe4a..472589c1 100644 --- a/src/server/scripts/Northrend/VioletHold/violet_hold.h +++ b/src/server/scripts/Northrend/VioletHold/violet_hold.h @@ -18,6 +18,8 @@ #ifndef DEF_VIOLET_HOLD_H #define DEF_VIOLET_HOLD_H +#define DataHeader "VH" + enum Data { DATA_1ST_BOSS_EVENT, diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp index 28b9248f..70ca5b28 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/instance_sethekk_halls.cpp @@ -45,13 +45,14 @@ class instance_sethekk_halls : public InstanceMapScript struct instance_sethekk_halls_InstanceMapScript : public InstanceScript { - instance_sethekk_halls_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_sethekk_halls_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 AnzuEncounter; ObjectGuid m_uiIkissDoorGUID; void Initialize() { + SetHeaders(DataHeader); AnzuEncounter = NOT_STARTED; m_uiIkissDoorGUID.Clear(); } diff --git a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h index b057ac69..962b2551 100644 --- a/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h +++ b/src/server/scripts/Outland/Auchindoun/SethekkHalls/sethekk_halls.h @@ -19,6 +19,8 @@ #ifndef DEF_SETHEKK_HALLS_H #define DEF_SETHEKK_HALLS_H +#define DataHeader "STKH" + enum eTypes { DATA_IKISSDOOREVENT = 1, diff --git a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp index a95e7e87..280caa99 100644 --- a/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp +++ b/src/server/scripts/Outland/Auchindoun/ShadowLabyrinth/instance_shadow_labyrinth.cpp @@ -34,8 +34,9 @@ class instance_shadow_labyrinth : public InstanceMapScript struct instance_shadow_labyrinth_InstanceMapScript : public InstanceScript { - instance_shadow_labyrinth_InstanceMapScript(Map* map) : InstanceScript(map) + instance_shadow_labyrinth_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); diff --git a/src/server/scripts/Outland/BlackTemple/black_temple.h b/src/server/scripts/Outland/BlackTemple/black_temple.h index 813070d8..1fe04309 100644 --- a/src/server/scripts/Outland/BlackTemple/black_temple.h +++ b/src/server/scripts/Outland/BlackTemple/black_temple.h @@ -19,6 +19,8 @@ #ifndef DEF_BLACK_TEMPLE_H #define DEF_BLACK_TEMPLE_H +#define DataHeader "BT" + enum eTypes { DATA_AKAMA = 1, diff --git a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp index cebd46db..52825387 100644 --- a/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp +++ b/src/server/scripts/Outland/BlackTemple/instance_black_temple.cpp @@ -53,7 +53,7 @@ class instance_black_temple : public InstanceMapScript struct instance_black_temple_InstanceMapScript : public InstanceScript { - instance_black_temple_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_black_temple_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; std::string str_data; @@ -86,6 +86,8 @@ class instance_black_temple : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); Najentus.Clear(); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp index 3c25ff8d..8952314c 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/instance_serpent_shrine.cpp @@ -74,8 +74,9 @@ class instance_serpent_shrine : public InstanceMapScript struct instance_serpentshrine_cavern_InstanceMapScript : public InstanceScript { - instance_serpentshrine_cavern_InstanceMapScript(Map* map) : InstanceScript(map) + instance_serpentshrine_cavern_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); } void Initialize() diff --git a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h index f895231b..ad78050d 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h +++ b/src/server/scripts/Outland/CoilfangReservoir/SerpentShrine/serpent_shrine.h @@ -19,6 +19,8 @@ #ifndef DEF_SERPENT_SHRINE_H #define DEF_SERPENT_SHRINE_H +#define DataHeader "SSC" + enum WaterEventState { WATERSTATE_NONE = 0, diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp index d8a5b007..dc5bb312 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/instance_steam_vault.cpp @@ -74,7 +74,7 @@ class instance_steam_vault : public InstanceMapScript struct instance_steam_vault_InstanceMapScript : public InstanceScript { - instance_steam_vault_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_steam_vault_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; @@ -88,6 +88,7 @@ class instance_steam_vault : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); ThespiaGUID.Clear(); diff --git a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h index b2b25d96..e5c8ebed 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h +++ b/src/server/scripts/Outland/CoilfangReservoir/SteamVault/steam_vault.h @@ -19,6 +19,8 @@ #ifndef DEF_STEAM_VAULT_H #define DEF_STEAM_VAULT_H +#define DataHeader "SV" + #define TYPE_HYDROMANCER_THESPIA 1 #define TYPE_MEKGINEER_STEAMRIGGER 2 #define TYPE_WARLORD_KALITHRESH 3 diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp index e552c4f9..b12dbc5a 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/instance_the_slave_pens.cpp @@ -1,7 +1,6 @@ #include "ScriptMgr.h" #include "Creature.h" #include "InstanceScript.h" -#include "Map.h" #include "the_slave_pens.h" class instance_the_slave_pens : public InstanceMapScript @@ -11,8 +10,9 @@ class instance_the_slave_pens : public InstanceMapScript struct instance_the_slave_pens_InstanceMapScript : public InstanceScript { - instance_the_slave_pens_InstanceMapScript(Map* map) : InstanceScript(map) - { + instance_the_slave_pens_InstanceMapScript(InstanceMap* map) : InstanceScript(map) + { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h index d448121f..4852a07e 100644 --- a/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h +++ b/src/server/scripts/Outland/CoilfangReservoir/TheSlavePens/the_slave_pens.h @@ -1,6 +1,8 @@ #ifndef THESLAVEPENS_H_ #define THESLAVEPENS_H_ +#define DataHeader "SP" + enum eData { DATA_MENNU = 0, diff --git a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h index 163ab97e..982107f1 100644 --- a/src/server/scripts/Outland/GruulsLair/gruuls_lair.h +++ b/src/server/scripts/Outland/GruulsLair/gruuls_lair.h @@ -19,6 +19,8 @@ #ifndef DEF_GRUULS_LAIR_H #define DEF_GRUULS_LAIR_H +#define DataHeader "GL" + #define DATA_BLINDEYETHESEER 1 #define DATA_GRUULEVENT 2 #define DATA_KIGGLERTHECRAZED 3 diff --git a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp index cc2355b9..3b3f4f1f 100644 --- a/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp +++ b/src/server/scripts/Outland/GruulsLair/instance_gruuls_lair.cpp @@ -46,7 +46,7 @@ class instance_gruuls_lair : public InstanceMapScript struct instance_gruuls_lair_InstanceMapScript : public InstanceScript { - instance_gruuls_lair_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_gruuls_lair_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; @@ -62,6 +62,8 @@ class instance_gruuls_lair : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); + memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); MaulgarEvent_Tank.Clear(); diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h index a6f853bc..0d4cd06d 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/blood_furnace.h @@ -18,6 +18,7 @@ #ifndef BLOOD_FURNACE_H_ #define BLOOD_FURNACE_H_ +#define DataHeader "BF" #define BFScriptName "instance_blood_furnace" uint32 const EncounterCount = 3; diff --git a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp index 9d5d2b57..38b37ee7 100644 --- a/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/BloodFurnace/instance_blood_furnace.cpp @@ -38,8 +38,9 @@ class instance_blood_furnace : public InstanceMapScript struct instance_blood_furnace_InstanceMapScript : public InstanceScript { - instance_blood_furnace_InstanceMapScript(Map* map) : InstanceScript(map) + instance_blood_furnace_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); @@ -322,49 +323,6 @@ class instance_blood_furnace : public InstanceMapScript } } - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "B F " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - 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 == 'B' && dataHead2 == 'F') - { - 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 - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } - protected: ObjectGuid TheMakerGUID; ObjectGuid BroggokGUID; diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h index 068a8710..5f6ce903 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/hellfire_ramparts.h @@ -19,6 +19,8 @@ #ifndef DEF_RAMPARTS_H #define DEF_RAMPARTS_H +#define DataHeader "HFR" + uint32 const EncounterCount = 4; enum HRDataTypes diff --git a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp index 3623f18f..e1265f9f 100644 --- a/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/HellfireRamparts/instance_hellfire_ramparts.cpp @@ -32,8 +32,9 @@ class instance_ramparts : public InstanceMapScript struct instance_ramparts_InstanceMapScript : public InstanceScript { - instance_ramparts_InstanceMapScript(Map* map) : InstanceScript(map) + instance_ramparts_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); } diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp index 23de61b1..0d117a7e 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/instance_magtheridons_lair.cpp @@ -52,8 +52,9 @@ class instance_magtheridons_lair : public InstanceMapScript struct instance_magtheridons_lair_InstanceMapScript : public InstanceScript { - instance_magtheridons_lair_InstanceMapScript(Map* map) : InstanceScript(map) + instance_magtheridons_lair_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); } uint32 m_auiEncounter[MAX_ENCOUNTER]; diff --git a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h index 6a232264..df39549b 100644 --- a/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h +++ b/src/server/scripts/Outland/HellfireCitadel/MagtheridonsLair/magtheridons_lair.h @@ -19,6 +19,8 @@ #ifndef DEF_MAGTHERIDONS_LAIR_H #define DEF_MAGTHERIDONS_LAIR_H +#define DataHeader "MAG" + #define DATA_MAGTHERIDON_EVENT 1 #define DATA_MAGTHERIDON 3 #define DATA_CHANNELER_EVENT 2 diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp index 3813089e..d2758321 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/instance_shattered_halls.cpp @@ -40,7 +40,7 @@ class instance_shattered_halls : public InstanceMapScript } struct instance_shattered_halls_InstanceMapScript : public InstanceScript { - instance_shattered_halls_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_shattered_halls_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 m_auiEncounter[MAX_ENCOUNTER]; ObjectGuid nethekurseGUID; @@ -48,6 +48,7 @@ class instance_shattered_halls : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); memset(&m_auiEncounter, 0, sizeof(m_auiEncounter)); nethekurseGUID.Clear(); diff --git a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h index 60140704..87dc9146 100644 --- a/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h +++ b/src/server/scripts/Outland/HellfireCitadel/ShatteredHalls/shattered_halls.h @@ -19,6 +19,8 @@ #ifndef DEF_SHATTERED_H #define DEF_SHATTERED_H +#define DataHeader "SH" + #define TYPE_NETHEKURSE 1 #define DATA_NETHEKURSE 2 #define DATA_NETHEKURSE_DOOR 3 diff --git a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp index 83a33706..8f1705eb 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp +++ b/src/server/scripts/Outland/TempestKeep/Eye/instance_the_eye.cpp @@ -54,8 +54,9 @@ class instance_the_eye : public InstanceMapScript struct instance_the_eye_InstanceMapScript : public InstanceScript { - instance_the_eye_InstanceMapScript(Map* map) : InstanceScript(map) + instance_the_eye_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); LoadObjectData(nullptr, gameObjectData); diff --git a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h index 001eac8d..a097f895 100644 --- a/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h +++ b/src/server/scripts/Outland/TempestKeep/Eye/the_eye.h @@ -19,6 +19,7 @@ #ifndef DEF_THE_EYE_H #define DEF_THE_EYE_H +#define DataHeader "EYE" #define TheEyeScriptName "instance_the_eye" uint32 const EncounterCount = 4; diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp index 35b86b43..4299f3ea 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/instance_mechanar.cpp @@ -37,8 +37,9 @@ class instance_mechanar : public InstanceMapScript { ObjectGuid chahcelegionGUID; - instance_mechanar_InstanceMapScript(Map* map) : InstanceScript(map) + instance_mechanar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); } @@ -102,49 +103,6 @@ class instance_mechanar : public InstanceMapScript return true; } - - std::string GetSaveData() - { - OUT_SAVE_INST_DATA; - - std::ostringstream saveStream; - saveStream << "M C " << GetBossSaveData(); - - OUT_SAVE_INST_DATA_COMPLETE; - return saveStream.str(); - } - - 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 == 'M' && dataHead2 == 'C') - { - 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 - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; - } }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h index 58133441..d2f28d50 100644 --- a/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h +++ b/src/server/scripts/Outland/TempestKeep/Mechanar/mechanar.h @@ -18,6 +18,8 @@ #ifndef DEF_MECHANAR_H #define DEF_MECHANAR_H +#define DataHeader "MECH" + uint32 const EncounterCount = 5; enum DataTypes diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h index 9a7c5e18..2c46e722 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/arcatraz.h @@ -3,6 +3,7 @@ #include "CreatureAIImpl.h" +#define DataHeader "ARC" #define ArcatrazScriptName "instance_arcatraz" uint32 const EncounterCount = 4; diff --git a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp index 849e440d..8276224e 100644 --- a/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp +++ b/src/server/scripts/Outland/TempestKeep/arcatraz/instance_arcatraz.cpp @@ -3,7 +3,6 @@ #include "Creature.h" #include "GameObject.h" #include "InstanceScript.h" -#include "Map.h" DoorData const doorData[] = { @@ -19,9 +18,9 @@ class instance_arcatraz : public InstanceMapScript struct instance_arcatraz_InstanceMapScript : public InstanceScript { - instance_arcatraz_InstanceMapScript(Map* map) : InstanceScript(map) + instance_arcatraz_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { - //SetHeaders(DataHeader); + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); diff --git a/src/server/scripts/Pandaria/GateSettingSun/gate_setting_sun.h b/src/server/scripts/Pandaria/GateSettingSun/gate_setting_sun.h index d833ab6b..25612744 100644 --- a/src/server/scripts/Pandaria/GateSettingSun/gate_setting_sun.h +++ b/src/server/scripts/Pandaria/GateSettingSun/gate_setting_sun.h @@ -4,6 +4,8 @@ #ifndef STORMSTOUT_BREWERY_H_ #define STORMSTOUT_BREWERY_H_ +#define DataHeader "GSS" + uint32 const EncounterCount = 4; enum DataTypes diff --git a/src/server/scripts/Pandaria/GateSettingSun/instance_gate_setting_sun.cpp b/src/server/scripts/Pandaria/GateSettingSun/instance_gate_setting_sun.cpp index b06c8ba7..7c50de88 100644 --- a/src/server/scripts/Pandaria/GateSettingSun/instance_gate_setting_sun.cpp +++ b/src/server/scripts/Pandaria/GateSettingSun/instance_gate_setting_sun.cpp @@ -52,10 +52,11 @@ class instance_gate_setting_sun : public InstanceMapScript uint32 dataStorage[MAX_DATA]; - instance_gate_setting_sun_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_gate_setting_sun_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); LoadDoorData(doorData); diff --git a/src/server/scripts/Pandaria/HeartFear/heart_of_fear.h b/src/server/scripts/Pandaria/HeartFear/heart_of_fear.h index 3198857b..0665485d 100644 --- a/src/server/scripts/Pandaria/HeartFear/heart_of_fear.h +++ b/src/server/scripts/Pandaria/HeartFear/heart_of_fear.h @@ -4,6 +4,8 @@ #ifndef HEARTOFFEAR #define HEARTOFFEAR +#define DataHeader "HOF" + #include "SpellScript.h" #include "Map.h" #include "Creature.h" diff --git a/src/server/scripts/Pandaria/HeartFear/instance_heart_of_fear.cpp b/src/server/scripts/Pandaria/HeartFear/instance_heart_of_fear.cpp index 8bd608f2..26efc4e5 100644 --- a/src/server/scripts/Pandaria/HeartFear/instance_heart_of_fear.cpp +++ b/src/server/scripts/Pandaria/HeartFear/instance_heart_of_fear.cpp @@ -29,7 +29,7 @@ class instance_heart_of_fear : public InstanceMapScript struct instance_heart_of_fear_InstanceMapScript : public InstanceScript { - instance_heart_of_fear_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_heart_of_fear_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} //GameObjects ObjectGuid vizierentdoorGuid; @@ -66,6 +66,7 @@ class instance_heart_of_fear : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); SetBossNumber(7); LoadDoorData(doorData); @@ -513,21 +514,6 @@ class instance_heart_of_fear : public InstanceMapScript return true; } - - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << GetBossSaveData() << " "; - return saveStream.str(); - } - - void Load(const char* data) - { - std::istringstream loadStream(LoadBossState(data)); - uint32 buff; - for (uint32 i = 0; i < 7; ++i) - loadStream >> buff; - } }; }; diff --git a/src/server/scripts/Pandaria/MogushanPalace/instance_mogu_shan_palace.cpp b/src/server/scripts/Pandaria/MogushanPalace/instance_mogu_shan_palace.cpp index 2436d890..ca12e8cc 100644 --- a/src/server/scripts/Pandaria/MogushanPalace/instance_mogu_shan_palace.cpp +++ b/src/server/scripts/Pandaria/MogushanPalace/instance_mogu_shan_palace.cpp @@ -46,10 +46,12 @@ class instance_mogu_shan_palace : public InstanceMapScript uint8 JadeCount; uint8 GemCount; - instance_mogu_shan_palace_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_mogu_shan_palace_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} void Initialize() override { + SetHeaders(DataHeader); + xin_guid.Clear(); kuai_guid.Clear(); ming_guid.Clear(); diff --git a/src/server/scripts/Pandaria/MogushanPalace/mogu_shan_palace.h b/src/server/scripts/Pandaria/MogushanPalace/mogu_shan_palace.h index df8bebd3..3ee868d4 100644 --- a/src/server/scripts/Pandaria/MogushanPalace/mogu_shan_palace.h +++ b/src/server/scripts/Pandaria/MogushanPalace/mogu_shan_palace.h @@ -4,6 +4,8 @@ #ifndef MOGUSHAN_PALACE_H_ #define MOGUSHAN_PALACE_H_ +#define DataHeader "MSP" + enum eData { DATA_TRIAL_OF_THE_KING = 0, diff --git a/src/server/scripts/Pandaria/MogushanVault/instance_mogu_shan_vault.cpp b/src/server/scripts/Pandaria/MogushanVault/instance_mogu_shan_vault.cpp index 8239cdb5..3efd656e 100644 --- a/src/server/scripts/Pandaria/MogushanVault/instance_mogu_shan_vault.cpp +++ b/src/server/scripts/Pandaria/MogushanVault/instance_mogu_shan_vault.cpp @@ -27,7 +27,7 @@ class instance_mogu_shan_vault : public InstanceMapScript struct instance_mogu_shan_vault_InstanceMapScript : public InstanceScript { - instance_mogu_shan_vault_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_mogu_shan_vault_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} //GameObject ObjectGuid stoneexitdoorGuid; @@ -64,6 +64,7 @@ class instance_mogu_shan_vault : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(DATA_MAX_BOSS_DATA); LoadDoorData(doorData); @@ -421,21 +422,6 @@ class instance_mogu_shan_vault : public InstanceMapScript return true; } - - std::string GetSaveData() override - { - std::ostringstream saveStream; - saveStream << GetBossSaveData() << " "; - return saveStream.str(); - } - - void Load(const char* data) override - { - std::istringstream loadStream(LoadBossState(data)); - uint32 buff; - for (uint32 i=0; i < DATA_MAX_BOSS_DATA; ++i) - loadStream >> buff; - } }; }; diff --git a/src/server/scripts/Pandaria/MogushanVault/mogu_shan_vault.h b/src/server/scripts/Pandaria/MogushanVault/mogu_shan_vault.h index 0e20b1b3..d864f50e 100644 --- a/src/server/scripts/Pandaria/MogushanVault/mogu_shan_vault.h +++ b/src/server/scripts/Pandaria/MogushanVault/mogu_shan_vault.h @@ -6,6 +6,8 @@ #ifndef MOGUSHAN_VAULT_H_ #define MOGUSHAN_VAULT_H_ +#define DataHeader "MSV" + enum eData { DATA_STONE_GUARD = 0, diff --git a/src/server/scripts/Pandaria/ShadopanMonastery/instance_shadopan_monastery.cpp b/src/server/scripts/Pandaria/ShadopanMonastery/instance_shadopan_monastery.cpp index 683e8101..351973d2 100644 --- a/src/server/scripts/Pandaria/ShadopanMonastery/instance_shadopan_monastery.cpp +++ b/src/server/scripts/Pandaria/ShadopanMonastery/instance_shadopan_monastery.cpp @@ -54,11 +54,12 @@ class instance_shadopan_monastery : public InstanceMapScript uint32 dataStorage[MAX_DATA]; - instance_shadopan_monastery_InstanceMapScript(Map* map) : InstanceScript(map) + instance_shadopan_monastery_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(EncounterCount); aliveNoviceCount = MAX_NOVICE; diff --git a/src/server/scripts/Pandaria/ShadopanMonastery/shadopan_monastery.h b/src/server/scripts/Pandaria/ShadopanMonastery/shadopan_monastery.h index 0ec402f5..a3d7155b 100644 --- a/src/server/scripts/Pandaria/ShadopanMonastery/shadopan_monastery.h +++ b/src/server/scripts/Pandaria/ShadopanMonastery/shadopan_monastery.h @@ -4,6 +4,8 @@ #ifndef SHADOPAN_MONASTERY_H_ #define SHADOPAN_MONASTERY_H_ +#define DataHeader "SPM" + uint32 const EncounterCount = 4; #define MAX_NOVICE 24 diff --git a/src/server/scripts/Pandaria/SiegeNiuzaoTemple/instance_siege_of_the_niuzoa_temple.cpp b/src/server/scripts/Pandaria/SiegeNiuzaoTemple/instance_siege_of_the_niuzoa_temple.cpp index 6f110726..cdd60aba 100644 --- a/src/server/scripts/Pandaria/SiegeNiuzaoTemple/instance_siege_of_the_niuzoa_temple.cpp +++ b/src/server/scripts/Pandaria/SiegeNiuzaoTemple/instance_siege_of_the_niuzoa_temple.cpp @@ -20,10 +20,11 @@ class instance_siege_of_the_niuzoa_temple : public InstanceMapScript ObjectGuid pavalakGuid; ObjectGuid neronokGuid; - instance_siege_of_the_niuzoa_temple_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_siege_of_the_niuzoa_temple_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} void Initialize() override { + SetHeaders(DataHeader); jinbakGuid.Clear(); vojakGuid.Clear(); pavalakGuid.Clear(); diff --git a/src/server/scripts/Pandaria/SiegeNiuzaoTemple/siege_of_the_niuzoa_temple.h b/src/server/scripts/Pandaria/SiegeNiuzaoTemple/siege_of_the_niuzoa_temple.h index f120f464..e3451000 100644 --- a/src/server/scripts/Pandaria/SiegeNiuzaoTemple/siege_of_the_niuzoa_temple.h +++ b/src/server/scripts/Pandaria/SiegeNiuzaoTemple/siege_of_the_niuzoa_temple.h @@ -4,6 +4,8 @@ #ifndef SIEGE_NIUZOA_TEMPLE_H_ #define SIEGE_NIUZOA_TEMPLE_H_ +#define DataHeader "SNT" + enum DataTypes { DATA_JINBAK = 1, diff --git a/src/server/scripts/Pandaria/SiegeofOrgrimmar/instance_siege_of_orgrimmar.cpp b/src/server/scripts/Pandaria/SiegeofOrgrimmar/instance_siege_of_orgrimmar.cpp index 35de8a28..247b8bdd 100644 --- a/src/server/scripts/Pandaria/SiegeofOrgrimmar/instance_siege_of_orgrimmar.cpp +++ b/src/server/scripts/Pandaria/SiegeofOrgrimmar/instance_siege_of_orgrimmar.cpp @@ -126,7 +126,7 @@ class instance_siege_of_orgrimmar : public InstanceMapScript struct instance_siege_of_orgrimmar_InstanceMapScript : public InstanceScript { - instance_siege_of_orgrimmar_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_siege_of_orgrimmar_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} std::map easyGUIDconteiner; //count killed klaxxi @@ -255,6 +255,7 @@ class instance_siege_of_orgrimmar : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); SetBossNumber(DATA_MAX); LoadDoorData(doorData); @@ -2491,44 +2492,14 @@ class instance_siege_of_orgrimmar : public InstanceMapScript return true; } - std::string GetSaveData() + void WriteSaveDataMore(std::ostringstream& data) override { - std::ostringstream saveStream; - saveStream << "S O " << GetBossSaveData() << " " << EventfieldOfSha; - return saveStream.str(); + data << EventfieldOfSha; } - void Load(const char* data) + void ReadSaveDataMore(std::istringstream& 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 == 'S' && dataHead2 == 'O') - { - for (uint32 i = 0; i < DATA_MAX; ++i) - { - uint32 tmpState; - loadStream >> tmpState; - if (tmpState == IN_PROGRESS || tmpState > SPECIAL) - tmpState = NOT_STARTED; - SetBossState(i, EncounterState(tmpState)); - } - loadStream >> EventfieldOfSha; - } - else - OUT_LOAD_INST_DATA_FAIL; - - OUT_LOAD_INST_DATA_COMPLETE; + data >> EventfieldOfSha; } bool CheckRequiredBosses(uint32 bossId, uint32 entry, Player const* player = NULL) const diff --git a/src/server/scripts/Pandaria/SiegeofOrgrimmar/siege_of_orgrimmar.h b/src/server/scripts/Pandaria/SiegeofOrgrimmar/siege_of_orgrimmar.h index 2ada74c7..e7e690ed 100644 --- a/src/server/scripts/Pandaria/SiegeofOrgrimmar/siege_of_orgrimmar.h +++ b/src/server/scripts/Pandaria/SiegeofOrgrimmar/siege_of_orgrimmar.h @@ -4,6 +4,8 @@ #ifndef SIEGEOFORGRIMMAR #define SIEGEOFORGRIMMAR +#define DataHeader "SOO" + #include "SpellScript.h" #include "Map.h" #include "Creature.h" diff --git a/src/server/scripts/Pandaria/StormstoutBrewery/instance_stormstout_brewery.cpp b/src/server/scripts/Pandaria/StormstoutBrewery/instance_stormstout_brewery.cpp index 8f030968..1e29e13e 100644 --- a/src/server/scripts/Pandaria/StormstoutBrewery/instance_stormstout_brewery.cpp +++ b/src/server/scripts/Pandaria/StormstoutBrewery/instance_stormstout_brewery.cpp @@ -10,7 +10,7 @@ class instance_stormstout_brewery : public InstanceMapScript struct instance_stormstout_brewery_InstanceMapScript : public InstanceScript { - instance_stormstout_brewery_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_stormstout_brewery_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} ObjectGuid ookookGuid; ObjectGuid hoptallusGuid; @@ -28,6 +28,7 @@ class instance_stormstout_brewery : public InstanceMapScript void Initialize() override { + SetHeaders(DataHeader); SetBossNumber(3); ookookGuid.Clear(); hoptallusGuid.Clear(); diff --git a/src/server/scripts/Pandaria/StormstoutBrewery/stormstout_brewery.h b/src/server/scripts/Pandaria/StormstoutBrewery/stormstout_brewery.h index c19b9e1b..a47c1816 100644 --- a/src/server/scripts/Pandaria/StormstoutBrewery/stormstout_brewery.h +++ b/src/server/scripts/Pandaria/StormstoutBrewery/stormstout_brewery.h @@ -3,6 +3,8 @@ #ifndef STORMSTOUT_BREWERY_H_ #define STORMSTOUT_BREWERY_H_ + +#define DataHeader "SSB" #define SBScriptName "instance_stormstout_brewery" enum DataTypes diff --git a/src/server/scripts/Pandaria/TempleJadeSerpent/instance_temple_of_jade_serpent.cpp b/src/server/scripts/Pandaria/TempleJadeSerpent/instance_temple_of_jade_serpent.cpp index 46fd1091..5ee22748 100644 --- a/src/server/scripts/Pandaria/TempleJadeSerpent/instance_temple_of_jade_serpent.cpp +++ b/src/server/scripts/Pandaria/TempleJadeSerpent/instance_temple_of_jade_serpent.cpp @@ -1,6 +1,8 @@ /*============== ==============*/ +#include "temple_of_jade_serpent.h" + enum eSpells { SPELL_CORRUPTED_WATERS = 115167, @@ -163,8 +165,10 @@ class instance_temple_of_jade_serpent : public InstanceMapScript uint8 countTank; uint8 countFigments; - instance_temple_of_jade_serpent_InstanceMapScript(Map* map) : InstanceScript(map) + instance_temple_of_jade_serpent_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); + // Wise Mari script doorWiseMari.Clear(); roomCenter.m_positionX = 1046.941f; diff --git a/src/server/scripts/Pandaria/TempleJadeSerpent/temple_of_jade_serpent.h b/src/server/scripts/Pandaria/TempleJadeSerpent/temple_of_jade_serpent.h new file mode 100644 index 00000000..63fb7c5c --- /dev/null +++ b/src/server/scripts/Pandaria/TempleJadeSerpent/temple_of_jade_serpent.h @@ -0,0 +1,6 @@ +#ifndef DEF_TEMPLEOFJADESERPENT_H +#define DEF_TEMPLEOFJADESERPENT_H + +#define DataHeader "TJS" + +#endif \ No newline at end of file diff --git a/src/server/scripts/Pandaria/TerraceEndlessSpring/instance_terrace_of_endless_spring.cpp b/src/server/scripts/Pandaria/TerraceEndlessSpring/instance_terrace_of_endless_spring.cpp index 1a2fb6af..bbffe489 100644 --- a/src/server/scripts/Pandaria/TerraceEndlessSpring/instance_terrace_of_endless_spring.cpp +++ b/src/server/scripts/Pandaria/TerraceEndlessSpring/instance_terrace_of_endless_spring.cpp @@ -34,7 +34,7 @@ class instance_terrace_of_endless_spring : public InstanceMapScript struct instance_terrace_of_endless_spring_InstanceMapScript : public InstanceScript { - instance_terrace_of_endless_spring_InstanceMapScript(Map* map) : InstanceScript(map) { } + instance_terrace_of_endless_spring_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } bool ritualOfPurification; bool introDone; @@ -68,6 +68,7 @@ class instance_terrace_of_endless_spring : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); SetBossNumber(DATA_MAX_BOSS_DATA); ritualOfPurification = true; diff --git a/src/server/scripts/Pandaria/TerraceEndlessSpring/terrace_of_endless_spring.h b/src/server/scripts/Pandaria/TerraceEndlessSpring/terrace_of_endless_spring.h index 40dd4e3d..81da6ee7 100644 --- a/src/server/scripts/Pandaria/TerraceEndlessSpring/terrace_of_endless_spring.h +++ b/src/server/scripts/Pandaria/TerraceEndlessSpring/terrace_of_endless_spring.h @@ -20,6 +20,8 @@ #ifndef TERRACE_OF_ENDLESS_SPRING_H_ #define TERRACE_OF_ENDLESS_SPRING_H_ +#define DataHeader "TES" + #include "SpellScript.h" #include "Map.h" #include "Creature.h" diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/instance_throne_of_thunder.cpp b/src/server/scripts/Pandaria/ThroneOfThunder/instance_throne_of_thunder.cpp index 88036d72..890b6058 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/instance_throne_of_thunder.cpp +++ b/src/server/scripts/Pandaria/ThroneOfThunder/instance_throne_of_thunder.cpp @@ -38,7 +38,7 @@ class instance_throne_of_thunder : public InstanceMapScript struct instance_throne_of_thunder_InstanceMapScript : public InstanceScript { - instance_throne_of_thunder_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_throne_of_thunder_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} //Special lists for Megaera heads mechanic GuidVector megaeralist; @@ -130,6 +130,7 @@ class instance_throne_of_thunder : public InstanceMapScript void Initialize() { + SetHeaders(DataHeader); SetBossNumber(16); LoadDoorData(doorData); @@ -1566,21 +1567,6 @@ class instance_throne_of_thunder : public InstanceMapScript if (nestnum >= nestmaxcount) nestnum = 0; } - - std::string GetSaveData() - { - std::ostringstream saveStream; - saveStream << GetBossSaveData() << " "; - return saveStream.str(); - } - - void Load(const char* data) - { - std::istringstream loadStream(LoadBossState(data)); - uint32 buff; - for (uint32 i = 0; i < 16; ++i) - loadStream >> buff; - } }; InstanceScript* GetInstanceScript(InstanceMap* map) const diff --git a/src/server/scripts/Pandaria/ThroneOfThunder/throne_of_thunder.h b/src/server/scripts/Pandaria/ThroneOfThunder/throne_of_thunder.h index 9da155e6..d333609c 100644 --- a/src/server/scripts/Pandaria/ThroneOfThunder/throne_of_thunder.h +++ b/src/server/scripts/Pandaria/ThroneOfThunder/throne_of_thunder.h @@ -4,6 +4,8 @@ #ifndef THRONEOFTHUNDER #define THRONEOFTHUNDER +#define DataHeader "TOT" + enum eData { DATA_STORM_CALLER = 1, //Mini Boss diff --git a/src/server/scripts/Scenario/ABrewingStorm/instance_a_brewing_storm.cpp b/src/server/scripts/Scenario/ABrewingStorm/instance_a_brewing_storm.cpp index 76cd83d2..5a5d06bd 100644 --- a/src/server/scripts/Scenario/ABrewingStorm/instance_a_brewing_storm.cpp +++ b/src/server/scripts/Scenario/ABrewingStorm/instance_a_brewing_storm.cpp @@ -32,7 +32,7 @@ class instance_a_brewing_storm : public InstanceMapScript struct instance_a_brewing_storm_InstanceMapScript : public InstanceScript { - instance_a_brewing_storm_InstanceMapScript(Map* map) : InstanceScript(map) + instance_a_brewing_storm_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/ALittlePatience/instance_a_little_patience.cpp b/src/server/scripts/Scenario/ALittlePatience/instance_a_little_patience.cpp index fa8b2ffd..4594b06e 100644 --- a/src/server/scripts/Scenario/ALittlePatience/instance_a_little_patience.cpp +++ b/src/server/scripts/Scenario/ALittlePatience/instance_a_little_patience.cpp @@ -32,7 +32,7 @@ class instance_a_little_patience : public InstanceMapScript struct instance_a_little_patience_InstanceMapScript : public InstanceScript { - instance_a_little_patience_InstanceMapScript(Map* map) : InstanceScript(map) + instance_a_little_patience_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/ArenaofAnnihilation/arena_of_annihilation.h b/src/server/scripts/Scenario/ArenaofAnnihilation/arena_of_annihilation.h index 758c0f26..f659b931 100644 --- a/src/server/scripts/Scenario/ArenaofAnnihilation/arena_of_annihilation.h +++ b/src/server/scripts/Scenario/ArenaofAnnihilation/arena_of_annihilation.h @@ -19,6 +19,8 @@ #ifndef DEF_ARENAOFANNIHILATION #define DEF_ARENAOFANNIHILATION +#define DataHeader "AOA" + enum eEnums { DATA_SCAR_SHELL = 1, diff --git a/src/server/scripts/Scenario/ArenaofAnnihilation/instance_arena_of_annihilation.cpp b/src/server/scripts/Scenario/ArenaofAnnihilation/instance_arena_of_annihilation.cpp index 6631c9d2..97c7e0f7 100644 --- a/src/server/scripts/Scenario/ArenaofAnnihilation/instance_arena_of_annihilation.cpp +++ b/src/server/scripts/Scenario/ArenaofAnnihilation/instance_arena_of_annihilation.cpp @@ -32,8 +32,9 @@ class instance_arena_of_annihilation : public InstanceMapScript struct instance_arena_of_annihilation_InstanceMapScript : public InstanceScript { - instance_arena_of_annihilation_InstanceMapScript(Map* map) : InstanceScript(map) + instance_arena_of_annihilation_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { + SetHeaders(DataHeader); SetBossNumber(MAX_ENCOUNTER); } diff --git a/src/server/scripts/Scenario/ArmyTraining/instance_army_training.cpp b/src/server/scripts/Scenario/ArmyTraining/instance_army_training.cpp index 8519b968..39dd5deb 100644 --- a/src/server/scripts/Scenario/ArmyTraining/instance_army_training.cpp +++ b/src/server/scripts/Scenario/ArmyTraining/instance_army_training.cpp @@ -47,7 +47,7 @@ class instance_army_training : public InstanceMapScript struct instance_army_training_InstanceMapScript : public InstanceScript { - instance_army_training_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_army_training_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} std::map chestsGuids{}; std::vector spectralChests{}; diff --git a/src/server/scripts/Scenario/Artifacts/Monk/TempleOfTheJadeSerpent/instance_temple_of_the_jade_serpent.cpp b/src/server/scripts/Scenario/Artifacts/Monk/TempleOfTheJadeSerpent/instance_temple_of_the_jade_serpent.cpp index dfd192d3..d32ee821 100644 --- a/src/server/scripts/Scenario/Artifacts/Monk/TempleOfTheJadeSerpent/instance_temple_of_the_jade_serpent.cpp +++ b/src/server/scripts/Scenario/Artifacts/Monk/TempleOfTheJadeSerpent/instance_temple_of_the_jade_serpent.cpp @@ -18,7 +18,7 @@ class instance_temple_of_the_jade_serpent : public InstanceMapScript struct instance_temple_of_the_jade_serpent_InstanceMapScript : public InstanceScript { - instance_temple_of_the_jade_serpent_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_temple_of_the_jade_serpent_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint8 diedCounter; ObjectGuid YulonGUID; diff --git a/src/server/scripts/Scenario/Artifacts/Paladin/BrokenShore/instance_broken_shore.cpp b/src/server/scripts/Scenario/Artifacts/Paladin/BrokenShore/instance_broken_shore.cpp index 89e480ab..f956f363 100644 --- a/src/server/scripts/Scenario/Artifacts/Paladin/BrokenShore/instance_broken_shore.cpp +++ b/src/server/scripts/Scenario/Artifacts/Paladin/BrokenShore/instance_broken_shore.cpp @@ -18,7 +18,7 @@ class instance_broken_shore : public InstanceMapScript struct instance_broken_shore_InstanceMapScript : public InstanceScript { - instance_broken_shore_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_broken_shore_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} std::list trashGUIDconteiner; std::list DoorGUIDconteiner; diff --git a/src/server/scripts/Scenario/Artifacts/Paladin/ShieldsRest/instance_shields_rest.cpp b/src/server/scripts/Scenario/Artifacts/Paladin/ShieldsRest/instance_shields_rest.cpp index e9218603..1cc2ac8d 100644 --- a/src/server/scripts/Scenario/Artifacts/Paladin/ShieldsRest/instance_shields_rest.cpp +++ b/src/server/scripts/Scenario/Artifacts/Paladin/ShieldsRest/instance_shields_rest.cpp @@ -20,7 +20,7 @@ class instance_shields_rest : public InstanceMapScript struct instance_shields_rest_InstanceMapScript : public InstanceScript { - instance_shields_rest_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_shields_rest_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} std::list goDoorList; std::list trashList; diff --git a/src/server/scripts/Scenario/Artifacts/Paladin/SilverHand/instance_silver_hand.cpp b/src/server/scripts/Scenario/Artifacts/Paladin/SilverHand/instance_silver_hand.cpp index 9217aef3..1e3ad6b0 100644 --- a/src/server/scripts/Scenario/Artifacts/Paladin/SilverHand/instance_silver_hand.cpp +++ b/src/server/scripts/Scenario/Artifacts/Paladin/SilverHand/instance_silver_hand.cpp @@ -18,7 +18,7 @@ class instance_silver_hand : public InstanceMapScript struct instance_silver_hand_InstanceMapScript : public InstanceScript { - instance_silver_hand_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_silver_hand_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} void OnCreatureCreate(Creature* creature) override { diff --git a/src/server/scripts/Scenario/Artifacts/Priest/Tuure/instance_tuure.cpp b/src/server/scripts/Scenario/Artifacts/Priest/Tuure/instance_tuure.cpp index a339e58d..4b813680 100644 --- a/src/server/scripts/Scenario/Artifacts/Priest/Tuure/instance_tuure.cpp +++ b/src/server/scripts/Scenario/Artifacts/Priest/Tuure/instance_tuure.cpp @@ -18,7 +18,7 @@ class instance_tuure : public InstanceMapScript struct instance_tuure_InstanceMapScript : public InstanceScript { - instance_tuure_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_tuure_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; // for respawn diff --git a/src/server/scripts/Scenario/Artifacts/Rogue/FangsoftheDevourer/instance_devourer.cpp b/src/server/scripts/Scenario/Artifacts/Rogue/FangsoftheDevourer/instance_devourer.cpp index 6fa70c92..67abe864 100644 --- a/src/server/scripts/Scenario/Artifacts/Rogue/FangsoftheDevourer/instance_devourer.cpp +++ b/src/server/scripts/Scenario/Artifacts/Rogue/FangsoftheDevourer/instance_devourer.cpp @@ -18,7 +18,7 @@ class instance_devourer : public InstanceMapScript struct instance_devourer_InstanceMapScript : public InstanceScript { - instance_devourer_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_devourer_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; // for respawn std::list trashGUIDconteiner; diff --git a/src/server/scripts/Scenario/Artifacts/Rogue/Kingslayers/instance_kingslayers.cpp b/src/server/scripts/Scenario/Artifacts/Rogue/Kingslayers/instance_kingslayers.cpp index 5f826061..e74d8481 100644 --- a/src/server/scripts/Scenario/Artifacts/Rogue/Kingslayers/instance_kingslayers.cpp +++ b/src/server/scripts/Scenario/Artifacts/Rogue/Kingslayers/instance_kingslayers.cpp @@ -18,7 +18,7 @@ class instance_kingslayers : public InstanceMapScript struct instance_kingslayers_InstanceMapScript : public InstanceScript { - instance_kingslayers_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_kingslayers_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; // for respawn diff --git a/src/server/scripts/Scenario/Artifacts/Shaman/Sharasdal/instance_sharasdal.cpp b/src/server/scripts/Scenario/Artifacts/Shaman/Sharasdal/instance_sharasdal.cpp index 11427afa..b101b851 100644 --- a/src/server/scripts/Scenario/Artifacts/Shaman/Sharasdal/instance_sharasdal.cpp +++ b/src/server/scripts/Scenario/Artifacts/Shaman/Sharasdal/instance_sharasdal.cpp @@ -18,7 +18,7 @@ class instance_sharasdal : public InstanceMapScript struct instance_sharasdal_InstanceMapScript : public InstanceScript { - instance_sharasdal_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_sharasdal_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; // for respawn diff --git a/src/server/scripts/Scenario/Artifacts/Warrior/Warswords/instance_warswords.cpp b/src/server/scripts/Scenario/Artifacts/Warrior/Warswords/instance_warswords.cpp index 0f5b31b8..d24deaa9 100644 --- a/src/server/scripts/Scenario/Artifacts/Warrior/Warswords/instance_warswords.cpp +++ b/src/server/scripts/Scenario/Artifacts/Warrior/Warswords/instance_warswords.cpp @@ -18,7 +18,7 @@ class instance_warswords : public InstanceMapScript struct instance_warswords_InstanceMapScript : public InstanceScript { - instance_warswords_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_warswords_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} uint32 outrotimer; bool jump; diff --git a/src/server/scripts/Scenario/AssaultBrokenShore/instance_AssaultBrokenShore.cpp b/src/server/scripts/Scenario/AssaultBrokenShore/instance_AssaultBrokenShore.cpp index 0ad04e12..cc2d7966 100644 --- a/src/server/scripts/Scenario/AssaultBrokenShore/instance_AssaultBrokenShore.cpp +++ b/src/server/scripts/Scenario/AssaultBrokenShore/instance_AssaultBrokenShore.cpp @@ -17,7 +17,7 @@ class instance_AssaultBrokenShore : public InstanceMapScript struct instance_AssaultBrokenShore_InstanceMapScript : public InstanceScript { - instance_AssaultBrokenShore_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_AssaultBrokenShore_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; // for respawn diff --git a/src/server/scripts/Scenario/AssoultOnZanvess/instance_assault_on_zanvess.cpp b/src/server/scripts/Scenario/AssoultOnZanvess/instance_assault_on_zanvess.cpp index 96d7eb0f..8fc0e6a8 100644 --- a/src/server/scripts/Scenario/AssoultOnZanvess/instance_assault_on_zanvess.cpp +++ b/src/server/scripts/Scenario/AssoultOnZanvess/instance_assault_on_zanvess.cpp @@ -32,7 +32,7 @@ class instance_assault_on_zanvess : public InstanceMapScript struct instance_assault_on_zanvess_InstanceMapScript : public InstanceScript { - instance_assault_on_zanvess_InstanceMapScript(Map* map) : InstanceScript(map) + instance_assault_on_zanvess_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/BattleOnTheHighSeas/instance_battle_on_the_high_seas.cpp b/src/server/scripts/Scenario/BattleOnTheHighSeas/instance_battle_on_the_high_seas.cpp index 43d5c340..917b4bf5 100644 --- a/src/server/scripts/Scenario/BattleOnTheHighSeas/instance_battle_on_the_high_seas.cpp +++ b/src/server/scripts/Scenario/BattleOnTheHighSeas/instance_battle_on_the_high_seas.cpp @@ -32,7 +32,7 @@ class instance_battle_on_the_high_seas : public InstanceMapScript struct instance_battle_on_the_high_seas_InstanceMapScript : public InstanceScript { - instance_battle_on_the_high_seas_InstanceMapScript(Map* map) : InstanceScript(map) + instance_battle_on_the_high_seas_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/BattlePetInstance/instance_dead_mines_pet.cpp b/src/server/scripts/Scenario/BattlePetInstance/instance_dead_mines_pet.cpp index ea4d0b4a..7a803d5c 100644 --- a/src/server/scripts/Scenario/BattlePetInstance/instance_dead_mines_pet.cpp +++ b/src/server/scripts/Scenario/BattlePetInstance/instance_dead_mines_pet.cpp @@ -16,7 +16,7 @@ class instance_dead_mines_per : public InstanceMapScript struct instance_dead_mines_per_InstanceMapScript : public InstanceScript { - instance_dead_mines_per_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_dead_mines_per_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} ObjectGuid first_step{}, third_step{}; diff --git a/src/server/scripts/Scenario/BattlePetInstance/instance_walling_caverns_pet.cpp b/src/server/scripts/Scenario/BattlePetInstance/instance_walling_caverns_pet.cpp index 45597653..a3971092 100644 --- a/src/server/scripts/Scenario/BattlePetInstance/instance_walling_caverns_pet.cpp +++ b/src/server/scripts/Scenario/BattlePetInstance/instance_walling_caverns_pet.cpp @@ -16,7 +16,7 @@ class instance_walling_caverns_pet : public InstanceMapScript struct instance_walling_caverns_pet_InstanceMapScript : public InstanceScript { - instance_walling_caverns_pet_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_walling_caverns_pet_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} std::list gobs{}; diff --git a/src/server/scripts/Scenario/BloodInTheSnow/instance_blood_in_the_snow.cpp b/src/server/scripts/Scenario/BloodInTheSnow/instance_blood_in_the_snow.cpp index d172521e..28128da5 100644 --- a/src/server/scripts/Scenario/BloodInTheSnow/instance_blood_in_the_snow.cpp +++ b/src/server/scripts/Scenario/BloodInTheSnow/instance_blood_in_the_snow.cpp @@ -32,7 +32,7 @@ class instance_blood_in_the_snow : public InstanceMapScript struct instance_blood_in_the_snow_InstanceMapScript : public InstanceScript { - instance_blood_in_the_snow_InstanceMapScript(Map* map) : InstanceScript(map) + instance_blood_in_the_snow_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/BrewmoonFestival/instance_brewmoon_festival.cpp b/src/server/scripts/Scenario/BrewmoonFestival/instance_brewmoon_festival.cpp index e30f104c..18250712 100644 --- a/src/server/scripts/Scenario/BrewmoonFestival/instance_brewmoon_festival.cpp +++ b/src/server/scripts/Scenario/BrewmoonFestival/instance_brewmoon_festival.cpp @@ -32,7 +32,7 @@ class instance_brewmoon_festival : public InstanceMapScript struct instance_brewmoon_festival_InstanceMapScript : public InstanceScript { - instance_brewmoon_festival_InstanceMapScript(Map* map) : InstanceScript(map) + instance_brewmoon_festival_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/BrokenIslands/instance_broken_islands.cpp b/src/server/scripts/Scenario/BrokenIslands/instance_broken_islands.cpp index 3fc02a38..139f4032 100644 --- a/src/server/scripts/Scenario/BrokenIslands/instance_broken_islands.cpp +++ b/src/server/scripts/Scenario/BrokenIslands/instance_broken_islands.cpp @@ -38,7 +38,7 @@ class instance_broken_islands : public InstanceMapScript struct instance_broken_islands_InstanceMapScript : public InstanceScript { - instance_broken_islands_InstanceMapScript(Map* map) : InstanceScript(map) + instance_broken_islands_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } diff --git a/src/server/scripts/Scenario/CelestialTournament/instance_celestial_tournament.cpp b/src/server/scripts/Scenario/CelestialTournament/instance_celestial_tournament.cpp index 98b8f715..6cdff590 100644 --- a/src/server/scripts/Scenario/CelestialTournament/instance_celestial_tournament.cpp +++ b/src/server/scripts/Scenario/CelestialTournament/instance_celestial_tournament.cpp @@ -32,7 +32,7 @@ class instance_celestial_tournament : public InstanceMapScript struct instance_celestial_tournament_InstanceMapScript : public InstanceScript { - instance_celestial_tournament_InstanceMapScript(Map* map) : InstanceScript(map) + instance_celestial_tournament_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/CryptOfForgottenKings/instance_crypt_of_forgotten_kings.cpp b/src/server/scripts/Scenario/CryptOfForgottenKings/instance_crypt_of_forgotten_kings.cpp index 8f1f94f2..2504e8e5 100644 --- a/src/server/scripts/Scenario/CryptOfForgottenKings/instance_crypt_of_forgotten_kings.cpp +++ b/src/server/scripts/Scenario/CryptOfForgottenKings/instance_crypt_of_forgotten_kings.cpp @@ -32,7 +32,7 @@ class instance_crypt_of_forgotten_kings : public InstanceMapScript struct instance_crypt_of_forgotten_kings_InstanceMapScript : public InstanceScript { - instance_crypt_of_forgotten_kings_InstanceMapScript(Map* map) : InstanceScript(map) + instance_crypt_of_forgotten_kings_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/DaggerInTheDark/instance_dagger_in_the_dark.cpp b/src/server/scripts/Scenario/DaggerInTheDark/instance_dagger_in_the_dark.cpp index 825b7ccf..4113bdcf 100644 --- a/src/server/scripts/Scenario/DaggerInTheDark/instance_dagger_in_the_dark.cpp +++ b/src/server/scripts/Scenario/DaggerInTheDark/instance_dagger_in_the_dark.cpp @@ -32,7 +32,7 @@ class instance_dagger_in_the_dark : public InstanceMapScript struct instance_dagger_in_the_dark_InstanceMapScript : public InstanceScript { - instance_dagger_in_the_dark_InstanceMapScript(Map* map) : InstanceScript(map) + instance_dagger_in_the_dark_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/DarkHeartOfPandaria/instance_dark_heart_of_pandaria.cpp b/src/server/scripts/Scenario/DarkHeartOfPandaria/instance_dark_heart_of_pandaria.cpp index e4bdd206..47470250 100644 --- a/src/server/scripts/Scenario/DarkHeartOfPandaria/instance_dark_heart_of_pandaria.cpp +++ b/src/server/scripts/Scenario/DarkHeartOfPandaria/instance_dark_heart_of_pandaria.cpp @@ -32,7 +32,7 @@ class instance_dark_heart_of_pandaria : public InstanceMapScript struct instance_dark_heart_of_pandaria_InstanceMapScript : public InstanceScript { - instance_dark_heart_of_pandaria_InstanceMapScript(Map* map) : InstanceScript(map) + instance_dark_heart_of_pandaria_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/DominationPoint/instance_domination_point.cpp b/src/server/scripts/Scenario/DominationPoint/instance_domination_point.cpp index 3d3f7489..855678f8 100644 --- a/src/server/scripts/Scenario/DominationPoint/instance_domination_point.cpp +++ b/src/server/scripts/Scenario/DominationPoint/instance_domination_point.cpp @@ -32,7 +32,7 @@ class instance_domination_point : public InstanceMapScript struct instance_domination_point_InstanceMapScript : public InstanceScript { - instance_domination_point_InstanceMapScript(Map* map) : InstanceScript(map) + instance_domination_point_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/FallofShanBu/instance_fall_of_shan_bu.cpp b/src/server/scripts/Scenario/FallofShanBu/instance_fall_of_shan_bu.cpp index f85d8bb1..8c0ee913 100644 --- a/src/server/scripts/Scenario/FallofShanBu/instance_fall_of_shan_bu.cpp +++ b/src/server/scripts/Scenario/FallofShanBu/instance_fall_of_shan_bu.cpp @@ -32,7 +32,7 @@ class instance_fall_of_shan_bu : public InstanceMapScript struct instance_fall_of_shan_bu_InstanceMapScript : public InstanceScript { - instance_fall_of_shan_bu_InstanceMapScript(Map* map) : InstanceScript(map) + instance_fall_of_shan_bu_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/GreenstoneVillage/instance_greenstone_villaget.cpp b/src/server/scripts/Scenario/GreenstoneVillage/instance_greenstone_villaget.cpp index 804ed5ef..266a86ef 100644 --- a/src/server/scripts/Scenario/GreenstoneVillage/instance_greenstone_villaget.cpp +++ b/src/server/scripts/Scenario/GreenstoneVillage/instance_greenstone_villaget.cpp @@ -32,7 +32,7 @@ class instance_greenstone_village : public InstanceMapScript struct instance_greenstone_village_InstanceMapScript : public InstanceScript { - instance_greenstone_village_InstanceMapScript(Map* map) : InstanceScript(map) + instance_greenstone_village_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/LegionInvasion/Azsuna/instance_InvasionAzsuna.cpp b/src/server/scripts/Scenario/LegionInvasion/Azsuna/instance_InvasionAzsuna.cpp index 750c9564..77dfb6cd 100644 --- a/src/server/scripts/Scenario/LegionInvasion/Azsuna/instance_InvasionAzsuna.cpp +++ b/src/server/scripts/Scenario/LegionInvasion/Azsuna/instance_InvasionAzsuna.cpp @@ -17,7 +17,7 @@ class instance_InvasionAzsuna : public InstanceMapScript struct instance_InvasionAzsuna_InstanceMapScript : public InstanceScript { - instance_InvasionAzsuna_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_InvasionAzsuna_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; // for respawn ObjectGuid bombarder_guid; diff --git a/src/server/scripts/Scenario/LegionInvasion/HighMountain/instance_InvasionHM.cpp b/src/server/scripts/Scenario/LegionInvasion/HighMountain/instance_InvasionHM.cpp index 6649203a..371a0fb0 100644 --- a/src/server/scripts/Scenario/LegionInvasion/HighMountain/instance_InvasionHM.cpp +++ b/src/server/scripts/Scenario/LegionInvasion/HighMountain/instance_InvasionHM.cpp @@ -17,7 +17,7 @@ class instance_invasion_HM : public InstanceMapScript struct instance_invasion_HM_InstanceMapScript : public InstanceScript { - instance_invasion_HM_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_invasion_HM_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; // for respawn diff --git a/src/server/scripts/Scenario/LegionInvasion/Stormheim/instance_InvasionStormheim.cpp b/src/server/scripts/Scenario/LegionInvasion/Stormheim/instance_InvasionStormheim.cpp index 68d2b1c5..5eadc78f 100644 --- a/src/server/scripts/Scenario/LegionInvasion/Stormheim/instance_InvasionStormheim.cpp +++ b/src/server/scripts/Scenario/LegionInvasion/Stormheim/instance_InvasionStormheim.cpp @@ -19,7 +19,7 @@ class instance_invasion_stormheim : public InstanceMapScript struct instance_invasion_stormheim_InstanceMapScript : public InstanceScript { - instance_invasion_stormheim_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_invasion_stormheim_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; // for respawn diff --git a/src/server/scripts/Scenario/LegionInvasion/Valshara/instance_InvasionValshara.cpp b/src/server/scripts/Scenario/LegionInvasion/Valshara/instance_InvasionValshara.cpp index 34080c86..ed86f200 100644 --- a/src/server/scripts/Scenario/LegionInvasion/Valshara/instance_InvasionValshara.cpp +++ b/src/server/scripts/Scenario/LegionInvasion/Valshara/instance_InvasionValshara.cpp @@ -19,7 +19,7 @@ class instance_invasion_valshara : public InstanceMapScript struct instance_invasion_valshara_InstanceMapScript : public InstanceScript { - instance_invasion_valshara_InstanceMapScript(Map* map) : InstanceScript(map) {} + instance_invasion_valshara_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} WorldLocation loc_res_pla; // for respawn GuidList StartedGroup; diff --git a/src/server/scripts/Scenario/LionsLanding/instance_lions_landing.cpp b/src/server/scripts/Scenario/LionsLanding/instance_lions_landing.cpp index c46fb6d4..1244de9f 100644 --- a/src/server/scripts/Scenario/LionsLanding/instance_lions_landing.cpp +++ b/src/server/scripts/Scenario/LionsLanding/instance_lions_landing.cpp @@ -32,7 +32,7 @@ class instance_lions_landing : public InstanceMapScript struct instance_lions_landing_InstanceMapScript : public InstanceScript { - instance_lions_landing_InstanceMapScript(Map* map) : InstanceScript(map) + instance_lions_landing_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/ProvingGrounds/instance_proving_grounds.cpp b/src/server/scripts/Scenario/ProvingGrounds/instance_proving_grounds.cpp index 7b877a03..d47e26b8 100644 --- a/src/server/scripts/Scenario/ProvingGrounds/instance_proving_grounds.cpp +++ b/src/server/scripts/Scenario/ProvingGrounds/instance_proving_grounds.cpp @@ -13,7 +13,7 @@ class instance_proving_grounds : public InstanceMapScript struct instance_proving_grounds_InstanceMapScript : public InstanceScript { - instance_proving_grounds_InstanceMapScript(Map* map) : InstanceScript(map) + instance_proving_grounds_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/PursuingTheBlackHarvest/instance_pursuing_the_black_harvest.cpp b/src/server/scripts/Scenario/PursuingTheBlackHarvest/instance_pursuing_the_black_harvest.cpp index 0cfe73e7..a93ee086 100644 --- a/src/server/scripts/Scenario/PursuingTheBlackHarvest/instance_pursuing_the_black_harvest.cpp +++ b/src/server/scripts/Scenario/PursuingTheBlackHarvest/instance_pursuing_the_black_harvest.cpp @@ -31,7 +31,7 @@ class instance_pursuing_the_black_harvest : public InstanceMapScript struct instance_pursuing_the_black_harvest_InstanceMapScript : public InstanceScript { - instance_pursuing_the_black_harvest_InstanceMapScript(Map* map) : InstanceScript(map) + instance_pursuing_the_black_harvest_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/TheSecretsOfRagefire/instance_the_secrets_of_ragefire.cpp b/src/server/scripts/Scenario/TheSecretsOfRagefire/instance_the_secrets_of_ragefire.cpp index 83ae79b9..2f1142e8 100644 --- a/src/server/scripts/Scenario/TheSecretsOfRagefire/instance_the_secrets_of_ragefire.cpp +++ b/src/server/scripts/Scenario/TheSecretsOfRagefire/instance_the_secrets_of_ragefire.cpp @@ -32,7 +32,7 @@ class instance_the_secrets_of_ragefire : public InstanceMapScript struct instance_the_secrets_of_ragefire_InstanceMapScript : public InstanceScript { - instance_the_secrets_of_ragefire_InstanceMapScript(Map* map) : InstanceScript(map) + instance_the_secrets_of_ragefire_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/ThunderForge/instance_thunder_forge.cpp b/src/server/scripts/Scenario/ThunderForge/instance_thunder_forge.cpp index 1ccf8d84..ab256617 100644 --- a/src/server/scripts/Scenario/ThunderForge/instance_thunder_forge.cpp +++ b/src/server/scripts/Scenario/ThunderForge/instance_thunder_forge.cpp @@ -32,7 +32,7 @@ class instance_thunder_forge : public InstanceMapScript struct instance_thunder_forge_InstanceMapScript : public InstanceScript { - instance_thunder_forge_InstanceMapScript(Map* map) : InstanceScript(map) + instance_thunder_forge_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/TrovesOfTheThunderKing/instance_troves_of_the_thunder_king.cpp b/src/server/scripts/Scenario/TrovesOfTheThunderKing/instance_troves_of_the_thunder_king.cpp index ba55d94c..e68a8f11 100644 --- a/src/server/scripts/Scenario/TrovesOfTheThunderKing/instance_troves_of_the_thunder_king.cpp +++ b/src/server/scripts/Scenario/TrovesOfTheThunderKing/instance_troves_of_the_thunder_king.cpp @@ -31,7 +31,7 @@ class instance_troves_of_the_thunder_king : public InstanceMapScript struct instance_troves_of_the_thunder_king_InstanceMapScript : public InstanceScript { - instance_troves_of_the_thunder_king_InstanceMapScript(Map* map) : InstanceScript(map) + instance_troves_of_the_thunder_king_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/Scenario/UngaIngoo/instance_unga_ingoo.cpp b/src/server/scripts/Scenario/UngaIngoo/instance_unga_ingoo.cpp index f09740f6..93b45445 100644 --- a/src/server/scripts/Scenario/UngaIngoo/instance_unga_ingoo.cpp +++ b/src/server/scripts/Scenario/UngaIngoo/instance_unga_ingoo.cpp @@ -32,7 +32,7 @@ class instance_unga_ingoo : public InstanceMapScript struct instance_unga_ingoo_InstanceMapScript : public InstanceScript { - instance_unga_ingoo_InstanceMapScript(Map* map) : InstanceScript(map) + instance_unga_ingoo_InstanceMapScript(InstanceMap* map) : InstanceScript(map) { } void Initialize() override diff --git a/src/server/scripts/ScriptLoader.cpp b/src/server/scripts/ScriptLoader.cpp index 647f7e32..756ab63f 100644 --- a/src/server/scripts/ScriptLoader.cpp +++ b/src/server/scripts/ScriptLoader.cpp @@ -132,6 +132,11 @@ void AddSC_boss_setesh(); void AddSC_boss_rajh(); //kalimdor +void AddSC_boss_adarogg(); +void AddSC_boss_dark_shaman_koranthal(); +void AddSC_boss_slagmaw(); +void AddSC_boss_lava_guard_gordoth(); +void AddSC_instance_ragefire_chasm(); void AddSC_blackfathom_deeps(); //Blackfathom Depths void AddSC_boss_gelihast(); void AddSC_boss_kelris(); @@ -1414,6 +1419,11 @@ void AddKalimdorScripts() AddSC_boss_rajh(); + AddSC_boss_adarogg(); + AddSC_boss_dark_shaman_koranthal(); + AddSC_boss_slagmaw(); + AddSC_boss_lava_guard_gordoth(); + AddSC_instance_ragefire_chasm(); AddSC_blackfathom_deeps(); //Blackfathom Depths AddSC_boss_gelihast(); AddSC_boss_kelris(); diff --git a/src/server/scripts/World/garrison/instance_garr.cpp b/src/server/scripts/World/garrison/instance_garr.cpp index 2559a8dd..7f908038 100644 --- a/src/server/scripts/World/garrison/instance_garr.cpp +++ b/src/server/scripts/World/garrison/instance_garr.cpp @@ -29,7 +29,7 @@ class wod_garrisone_horde_lvl1 : public InstanceMapScript struct wod_garrisone_horde_lvl1_InstanceMapScript : public InstanceScript { - wod_garrisone_horde_lvl1_InstanceMapScript(Map* map) : InstanceScript(map) {} + wod_garrisone_horde_lvl1_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} void Initialize() override { @@ -90,7 +90,7 @@ class wod_garrisone_alliance_lvl1 : public InstanceMapScript struct wod_garrisone_alliance_lvl1_InstanceMapScript : public InstanceScript { - wod_garrisone_alliance_lvl1_InstanceMapScript(Map* map) : InstanceScript(map) {} + wod_garrisone_alliance_lvl1_InstanceMapScript(InstanceMap* map) : InstanceScript(map) {} void Initialize() override {