* Rename InstanceData to InstanceScript
* Rename *mgr to their new names in scripts project * Mass convert all the scripts (NEEDS THOROUGH TESTING, because it was done automatically) Please, report bugs on issue tracker. --HG-- branch : trunk rename : src/server/game/Instances/InstanceData.cpp => src/server/game/Instances/InstanceScript.cpp rename : src/server/game/Instances/InstanceData.h => src/server/game/Instances/InstanceScript.h
This commit is contained in:
@@ -37,7 +37,7 @@
|
||||
#include "ObjectMgr.h"
|
||||
#include "World.h"
|
||||
#include "Group.h"
|
||||
#include "InstanceData.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "ProgressBar.h"
|
||||
|
||||
|
||||
@@ -169,7 +169,7 @@ void InstanceSave::SaveToDB()
|
||||
if (map)
|
||||
{
|
||||
ASSERT(map->IsDungeon());
|
||||
if (InstanceData *iData = ((InstanceMap*)map)->GetInstanceData())
|
||||
if (InstanceScript *iData = ((InstanceMap*)map)->GetInstanceScript())
|
||||
{
|
||||
data = iData->GetSaveData();
|
||||
if (!data.empty())
|
||||
|
||||
+27
-27
@@ -18,7 +18,7 @@
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "InstanceData.h"
|
||||
#include "InstanceScript.h"
|
||||
#include "DatabaseEnv.h"
|
||||
#include "Map.h"
|
||||
#include "Player.h"
|
||||
@@ -27,7 +27,7 @@
|
||||
#include "CreatureAI.h"
|
||||
#include "Log.h"
|
||||
|
||||
void InstanceData::SaveToDB()
|
||||
void InstanceScript::SaveToDB()
|
||||
{
|
||||
std::string data = GetSaveData();
|
||||
if (data.empty())
|
||||
@@ -36,17 +36,17 @@ void InstanceData::SaveToDB()
|
||||
CharacterDatabase.PExecute("UPDATE instance SET data = '%s' WHERE id = '%d'", data.c_str(), instance->GetInstanceId());
|
||||
}
|
||||
|
||||
void InstanceData::HandleGameObject(uint64 GUID, bool open, GameObject *go)
|
||||
void InstanceScript::HandleGameObject(uint64 GUID, bool open, GameObject *go)
|
||||
{
|
||||
if (!go)
|
||||
go = instance->GetGameObject(GUID);
|
||||
if (go)
|
||||
go->SetGoState(open ? GO_STATE_ACTIVE : GO_STATE_READY);
|
||||
else
|
||||
sLog.outDebug("TSCR: InstanceData: HandleGameObject failed");
|
||||
sLog.outDebug("TSCR: InstanceScript: HandleGameObject failed");
|
||||
}
|
||||
|
||||
bool InstanceData::IsEncounterInProgress() const
|
||||
bool InstanceScript::IsEncounterInProgress() const
|
||||
{
|
||||
for (std::vector<BossInfo>::const_iterator itr = bosses.begin(); itr != bosses.end(); ++itr)
|
||||
if (itr->state == IN_PROGRESS)
|
||||
@@ -55,7 +55,7 @@ bool InstanceData::IsEncounterInProgress() const
|
||||
return false;
|
||||
}
|
||||
|
||||
void InstanceData::LoadMinionData(const MinionData *data)
|
||||
void InstanceScript::LoadMinionData(const MinionData *data)
|
||||
{
|
||||
while (data->entry)
|
||||
{
|
||||
@@ -64,10 +64,10 @@ void InstanceData::LoadMinionData(const MinionData *data)
|
||||
|
||||
++data;
|
||||
}
|
||||
sLog.outDebug("InstanceData::LoadMinionData: %u minions loaded.", doors.size());
|
||||
sLog.outDebug("InstanceScript::LoadMinionData: %u minions loaded.", doors.size());
|
||||
}
|
||||
|
||||
void InstanceData::LoadDoorData(const DoorData *data)
|
||||
void InstanceScript::LoadDoorData(const DoorData *data)
|
||||
{
|
||||
while (data->entry)
|
||||
{
|
||||
@@ -76,10 +76,10 @@ void InstanceData::LoadDoorData(const DoorData *data)
|
||||
|
||||
++data;
|
||||
}
|
||||
sLog.outDebug("InstanceData::LoadDoorData: %u doors loaded.", doors.size());
|
||||
sLog.outDebug("InstanceScript::LoadDoorData: %u doors loaded.", doors.size());
|
||||
}
|
||||
|
||||
void InstanceData::UpdateMinionState(Creature *minion, EncounterState state)
|
||||
void InstanceScript::UpdateMinionState(Creature *minion, EncounterState state)
|
||||
{
|
||||
switch (state)
|
||||
{
|
||||
@@ -98,7 +98,7 @@ void InstanceData::UpdateMinionState(Creature *minion, EncounterState state)
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceData::UpdateDoorState(GameObject *door)
|
||||
void InstanceScript::UpdateDoorState(GameObject *door)
|
||||
{
|
||||
DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry());
|
||||
DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry());
|
||||
@@ -130,7 +130,7 @@ void InstanceData::UpdateDoorState(GameObject *door)
|
||||
//sLog.outError("Door %u is %s.", door->GetEntry(), open ? "opened" : "closed");
|
||||
}
|
||||
|
||||
void InstanceData::AddDoor(GameObject *door, bool add)
|
||||
void InstanceScript::AddDoor(GameObject *door, bool add)
|
||||
{
|
||||
DoorInfoMap::iterator lower = doors.lower_bound(door->GetEntry());
|
||||
DoorInfoMap::iterator upper = doors.upper_bound(door->GetEntry());
|
||||
@@ -173,7 +173,7 @@ void InstanceData::AddDoor(GameObject *door, bool add)
|
||||
UpdateDoorState(door);
|
||||
}
|
||||
|
||||
void InstanceData::AddMinion(Creature *minion, bool add)
|
||||
void InstanceScript::AddMinion(Creature *minion, bool add)
|
||||
{
|
||||
MinionInfoMap::iterator itr = minions.find(minion->GetEntry());
|
||||
if (itr == minions.end())
|
||||
@@ -185,7 +185,7 @@ void InstanceData::AddMinion(Creature *minion, bool add)
|
||||
itr->second.bossInfo->minion.erase(minion);
|
||||
}
|
||||
|
||||
bool InstanceData::SetBossState(uint32 id, EncounterState state)
|
||||
bool InstanceScript::SetBossState(uint32 id, EncounterState state)
|
||||
{
|
||||
if (id < bosses.size())
|
||||
{
|
||||
@@ -222,7 +222,7 @@ bool InstanceData::SetBossState(uint32 id, EncounterState state)
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string InstanceData::LoadBossState(const char * data)
|
||||
std::string InstanceScript::LoadBossState(const char * data)
|
||||
{
|
||||
if (!data)
|
||||
return NULL;
|
||||
@@ -238,7 +238,7 @@ std::string InstanceData::LoadBossState(const char * data)
|
||||
return loadStream.str();
|
||||
}
|
||||
|
||||
std::string InstanceData::GetBossSaveData()
|
||||
std::string InstanceScript::GetBossSaveData()
|
||||
{
|
||||
std::ostringstream saveStream;
|
||||
for (std::vector<BossInfo>::iterator i = bosses.begin(); i != bosses.end(); ++i)
|
||||
@@ -246,7 +246,7 @@ std::string InstanceData::GetBossSaveData()
|
||||
return saveStream.str();
|
||||
}
|
||||
|
||||
void InstanceData::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, bool bUseAlternativeState)
|
||||
void InstanceScript::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, bool bUseAlternativeState)
|
||||
{
|
||||
if (!uiGuid)
|
||||
return;
|
||||
@@ -267,7 +267,7 @@ void InstanceData::DoUseDoorOrButton(uint64 uiGuid, uint32 uiWithRestoreTime, bo
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceData::DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn)
|
||||
void InstanceScript::DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn)
|
||||
{
|
||||
if (GameObject* pGo = instance->GetGameObject(uiGuid))
|
||||
{
|
||||
@@ -283,7 +283,7 @@ void InstanceData::DoRespawnGameObject(uint64 uiGuid, uint32 uiTimeToDespawn)
|
||||
}
|
||||
}
|
||||
|
||||
void InstanceData::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
|
||||
void InstanceScript::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
|
||||
{
|
||||
Map::PlayerList const& lPlayers = instance->GetPlayers();
|
||||
|
||||
@@ -298,7 +298,7 @@ void InstanceData::DoUpdateWorldState(uint32 uiStateId, uint32 uiStateData)
|
||||
}
|
||||
|
||||
// Send Notify to all players in instance
|
||||
void InstanceData::DoSendNotifyToInstance(const char *format, ...)
|
||||
void InstanceScript::DoSendNotifyToInstance(const char *format, ...)
|
||||
{
|
||||
InstanceMap::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
InstanceMap::PlayerList::const_iterator i;
|
||||
@@ -311,7 +311,7 @@ void InstanceData::DoSendNotifyToInstance(const char *format, ...)
|
||||
}
|
||||
|
||||
// Complete Achievement for all players in instance
|
||||
void InstanceData::DoCompleteAchievement(uint32 achievement)
|
||||
void InstanceScript::DoCompleteAchievement(uint32 achievement)
|
||||
{
|
||||
AchievementEntry const* pAE = GetAchievementStore()->LookupEntry(achievement);
|
||||
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
@@ -329,7 +329,7 @@ void InstanceData::DoCompleteAchievement(uint32 achievement)
|
||||
}
|
||||
|
||||
// Update Achievement Criteria for all players in instance
|
||||
void InstanceData::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2, Unit *unit, uint32 time)
|
||||
void InstanceScript::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, uint32 miscvalue1, uint32 miscvalue2, Unit *unit, uint32 time)
|
||||
{
|
||||
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
|
||||
@@ -340,7 +340,7 @@ void InstanceData::DoUpdateAchievementCriteria(AchievementCriteriaTypes type, ui
|
||||
}
|
||||
|
||||
// Start timed achievement for all players in instance
|
||||
void InstanceData::DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
|
||||
void InstanceScript::DoStartTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
|
||||
{
|
||||
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
|
||||
@@ -351,7 +351,7 @@ void InstanceData::DoStartTimedAchievement(AchievementCriteriaTimedTypes type, u
|
||||
}
|
||||
|
||||
// Stop timed achievement for all players in instance
|
||||
void InstanceData::DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
|
||||
void InstanceScript::DoStopTimedAchievement(AchievementCriteriaTimedTypes type, uint32 entry)
|
||||
{
|
||||
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
|
||||
@@ -362,7 +362,7 @@ void InstanceData::DoStopTimedAchievement(AchievementCriteriaTimedTypes type, ui
|
||||
}
|
||||
|
||||
// Remove Auras due to Spell on all players in instance
|
||||
void InstanceData::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
|
||||
void InstanceScript::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
|
||||
{
|
||||
Map::PlayerList const &PlayerList = instance->GetPlayers();
|
||||
|
||||
@@ -372,9 +372,9 @@ void InstanceData::DoRemoveAurasDueToSpellOnPlayers(uint32 spell)
|
||||
pPlayer->RemoveAurasDueToSpell(spell);
|
||||
}
|
||||
|
||||
bool InstanceData::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/)
|
||||
bool InstanceScript::CheckAchievementCriteriaMeet(uint32 criteria_id, Player const* /*source*/, Unit const* /*target*/ /*= NULL*/, uint32 /*miscvalue1*/ /*= 0*/)
|
||||
{
|
||||
sLog.outError("Achievement system call InstanceData::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
|
||||
sLog.outError("Achievement system call InstanceScript::CheckAchievementCriteriaMeet but instance script for map %u not have implementation for achievement criteria %u",
|
||||
instance->GetId(),criteria_id);
|
||||
return false;
|
||||
}
|
||||
+9
-3
@@ -26,6 +26,12 @@
|
||||
//#include "GameObject.h"
|
||||
//#include "Map.h"
|
||||
|
||||
#define OUT_SAVE_INST_DATA sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d)", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_SAVE_INST_DATA_COMPLETE sLog.outDebug("TSCR: Saving Instance Data for Instance %s (Map %d, Instance Id %d) completed.", instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
#define OUT_LOAD_INST_DATA(a) sLog.outDebug("TSCR: Loading Instance Data for Instance %s (Map %d, Instance Id %d). Input is '%s'", instance->GetMapName(), instance->GetId(), instance->GetInstanceId(), a)
|
||||
#define OUT_LOAD_INST_DATA_COMPLETE sLog.outDebug("TSCR: 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 sLog.outError("TSCR: Unable to load Instance Data for Instance %s (Map %d, Instance Id: %d).",instance->GetMapName(), instance->GetId(), instance->GetInstanceId())
|
||||
|
||||
class Map;
|
||||
class Unit;
|
||||
class Player;
|
||||
@@ -110,12 +116,12 @@ struct MinionInfo
|
||||
typedef std::multimap<uint32 /*entry*/, DoorInfo> DoorInfoMap;
|
||||
typedef std::map<uint32 /*entry*/, MinionInfo> MinionInfoMap;
|
||||
|
||||
class InstanceData : public ZoneScript
|
||||
class InstanceScript : public ZoneScript
|
||||
{
|
||||
public:
|
||||
|
||||
explicit InstanceData(Map *map) : instance(map) {}
|
||||
virtual ~InstanceData() {}
|
||||
explicit InstanceScript(Map *map) : instance(map) {}
|
||||
virtual ~InstanceScript() {}
|
||||
|
||||
Map *instance;
|
||||
|
||||
Reference in New Issue
Block a user