* Add the ability to set player orientation for new characters.
* Requires DB data to actully do anything, however not needed for working * server * Original patch by Vladimir --HG-- branch : trunk
This commit is contained in:
@@ -4018,6 +4018,7 @@ CREATE TABLE `playercreateinfo` (
|
|||||||
`position_x` float NOT NULL DEFAULT '0',
|
`position_x` float NOT NULL DEFAULT '0',
|
||||||
`position_y` float NOT NULL DEFAULT '0',
|
`position_y` float NOT NULL DEFAULT '0',
|
||||||
`position_z` float NOT NULL DEFAULT '0',
|
`position_z` float NOT NULL DEFAULT '0',
|
||||||
|
`orientation` float NOT NULL DEFAULT '0',
|
||||||
PRIMARY KEY (`race`,`class`)
|
PRIMARY KEY (`race`,`class`)
|
||||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
|
||||||
/*!40101 SET character_set_client = @saved_cs_client */;
|
/*!40101 SET character_set_client = @saved_cs_client */;
|
||||||
|
|||||||
@@ -0,0 +1,3 @@
|
|||||||
|
|
||||||
|
ALTER TABLE `playercreateinfo`
|
||||||
|
ADD COLUMN `orientation` float NOT NULL DEFAULT 0 AFTER `position_z`;
|
||||||
@@ -679,7 +679,7 @@ bool Player::Create(uint32 guidlow, const std::string& name, uint8 race, uint8 c
|
|||||||
for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++)
|
for (uint8 i = 0; i < PLAYER_SLOTS_COUNT; i++)
|
||||||
m_items[i] = NULL;
|
m_items[i] = NULL;
|
||||||
|
|
||||||
Relocate(info->positionX,info->positionY,info->positionZ);
|
Relocate(info->positionX,info->positionY,info->positionZ,info->orientation);
|
||||||
|
|
||||||
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(class_);
|
ChrClassesEntry const* cEntry = sChrClassesStore.LookupEntry(class_);
|
||||||
if (!cEntry)
|
if (!cEntry)
|
||||||
|
|||||||
@@ -249,6 +249,7 @@ struct PlayerInfo
|
|||||||
float positionX;
|
float positionX;
|
||||||
float positionY;
|
float positionY;
|
||||||
float positionZ;
|
float positionZ;
|
||||||
|
float orientation;
|
||||||
uint16 displayId_m;
|
uint16 displayId_m;
|
||||||
uint16 displayId_f;
|
uint16 displayId_f;
|
||||||
PlayerCreateInfoItems item;
|
PlayerCreateInfoItems item;
|
||||||
|
|||||||
@@ -2729,7 +2729,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|||||||
// Load playercreate
|
// Load playercreate
|
||||||
{
|
{
|
||||||
// 0 1 2 3 4 5 6
|
// 0 1 2 3 4 5 6
|
||||||
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z FROM playercreateinfo");
|
QueryResult_AutoPtr result = WorldDatabase.Query("SELECT race, class, map, zone, position_x, position_y, position_z, orientation FROM playercreateinfo");
|
||||||
|
|
||||||
uint32 count = 0;
|
uint32 count = 0;
|
||||||
|
|
||||||
@@ -2756,6 +2756,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|||||||
float positionX = fields[4].GetFloat();
|
float positionX = fields[4].GetFloat();
|
||||||
float positionY = fields[5].GetFloat();
|
float positionY = fields[5].GetFloat();
|
||||||
float positionZ = fields[6].GetFloat();
|
float positionZ = fields[6].GetFloat();
|
||||||
|
float orientation = fields[7].GetFloat();
|
||||||
|
|
||||||
if (current_race >= MAX_RACES)
|
if (current_race >= MAX_RACES)
|
||||||
{
|
{
|
||||||
@@ -2783,7 +2784,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// accept DB data only for valid position (and non instanceable)
|
// accept DB data only for valid position (and non instanceable)
|
||||||
if (!MapManager::IsValidMapCoord(mapId,positionX,positionY,positionZ))
|
if (!MapManager::IsValidMapCoord(mapId,positionX,positionY,positionZ,orientation))
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race);
|
sLog.outErrorDb("Wrong home position for class %u race %u pair in `playercreateinfo` table, ignoring.",current_class,current_race);
|
||||||
continue;
|
continue;
|
||||||
@@ -2802,6 +2803,7 @@ void ObjectMgr::LoadPlayerInfo()
|
|||||||
pInfo->positionX = positionX;
|
pInfo->positionX = positionX;
|
||||||
pInfo->positionY = positionY;
|
pInfo->positionY = positionY;
|
||||||
pInfo->positionZ = positionZ;
|
pInfo->positionZ = positionZ;
|
||||||
|
pInfo->orientation = orientation;
|
||||||
|
|
||||||
pInfo->displayId_m = rEntry->model_m;
|
pInfo->displayId_m = rEntry->model_m;
|
||||||
pInfo->displayId_f = rEntry->model_f;
|
pInfo->displayId_f = rEntry->model_f;
|
||||||
|
|||||||
Reference in New Issue
Block a user