mirror of
https://github.com/mangosfour/server.git
synced 2025-12-26 07:37:02 +00:00
[9763] Use min/max BG/arena levels from DBC. Update table content.
* Use min/mac level from dbc because anyway list real selectable for player level bg/arena backets set min/max range. * Drop related fields and update per team min/max values.
This commit is contained in:
parent
c5974b8a7e
commit
b2fefc2ca9
8 changed files with 58 additions and 53 deletions
|
|
@ -1596,17 +1596,10 @@ uint32 BattleGroundMgr::CreateBattleGround(BattleGroundTypeId bgTypeId, bool IsA
|
|||
|
||||
void BattleGroundMgr::CreateInitialBattleGrounds()
|
||||
{
|
||||
float AStartLoc[4];
|
||||
float HStartLoc[4];
|
||||
uint32 MaxPlayersPerTeam, MinPlayersPerTeam, MinLvl, MaxLvl, start1, start2;
|
||||
BattlemasterListEntry const *bl;
|
||||
WorldSafeLocsEntry const *start;
|
||||
bool IsArena;
|
||||
|
||||
uint32 count = 0;
|
||||
|
||||
// 0 1 2 3 4 5 6 7 8
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,MinLvl,MaxLvl,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
|
||||
// 0 1 2 3 4 5 6
|
||||
QueryResult *result = WorldDatabase.Query("SELECT id, MinPlayersPerTeam,MaxPlayersPerTeam,AllianceStartLoc,AllianceStartO,HordeStartLoc,HordeStartO FROM battleground_template");
|
||||
|
||||
if (!result)
|
||||
{
|
||||
|
|
@ -1629,7 +1622,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
uint32 bgTypeID_ = fields[0].GetUInt32();
|
||||
|
||||
// can be overwrite by values from DB
|
||||
bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
|
||||
BattlemasterListEntry const *bl = sBattlemasterListStore.LookupEntry(bgTypeID_);
|
||||
if (!bl)
|
||||
{
|
||||
sLog.outError("Battleground ID %u not found in BattlemasterList.dbc. Battleground not created.", bgTypeID_);
|
||||
|
|
@ -1638,11 +1631,9 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
|
||||
BattleGroundTypeId bgTypeID = BattleGroundTypeId(bgTypeID_);
|
||||
|
||||
IsArena = (bl->type == TYPE_ARENA);
|
||||
MinPlayersPerTeam = fields[1].GetUInt32();
|
||||
MaxPlayersPerTeam = fields[2].GetUInt32();
|
||||
MinLvl = fields[3].GetUInt32();
|
||||
MaxLvl = fields[4].GetUInt32();
|
||||
bool IsArena = (bl->type == TYPE_ARENA);
|
||||
uint32 MinPlayersPerTeam = fields[1].GetUInt32();
|
||||
uint32 MaxPlayersPerTeam = fields[2].GetUInt32();
|
||||
|
||||
//check values from DB
|
||||
if (MaxPlayersPerTeam == 0 || MinPlayersPerTeam == 0)
|
||||
|
|
@ -1654,31 +1645,25 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
if (MinPlayersPerTeam > MaxPlayersPerTeam)
|
||||
MinPlayersPerTeam = MaxPlayersPerTeam;
|
||||
|
||||
if (MinLvl == 0 || MaxLvl == 0)
|
||||
{
|
||||
sLog.outErrorDb("Table `battleground_template` for id %u have wrong min/max level settings. BG not created.", bgTypeID);
|
||||
continue;
|
||||
}
|
||||
float AStartLoc[4];
|
||||
float HStartLoc[4];
|
||||
|
||||
if (MinLvl > MaxLvl)
|
||||
MinLvl = MaxLvl;
|
||||
uint32 start1 = fields[3].GetUInt32();
|
||||
|
||||
start1 = fields[5].GetUInt32();
|
||||
|
||||
start = sWorldSafeLocsStore.LookupEntry(start1);
|
||||
WorldSafeLocsEntry const *start = sWorldSafeLocsStore.LookupEntry(start1);
|
||||
if (start)
|
||||
{
|
||||
AStartLoc[0] = start->x;
|
||||
AStartLoc[1] = start->y;
|
||||
AStartLoc[2] = start->z;
|
||||
AStartLoc[3] = fields[6].GetFloat();
|
||||
AStartLoc[3] = fields[4].GetFloat();
|
||||
}
|
||||
else if (bgTypeID == BATTLEGROUND_AA || bgTypeID == BATTLEGROUND_RB)
|
||||
{
|
||||
AStartLoc[0] = 0;
|
||||
AStartLoc[1] = 0;
|
||||
AStartLoc[2] = 0;
|
||||
AStartLoc[3] = fields[6].GetFloat();
|
||||
AStartLoc[3] = fields[4].GetFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1686,7 +1671,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
continue;
|
||||
}
|
||||
|
||||
start2 = fields[7].GetUInt32();
|
||||
uint32 start2 = fields[5].GetUInt32();
|
||||
|
||||
start = sWorldSafeLocsStore.LookupEntry(start2);
|
||||
if (start)
|
||||
|
|
@ -1694,14 +1679,14 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
HStartLoc[0] = start->x;
|
||||
HStartLoc[1] = start->y;
|
||||
HStartLoc[2] = start->z;
|
||||
HStartLoc[3] = fields[8].GetFloat();
|
||||
HStartLoc[3] = fields[6].GetFloat();
|
||||
}
|
||||
else if (bgTypeID == BATTLEGROUND_AA || bgTypeID == BATTLEGROUND_RB)
|
||||
{
|
||||
HStartLoc[0] = 0;
|
||||
HStartLoc[1] = 0;
|
||||
HStartLoc[2] = 0;
|
||||
HStartLoc[3] = fields[8].GetFloat();
|
||||
HStartLoc[3] = fields[6].GetFloat();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -1710,7 +1695,7 @@ void BattleGroundMgr::CreateInitialBattleGrounds()
|
|||
}
|
||||
|
||||
//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, bl->minLevel, bl->maxLevel, bl->name[sWorld.GetDefaultDbcLocale()], bl->mapid[0], AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]))
|
||||
continue;
|
||||
|
||||
++count;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue