diff options
author | Shauren <none@none> | 2010-08-06 13:47:17 +0200 |
---|---|---|
committer | Shauren <none@none> | 2010-08-06 13:47:17 +0200 |
commit | 07348ff4af2ff0fe7a300129896dc4ec8db431cc (patch) | |
tree | 427d0e9ad52dbb9522cde86bb8b7c492d765c231 /src | |
parent | 6a202826e6c10ce722af7e86b11e015ead33aa6b (diff) |
Added ScriptName to battleground_template for script system rewrite
--HG--
branch : trunk
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/BattleGrounds/BattleGround.h | 3 | ||||
-rw-r--r-- | src/server/game/BattleGrounds/BattleGroundMgr.cpp | 11 | ||||
-rw-r--r-- | src/server/game/BattleGrounds/BattleGroundMgr.h | 2 | ||||
-rw-r--r-- | src/server/game/Globals/ObjectMgr.cpp | 2 |
4 files changed, 13 insertions, 5 deletions
diff --git a/src/server/game/BattleGrounds/BattleGround.h b/src/server/game/BattleGrounds/BattleGround.h index 6f46b6f8f6d..586f0293d96 100644 --- a/src/server/game/BattleGrounds/BattleGround.h +++ b/src/server/game/BattleGrounds/BattleGround.h @@ -368,6 +368,7 @@ class BattleGround int32 GetStartDelayTime() const { return m_StartDelayTime; } uint8 GetArenaType() const { return m_ArenaType; } uint8 GetWinner() const { return m_Winner; } + uint32 GetScriptId() const { return ScriptId; } uint32 GetBattlemasterEntry() const; uint32 GetBonusHonorFromKill(uint32 kills) const; bool IsRandom() { return m_IsRandom; } @@ -391,6 +392,7 @@ class BattleGround void SetArenaType(uint8 type) { m_ArenaType = type; } void SetArenaorBGType(bool _isArena) { m_IsArena = _isArena; } void SetWinner(uint8 winner) { m_Winner = winner; } + void SetScriptId(uint32 scriptId) { ScriptId = scriptId; } void ModifyStartDelayTime(int diff) { m_StartDelayTime -= diff; } void SetStartDelayTime(int Time) { m_StartDelayTime = Time; } @@ -659,6 +661,7 @@ class BattleGround float m_TeamStartLocY[BG_TEAMS_COUNT]; float m_TeamStartLocZ[BG_TEAMS_COUNT]; float m_TeamStartLocO[BG_TEAMS_COUNT]; + uint32 ScriptId; }; #endif diff --git a/src/server/game/BattleGrounds/BattleGroundMgr.cpp b/src/server/game/BattleGrounds/BattleGroundMgr.cpp index 5cee72e7570..d3440cb0d37 100644 --- a/src/server/game/BattleGrounds/BattleGroundMgr.cpp +++ b/src/server/game/BattleGrounds/BattleGroundMgr.cpp @@ -1672,7 +1672,7 @@ BattleGround * BattleGroundMgr::CreateNewBattleGround(BattleGroundTypeId bgTypeI } // used to create the BG templates -uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO) +uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, uint32 scriptId) { // Create the BG BattleGround *bg = NULL; @@ -1708,6 +1708,7 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA bg->SetTeamStartLoc(ALLIANCE, Team1StartLocX, Team1StartLocY, Team1StartLocZ, Team1StartLocO); bg->SetTeamStartLoc(HORDE, Team2StartLocX, Team2StartLocY, Team2StartLocZ, Team2StartLocO); bg->SetLevelRange(LevelMin, LevelMax); + bg->SetScriptId(scriptId); // add bg to update list AddBattleGround(bg->GetInstanceID(), bg->GetTypeID(), bg); @@ -1725,11 +1726,12 @@ void BattleGroundMgr::CreateInitialBattleGrounds() BattlemasterListEntry const *bl; WorldSafeLocsEntry const *start; bool IsArena; + uint32 scriptId = 0; uint32 count = 0; - // 0 1 2 3 4 5 6 7 8 9 - QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO,Weight FROM battleground_template"); + // 0 1 2 3 4 5 6 7 8 9 10 + QueryResult_AutoPtr result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO,Weight,ScriptName FROM battleground_template"); if (!result) { @@ -1828,8 +1830,9 @@ void BattleGroundMgr::CreateInitialBattleGrounds() } selectionWeight = fields[9].GetUInt8(); + scriptId = objmgr.GetScriptId(fields[10].GetString()); //sLog.outDetail("Creating battleground %s, %u-%u", bl->name[sWorld.GetDBClang()], MinLvl, MaxLvl); - if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3])) + if (!CreateBattleGround(bgTypeID, IsArena, MinPlayersPerTeam, MaxPlayersPerTeam, MinLvl, MaxLvl, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3], scriptId)) continue; if (IsArena) diff --git a/src/server/game/BattleGrounds/BattleGroundMgr.h b/src/server/game/BattleGrounds/BattleGroundMgr.h index 13067040f03..9ac52c13be8 100644 --- a/src/server/game/BattleGrounds/BattleGroundMgr.h +++ b/src/server/game/BattleGrounds/BattleGroundMgr.h @@ -207,7 +207,7 @@ class BattleGroundMgr BattleGround* GetBattleGroundTemplate(BattleGroundTypeId bgTypeId); BattleGround* CreateNewBattleGround(BattleGroundTypeId bgTypeId, PvPDifficultyEntry const* bracketEntry, uint8 arenaType, bool isRated); - uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO); + uint32 CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsArena, uint32 MinPlayersPerTeam, uint32 MaxPlayersPerTeam, uint32 LevelMin, uint32 LevelMax, char* BattleGroundName, uint32 MapID, float Team1StartLocX, float Team1StartLocY, float Team1StartLocZ, float Team1StartLocO, float Team2StartLocX, float Team2StartLocY, float Team2StartLocZ, float Team2StartLocO, uint32 scriptId); void AddBattleGround(uint32 InstanceID, BattleGroundTypeId bgTypeId, BattleGround* BG) { m_BattleGrounds[bgTypeId][InstanceID] = BG; }; void RemoveBattleGround(uint32 instanceID, BattleGroundTypeId bgTypeId) { m_BattleGrounds[bgTypeId].erase(instanceID); } diff --git a/src/server/game/Globals/ObjectMgr.cpp b/src/server/game/Globals/ObjectMgr.cpp index 299d2590c36..d687afbc089 100644 --- a/src/server/game/Globals/ObjectMgr.cpp +++ b/src/server/game/Globals/ObjectMgr.cpp @@ -8730,6 +8730,8 @@ void ObjectMgr::LoadScriptNames() { m_scriptNames.push_back(""); QueryResult_AutoPtr result = WorldDatabase.Query( + "SELECT DISTINCT(ScriptName) FROM battleground_template WHERE ScriptName <> '' " + "UNION " "SELECT DISTINCT(ScriptName) FROM creature_template WHERE ScriptName <> '' " "UNION " "SELECT DISTINCT(ScriptName) FROM gameobject_template WHERE ScriptName <> '' " |