Index: src/game/BattleGroundMgr.cpp =================================================================== --- src/game/BattleGroundMgr.cpp (revision 79) +++ src/game/BattleGroundMgr.cpp (working copy) @@ -161,76 +161,23 @@ } void BattleGroundMgr::CreateInitialBattleGrounds() -{ - float AStartLoc[4]; - float HStartLoc[4]; - uint32 bg_ID; +{ + int MAX_B = 7; BattlemasterListEntry const* bl; - - // Create BG, Alterac Valley - bg_ID = 1; - bl = sBattlemasterListStore.LookupEntry(bg_ID); - AStartLoc[0] = 750.134f; - AStartLoc[1] = -485.181f; - AStartLoc[2] = 91.1357f; - AStartLoc[3] = 2.72532f; - - HStartLoc[0] = -888.637f; - HStartLoc[1] = -534.253f; - HStartLoc[2] = 54.8074f; - HStartLoc[3] = 2.27452f; - - sLog.outDetail("Creating battleground %s, %u-%u", bl->name, bl->minlvl, bl->maxlvl); - CreateBattleGround(bg_ID,bl->maxplayers, bl->minlvl, bl->maxlvl, bl->name, bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]); - - // Create BG, Warsong Gulch - bg_ID = 2; - bl = sBattlemasterListStore.LookupEntry(bg_ID); - AStartLoc[0] = 1519.530273f; - AStartLoc[1] = 1481.868408f; - AStartLoc[2] = 352.023743f; - AStartLoc[3] = 3.141593f; - - HStartLoc[0] = 933.989685f; - HStartLoc[1] = 1430.735840f; - HStartLoc[2] = 345.537140f; - HStartLoc[3] = 3.141593f; - - sLog.outDetail("Creating battleground %s, %u-%u", bl->name, bl->minlvl, bl->maxlvl); - CreateBattleGround(bg_ID, bl->maxplayers, bl->minlvl, bl->maxlvl, bl->name, bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]); - - // Create BG, Arathi Basin - bg_ID = 3; - bl = sBattlemasterListStore.LookupEntry(bg_ID); - AStartLoc[0] = 1351.55f; - AStartLoc[1] = 1289.99f; - AStartLoc[2] = -12.1946f; - AStartLoc[3] = 3.40156f; - - HStartLoc[0] = 665.942f; - HStartLoc[1] = 706.139f; - HStartLoc[2] = -14.4749f; - HStartLoc[3] = 0.263892f; - - sLog.outDetail("Creating battleground %s, %u-%u", bl->name, bl->minlvl, bl->maxlvl); - CreateBattleGround(bg_ID,bl->maxplayers, bl->minlvl, bl->maxlvl, bl->name, bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]); - - // Create BG, Eye of the Storm - bg_ID = 7; - bl = sBattlemasterListStore.LookupEntry(bg_ID); - AStartLoc[0] = 1351.55f; // todo: find coords - AStartLoc[1] = 1289.99f; // todo: find coords - AStartLoc[2] = -12.1946f; // todo: find coords - AStartLoc[3] = 3.40156f; // todo: find coords - - HStartLoc[0] = 665.942f; // todo: find coords - HStartLoc[1] = 706.139f; // todo: find coords - HStartLoc[2] = -14.4749f; // todo: find coords - HStartLoc[3] = 0.263892f; // todo: find coords - - sLog.outDetail("Creating battleground %s, %u-%u", bl->name, bl->minlvl, bl->maxlvl); - CreateBattleGround(bg_ID,bl->maxplayers, bl->minlvl, bl->maxlvl, bl->name, bl->mapid1, AStartLoc[0], AStartLoc[1], AStartLoc[2], AStartLoc[3], HStartLoc[0], HStartLoc[1], HStartLoc[2], HStartLoc[3]); - + for (int i =1;i<=MAX_B;i++) + { + bl = sBattlemasterListStore.LookupEntry(i); + if (bl->type == 3) + { + if (QueryResult *result = sDatabase.PQuery("SELECT `AStartLoc_x`, `AStartLoc_y`, `AStartLoc_z`, `AStartLoc_o`, `HStartLoc_x`, `HStartLoc_y`, `HStartLoc_z`, `HStartLoc_o` FROM `bg_locations` WHERE `bgid` = '%d';",bl->id)) + { + Field *fields = result->Fetch(); + CreateBattleGround(i, bl->maxplayers, bl->minlvl, bl->maxlvl, bl->name, bl->mapid1, fields[0].GetFloat(), fields[1].GetFloat(), fields[2].GetFloat(), fields[3].GetFloat(), fields[4].GetFloat(), fields[5].GetFloat(), fields[6].GetFloat(), fields[7].GetFloat()); + sLog.outDetail("Creating battleground %s, %u-%u", bl->name, bl->minlvl, bl->maxlvl); + delete result; + } + } + } sLog.outDetail("Created initial battlegrounds."); } !!!and base!!! -- MySQL Administrator dump 1.4 -- -- ------------------------------------------------------ -- Server version 5.0.27-community-max-nt /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; /*!40101 SET NAMES utf8 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; -- -- Table structure for table `mangos`.`bg_locations` -- DROP TABLE IF EXISTS `bg_locations`; CREATE TABLE `bg_locations` ( `bgid` int(10) unsigned NOT NULL auto_increment, `AStartLoc_x` float NOT NULL default '0', `AStartLoc_y` float NOT NULL default '0', `AStartLoc_z` float NOT NULL default '0', `AStartLoc_o` float NOT NULL default '0', `HStartLoc_x` float NOT NULL default '0', `HStartLoc_y` float NOT NULL default '0', `HStartLoc_z` float NOT NULL default '0', `HStartLoc_o` float NOT NULL default '0', `BGName` varchar(45) NOT NULL default '', PRIMARY KEY (`bgid`) ) ENGINE=MyISAM AUTO_INCREMENT=8 DEFAULT CHARSET=latin1; -- -- Dumping data for table `mangos`.`bg_locations` -- /*!40000 ALTER TABLE `bg_locations` DISABLE KEYS */; INSERT INTO `bg_locations` (`bgid`,`AStartLoc_x`,`AStartLoc_y`,`AStartLoc_z`,`AStartLoc_o`,`HStartLoc_x`,`HStartLoc_y`,`HStartLoc_z`,`HStartLoc_o`,`BGName`) VALUES (1,750.134,-485.181,91.1357,2.72532,-888.637,-534.253,54.8074,2.27452,'Alterac Valley'), (2,1519.53,1481.87,352.024,3.14159,933.99,1430.74,345.537,3.14159,'Warsong Gulch'), (3,1351.55,1289.99,-12.1946,3.40156,665.942,706.139,-14.4749,0.263892,'Arathi Basin'), (7,1351.55,1289.99,-12.1946,3.40156,665.942,706.139,-14.4749,0.263892,'Eye of the Storm'); /*!40000 ALTER TABLE `bg_locations` ENABLE KEYS */; /*!40101 SET SQL_MODE=@OLD_SQL_MODE */; /*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; /*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; /*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;