aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sql/characters.sql38
-rw-r--r--sql/updates/4945_mangos_8339_characters.sql23
-rw-r--r--src/game/BattleGround.cpp2
-rw-r--r--src/game/BattleGroundHandler.cpp14
-rw-r--r--src/game/CharacterHandler.cpp52
-rw-r--r--src/game/Level1.cpp4
-rw-r--r--src/game/Player.cpp315
-rw-r--r--src/game/Player.h92
8 files changed, 344 insertions, 196 deletions
diff --git a/sql/characters.sql b/sql/characters.sql
index 7ac480219ee..273420d98dc 100644
--- a/sql/characters.sql
+++ b/sql/characters.sql
@@ -23,7 +23,7 @@
DROP TABLE IF EXISTS `character_db_version`;
CREATE TABLE `character_db_version` (
- `required_8104_01_characters` bit(1) default NULL
+ `required_8339_02_characters_character_battleground_data` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Last applied sql update to DB';
--
@@ -331,13 +331,6 @@ CREATE TABLE `characters` (
`taxi_path` text,
`arena_pending_points` int(10) UNSIGNED NOT NULL default '0',
`latency` int(11) unsigned NOT NULL default '0',
- `bgid` int(10) unsigned NOT NULL default '0',
- `bgteam` int(10) unsigned NOT NULL default '0',
- `bgmap` int(10) unsigned NOT NULL default '0',
- `bgx` float NOT NULL default '0',
- `bgy` float NOT NULL default '0',
- `bgz` float NOT NULL default '0',
- `bgo` float NOT NULL default '0',
PRIMARY KEY (`guid`),
KEY `idx_account` (`account`),
KEY `idx_online` (`online`),
@@ -448,6 +441,35 @@ LOCK TABLES `character_aura` WRITE;
UNLOCK TABLES;
--
+-- Table structure for table `character_battleground_data`
+--
+
+DROP TABLE IF EXISTS `character_battleground_data`;
+CREATE TABLE `character_battleground_data` (
+ `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
+ `instance_id` int(11) unsigned NOT NULL default '0',
+ `team` int(11) unsigned NOT NULL default '0',
+ `join_x` float NOT NULL default '0',
+ `join_y` float NOT NULL default '0',
+ `join_z` float NOT NULL default '0',
+ `join_o` float NOT NULL default '0',
+ `join_map` int(11) NOT NULL default '0',
+ `taxi_start` int(11) NOT NULL default '0',
+ `taxi_end` int(11) NOT NULL default '0',
+ `mount_spell` int(11) NOT NULL default '0',
+ PRIMARY KEY (`guid`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System';
+
+--
+-- Dumping data for table `character_battleground_data`
+--
+
+LOCK TABLES `character_battleground_data` WRITE;
+/*!40000 ALTER TABLE `character_battleground_data` DISABLE KEYS */;
+/*!40000 ALTER TABLE `character_battleground_data` ENABLE KEYS */;
+UNLOCK TABLES;
+
+--
-- Table structure for table `character_declinedname`
--
diff --git a/sql/updates/4945_mangos_8339_characters.sql b/sql/updates/4945_mangos_8339_characters.sql
new file mode 100644
index 00000000000..e21c6d3771c
--- /dev/null
+++ b/sql/updates/4945_mangos_8339_characters.sql
@@ -0,0 +1,23 @@
+ALTER TABLE characters DROP COLUMN bgid;
+ALTER TABLE characters DROP COLUMN bgteam;
+ALTER TABLE characters DROP COLUMN bgmap;
+ALTER TABLE characters DROP COLUMN bgx;
+ALTER TABLE characters DROP COLUMN bgy;
+ALTER TABLE characters DROP COLUMN bgz;
+ALTER TABLE characters DROP COLUMN bgo;
+
+DROP TABLE IF EXISTS `character_battleground_data`;
+CREATE TABLE `character_battleground_data` (
+ `guid` int(11) unsigned NOT NULL default '0' COMMENT 'Global Unique Identifier',
+ `instance_id` int(11) unsigned NOT NULL default '0',
+ `team` int(11) unsigned NOT NULL default '0',
+ `join_x` float NOT NULL default '0',
+ `join_y` float NOT NULL default '0',
+ `join_z` float NOT NULL default '0',
+ `join_o` float NOT NULL default '0',
+ `join_map` int(11) NOT NULL default '0',
+ `taxi_start` int(11) NOT NULL default '0',
+ `taxi_end` int(11) NOT NULL default '0',
+ `mount_spell` int(11) NOT NULL default '0',
+ PRIMARY KEY (`guid`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='Player System';
diff --git a/src/game/BattleGround.cpp b/src/game/BattleGround.cpp
index a80a06b3572..aeccd350c64 100644
--- a/src/game/BattleGround.cpp
+++ b/src/game/BattleGround.cpp
@@ -1071,7 +1071,7 @@ void BattleGround::RemovePlayerAtLeave(uint64 guid, bool Transport, bool SendPac
plr->SetBGTeam(0);
if (Transport)
- plr->TeleportTo(plr->GetBattleGroundEntryPoint());
+ plr->TeleportToBGEntryPoint();
sLog.outDetail("BATTLEGROUND: Removed player %s from BattleGround.", plr->GetName());
}
diff --git a/src/game/BattleGroundHandler.cpp b/src/game/BattleGroundHandler.cpp
index 497db2ceadd..b1309063b3b 100644
--- a/src/game/BattleGroundHandler.cpp
+++ b/src/game/BattleGroundHandler.cpp
@@ -164,9 +164,6 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId); // add to queue
- // store entry point coords
- member->SetBattleGroundEntryPoint(member->GetMapId(),member->GetPositionX(),member->GetPositionY(),member->GetPositionZ(),member->GetOrientation());
-
WorldPacket data;
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, ginfo->ArenaType);
@@ -182,8 +179,6 @@ void WorldSession::HandleBattlemasterJoinOpcode( WorldPacket & recv_data )
{
// already checked if queueSlot is valid, now just get it
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
- // store entry point coords
- _player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation());
WorldPacket data;
// send status packet (in queue)
@@ -438,6 +433,9 @@ void WorldSession::HandleBattleFieldPortOpcode( WorldPacket &recv_data )
case 1: // port to battleground
if (!_player->IsInvitedForBattleGroundQueueType(bgQueueTypeId))
return; // cheating?
+
+ _player->SetBattleGroundEntryPoint();
+
// resurrect the player
if (!_player->isAlive())
{
@@ -758,9 +756,6 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
uint32 queueSlot = member->AddBattleGroundQueueId(bgQueueTypeId);// add to queue
- // store entry point coords (same as leader entry point)
- member->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation());
-
WorldPacket data;
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
@@ -778,9 +773,6 @@ void WorldSession::HandleBattlemasterJoinArena( WorldPacket & recv_data )
{
uint32 queueSlot = _player->AddBattleGroundQueueId(bgQueueTypeId);
- // store entry point coords
- _player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation());
-
WorldPacket data;
// send status packet (in queue)
sBattleGroundMgr.BuildBattleGroundStatusPacket(&data, bg, queueSlot, STATUS_WAIT_QUEUE, avgTime, 0, arenatype);
diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp
index dbcae72f53a..c7e4ba959ed 100644
--- a/src/game/CharacterHandler.cpp
+++ b/src/game/CharacterHandler.cpp
@@ -64,7 +64,7 @@ bool LoginQueryHolder::Initialize()
// NOTE: all fields in `characters` must be read to prevent lost character data at next save in case wrong DB structure.
// !!! NOTE: including unused `zone`,`online`
- res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points,instance_id,bgteam,bgmap,bgx,bgy,bgz,bgo FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
+ res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADFROM, "SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points,instance_id FROM characters WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADGROUP, "SELECT leaderGuid FROM group_member WHERE memberGuid ='%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES, "SELECT id, permanent, map, difficulty, resettime FROM character_instance LEFT JOIN instance ON instance = id WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADAURAS, "SELECT caster_guid,spell,effect_mask,stackcount,amount0, amount1, amount2 ,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
@@ -87,6 +87,7 @@ bool LoginQueryHolder::Initialize()
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS, "SELECT achievement, date FROM character_achievement WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS,"SELECT criteria, counter, date FROM character_achievement_progress WHERE guid = '%u'", GUID_LOPART(m_guid));
res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS, "SELECT setguid, setindex, name, iconname, item0, item1, item2, item3, item4, item5, item6, item7, item8, item9, item10, item11, item12, item13, item14, item15, item16, item17, item18 FROM character_equipmentsets WHERE guid = '%u' ORDER BY setindex", GUID_LOPART(m_guid));
+ res &= SetPQuery(PLAYER_LOGIN_QUERY_LOADBGDATA, "SELECT instance_id, team, join_x, join_y, join_z, join_o, join_map, taxi_start, taxi_end, mount_spell FROM character_battleground_data WHERE guid = '%u'", GUID_LOPART(m_guid));
return res;
}
@@ -763,54 +764,7 @@ void WorldSession::HandlePlayerLogin(LoginQueryHolder * holder)
pCurrChar->SetMovement(MOVE_WATER_WALK);
}
- if(uint32 sourceNode = pCurrChar->m_taxi.GetTaxiSource())
- {
- sLog.outDebug( "WORLD: Restart character %u taxi flight", pCurrChar->GetGUIDLow() );
-
- uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourceNode, pCurrChar->GetTeam(),true);
- uint32 path = pCurrChar->m_taxi.GetCurrentTaxiPath();
-
- // search appropriate start path node
- uint32 startNode = 0;
-
- TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
-
- float distPrev = MAP_SIZE*MAP_SIZE;
- float distNext =
- (nodeList[0].x-pCurrChar->GetPositionX())*(nodeList[0].x-pCurrChar->GetPositionX())+
- (nodeList[0].y-pCurrChar->GetPositionY())*(nodeList[0].y-pCurrChar->GetPositionY())+
- (nodeList[0].z-pCurrChar->GetPositionZ())*(nodeList[0].z-pCurrChar->GetPositionZ());
-
- for(uint32 i = 1; i < nodeList.size(); ++i)
- {
- TaxiPathNode const& node = nodeList[i];
- TaxiPathNode const& prevNode = nodeList[i-1];
-
- // skip nodes at another map
- if(node.mapid != pCurrChar->GetMapId())
- continue;
-
- distPrev = distNext;
-
- distNext =
- (node.x-pCurrChar->GetPositionX())*(node.x-pCurrChar->GetPositionX())+
- (node.y-pCurrChar->GetPositionY())*(node.y-pCurrChar->GetPositionY())+
- (node.z-pCurrChar->GetPositionZ())*(node.z-pCurrChar->GetPositionZ());
-
- float distNodes =
- (node.x-prevNode.x)*(node.x-prevNode.x)+
- (node.y-prevNode.y)*(node.y-prevNode.y)+
- (node.z-prevNode.z)*(node.z-prevNode.z);
-
- if(distNext + distPrev < distNodes)
- {
- startNode = i;
- break;
- }
- }
-
- SendDoFlight( mountDisplayId, path, startNode );
- }
+ pCurrChar->ContinueTaxiFlight();
// reset for all pets before pet loading
if(pCurrChar->HasAtLoginFlag(AT_LOGIN_RESET_PET_TALENTS))
diff --git a/src/game/Level1.cpp b/src/game/Level1.cpp
index 275dd5b1e8c..d2eeb42971c 100644
--- a/src/game/Level1.cpp
+++ b/src/game/Level1.cpp
@@ -822,7 +822,7 @@ bool ChatHandler::HandleNamegoCommand(const char* args)
// when porting out from the bg, it will be reset to 0
target->SetBattleGroundId(m_session->GetPlayer()->GetBattleGroundId(), m_session->GetPlayer()->GetBattleGroundTypeId());
// remember current position as entry point for return at bg end teleportation
- target->SetBattleGroundEntryPoint(target->GetMapId(),target->GetPositionX(),target->GetPositionY(),target->GetPositionZ(),target->GetOrientation());
+ target->SetBattleGroundEntryPoint();
}
else if (pMap->IsDungeon())
{
@@ -936,7 +936,7 @@ bool ChatHandler::HandleGonameCommand(const char* args)
// when porting out from the bg, it will be reset to 0
_player->SetBattleGroundId(target->GetBattleGroundId(), target->GetBattleGroundTypeId());
// remember current position as entry point for return at bg end teleportation
- _player->SetBattleGroundEntryPoint(_player->GetMapId(),_player->GetPositionX(),_player->GetPositionY(),_player->GetPositionZ(),_player->GetOrientation());
+ _player->SetBattleGroundEntryPoint();
}
else if(cMap->IsDungeon())
{
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index b003f946dbc..c54679ad623 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -369,14 +369,11 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_DetectInvTimer = 1*IN_MILISECONDS;
- m_bgBattleGroundID = 0;
- m_bgTypeID = BATTLEGROUND_TYPE_NONE;
- for (int j=0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; j++)
+ for (int j=0; j < PLAYER_MAX_BATTLEGROUND_QUEUES; ++j)
{
m_bgBattleGroundQueueID[j].bgQueueTypeId = BATTLEGROUND_QUEUE_NONE;
m_bgBattleGroundQueueID[j].invitedToInstance = 0;
}
- m_bgTeam = 0;
m_logintime = time(NULL);
m_Last_tick = m_logintime;
@@ -459,7 +456,6 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this), m_reputa
m_mover = this;
m_seer = this;
- m_bgAfkReportedTimer = 0;
m_contestedPvPTimer = 0;
m_declinedname = NULL;
@@ -1879,6 +1875,13 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
return true;
}
+bool Player::TeleportToBGEntryPoint()
+{
+ ScheduleDelayedOperation(DELAYED_BG_MOUNT_RESTORE);
+ ScheduleDelayedOperation(DELAYED_BG_TAXI_RESTORE);
+ return TeleportTo(m_bgData.joinPos);
+}
+
void Player::ProcessDelayedOperations()
{
if(m_DelayedOperations == 0)
@@ -1914,16 +1917,29 @@ void Player::ProcessDelayedOperations()
CastSpell(this, SPELL_ID_DESERTER, true); // Deserter
}
- //we have executed ALL delayed ops, so clear the flag
- m_DelayedOperations = 0;
-}
+ if (m_DelayedOperations & DELAYED_BG_MOUNT_RESTORE)
+ {
+ if (m_bgData.mountSpell)
+ {
+ CastSpell(this, m_bgData.mountSpell, true);
+ m_bgData.mountSpell = 0;
+ }
+ }
-void Player::ScheduleDelayedOperation(uint32 operation)
-{
- if(operation >= DELAYED_END)
- return;
+ if (m_DelayedOperations & DELAYED_BG_TAXI_RESTORE)
+ {
+ if (m_bgData.HasTaxiPath())
+ {
+ m_taxi.AddTaxiDestination(m_bgData.taxiPath[0]);
+ m_taxi.AddTaxiDestination(m_bgData.taxiPath[1]);
+ m_bgData.ClearTaxiPath();
- m_DelayedOperations |= operation;
+ ContinueTaxiFlight();
+ }
+ }
+
+ //we have executed ALL delayed ops, so clear the flag
+ m_DelayedOperations = 0;
}
void Player::AddToWorld()
@@ -14395,6 +14411,28 @@ void Player::_LoadEquipmentSets(QueryResult *result)
delete result;
}
+void Player::_LoadBGData(QueryResult* result)
+{
+ if (!result)
+ return;
+
+ // Expecting only one row
+ Field *fields = result->Fetch();
+ /* bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */
+ m_bgData.bgInstanceID = fields[0].GetUInt32();
+ m_bgData.bgTeam = fields[1].GetUInt32();
+ m_bgData.joinPos = WorldLocation(fields[6].GetUInt32(), // Map
+ fields[2].GetFloat(), // X
+ fields[3].GetFloat(), // Y
+ fields[4].GetFloat(), // Z
+ fields[5].GetFloat()); // Orientation
+ m_bgData.taxiPath[0] = fields[7].GetUInt32();
+ m_bgData.taxiPath[1] = fields[8].GetUInt32();
+ m_bgData.mountSpell = fields[9].GetUInt32();
+
+ delete result;
+}
+
bool Player::LoadPositionFromDB(uint32& mapid, float& x,float& y,float& z,float& o, bool& in_flight, uint64 guid)
{
QueryResult *result = CharacterDatabase.PQuery("SELECT position_x,position_y,position_z,orientation,map,taxi_path FROM characters WHERE guid = '%u'",GUID_LOPART(guid));
@@ -14497,8 +14535,8 @@ float Player::GetFloatValueFromDB(uint16 index, uint64 guid)
bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
{
- //// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
- //QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points,bgid,bgteam,bgmap,bgx,bgy,bgz,bgo FROM characters WHERE guid = '%u'", guid);
+ //// 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
+ //QueryResult *result = CharacterDatabase.PQuery("SELECT guid, account, data, name, race, class, gender, level, xp, money, playerBytes, playerBytes2, playerFlags, position_x, position_y, position_z, map, orientation, taximask, cinematic, totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, online, death_expire_time, taxi_path, dungeon_difficulty, arena_pending_points FROM characters WHERE guid = '%u'", guid);
QueryResult *result = holder->GetResult(PLAYER_LOGIN_QUERY_LOADFROM);
if(!result)
@@ -14593,7 +14631,15 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
InitPrimaryProfessions(); // to max set before any spell loaded
+ // init saved position, and fix it later if problematic
+ uint32 transGUID = fields[31].GetUInt32();
+ Relocate(fields[13].GetFloat(),fields[14].GetFloat(),fields[15].GetFloat(),fields[17].GetFloat());
+ uint32 mapId = fields[16].GetUInt32();
+ uint32 instanceId = fields[41].GetFloat();
SetDifficulty(fields[39].GetUInt32()); // may be changed in _LoadGroup
+ std::string taxi_nodes = fields[38].GetCppString();
+
+#define RelocateToHomebind() mapId = m_homebindMapId; instanceId = 0; Relocate(m_homebindX, m_homebindY, m_homebindZ)
_LoadGroup(holder->GetResult(PLAYER_LOGIN_QUERY_LOADGROUP));
@@ -14622,52 +14668,31 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
}
_LoadBoundInstances(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBOUNDINSTANCES));
-
- // load player map related values
- uint32 transGUID = fields[31].GetUInt32();
- Relocate(fields[13].GetFloat(),fields[14].GetFloat(),fields[15].GetFloat(),fields[17].GetFloat());
- uint32 mapId = fields[16].GetUInt32();
- uint32 instanceId = fields[41].GetFloat();
- std::string taxi_nodes = fields[38].GetCppString();
+ _LoadBGData(holder->GetResult(PLAYER_LOGIN_QUERY_LOADBGDATA));
MapEntry const * mapEntry = sMapStore.LookupEntry(mapId);
if(!IsPositionValid())
{
sLog.outError("Player (guidlow %d) have invalid coordinates (X: %f Y: %f Z: %f O: %f). Teleport to default race/class locations.",guid,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation());
- RelocateToHomebind(mapId);
-
- transGUID = 0;
- instanceId = 0;
-
- m_movementInfo.t_x = 0.0f;
- m_movementInfo.t_y = 0.0f;
- m_movementInfo.t_z = 0.0f;
- m_movementInfo.t_o = 0.0f;
+ RelocateToHomebind();
}
// Player was saved in Arena or Bg
else if (mapEntry && mapEntry->IsBattleGroundOrArena())
{
- // Get Entry Point(bg master) or Homebind
- SetBattleGroundEntryPoint(fields[43].GetUInt32(),fields[44].GetFloat(),fields[45].GetFloat(),fields[46].GetFloat(),fields[47].GetFloat());
-
- MapEntry const* bgEntry = sMapStore.LookupEntry(m_bgEntryPoint.mapid);
- if(!bgEntry || bgEntry->Instanceable() || !MapManager::IsValidMapCoord(m_bgEntryPoint))
- SetBattleGroundEntryPoint(m_homebindMapId,m_homebindX,m_homebindY,m_homebindZ,0.0f);
+ BattleGround *currentBg = NULL;
+ if(m_bgData.bgInstanceID) //saved in BattleGround
+ currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE);
- // Bg still exists - join it!
- BattleGround *currentBg = sBattleGroundMgr.GetBattleGround(instanceId, BATTLEGROUND_TYPE_NONE);
if(currentBg && currentBg->IsPlayerInBattleGround(GetGUID()))
{
- uint32 bgteam = fields[42].GetUInt32();
BattleGroundQueueTypeId bgQueueTypeId = sBattleGroundMgr.BGQueueTypeId(currentBg->GetTypeID(), currentBg->GetArenaType());
AddBattleGroundQueueId(bgQueueTypeId);
- SetBattleGroundId(currentBg->GetInstanceID(), currentBg->GetTypeID());
- SetBGTeam(bgteam);
+ m_bgData.bgTypeID = currentBg->GetTypeID();
//join player to battleground group
currentBg->EventPlayerLoggedIn(this, GetGUID());
- currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetGUID(), bgteam);
+ currentBg->AddOrSetPlayerToCorrectBgGroup(this, GetGUID(), m_bgData.bgTeam);
SetInviteForBattleGroundQueueType(bgQueueTypeId,currentBg->GetInstanceID());
}
@@ -14675,13 +14700,13 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
else
{
// Do not look for instance if bg not found
- instanceId = 0;
const WorldLocation& _loc = GetBattleGroundEntryPoint();
- mapId = _loc.mapid;
+ mapId = _loc.mapid; instanceId = 0;
Relocate(_loc.coord_x, _loc.coord_y, _loc.coord_z, _loc.orientation);
}
}
- else if (transGUID != 0)
+ // currently we do not support transport in bg
+ else if (transGUID)
{
// There are no transports on instances
instanceId = 0;
@@ -14691,7 +14716,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
m_movementInfo.t_z = fields[29].GetFloat();
m_movementInfo.t_o = fields[30].GetFloat();
- if( !Trinity::IsValidMapCoord(
+ if( !MaNGOS::IsValidMapCoord(
GetPositionX()+m_movementInfo.t_x,GetPositionY()+m_movementInfo.t_y,
GetPositionZ()+m_movementInfo.t_z,GetOrientation()+m_movementInfo.t_o) ||
// transport size limited
@@ -14701,14 +14726,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
guid,GetPositionX()+m_movementInfo.t_x,GetPositionY()+m_movementInfo.t_y,
GetPositionZ()+m_movementInfo.t_z,GetOrientation()+m_movementInfo.t_o);
- RelocateToHomebind(mapId);
-
- m_movementInfo.t_x = 0.0f;
- m_movementInfo.t_y = 0.0f;
- m_movementInfo.t_z = 0.0f;
- m_movementInfo.t_o = 0.0f;
-
- transGUID = 0;
+ RelocateToHomebind();
}
else
{
@@ -14727,23 +14745,22 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
sLog.outError("Player (guidlow %d) have problems with transport guid (%u). Teleport to default race/class locations.",
guid,transGUID);
- RelocateToHomebind(mapId);
-
- m_movementInfo.t_x = 0.0f;
- m_movementInfo.t_y = 0.0f;
- m_movementInfo.t_z = 0.0f;
- m_movementInfo.t_o = 0.0f;
-
- transGUID = 0;
+ RelocateToHomebind();
}
}
}
- else if (!taxi_nodes.empty()) // Taxi Flight path loaded from db
+ // currently we do not support taxi in instance
+ else if (!taxi_nodes.empty())
{
- // There are no flightpaths in instances
instanceId = 0;
- if(!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes,GetTeam()))
+ // Not finish taxi flight path
+ if(m_bgData.HasTaxiPath())
+ {
+ for (int i = 0; i < 2; ++i)
+ m_taxi.AddTaxiDestination(m_bgData.taxiPath[i]);
+ }
+ else if(!m_taxi.LoadTaxiDestinationsFromString(taxi_nodes,GetTeam()))
{
// problems with taxi path loading
TaxiNodesEntry const* nodeEntry = NULL;
@@ -14753,7 +14770,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
if(!nodeEntry) // don't know taxi start node, to homebind
{
sLog.outError("Character %u have wrong data in taxi destination list, teleport to homebind.",GetGUIDLow());
- RelocateToHomebind(mapId);
+ RelocateToHomebind();
}
else // have start node, to it
{
@@ -14761,26 +14778,28 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
mapId = nodeEntry->map_id;
Relocate(nodeEntry->x, nodeEntry->y, nodeEntry->z,0.0f);
}
+ m_taxi.ClearTaxiDestinations();
}
- // Taxi path loading succesfull
- else if(uint32 node_id = m_taxi.GetTaxiSource())
+
+ if(uint32 node_id = m_taxi.GetTaxiSource())
{
// save source node as recall coord to prevent recall and fall from sky
TaxiNodesEntry const* nodeEntry = sTaxiNodesStore.LookupEntry(node_id);
assert(nodeEntry); // checked in m_taxi.LoadTaxiDestinationsFromString
- Relocate(nodeEntry->x,nodeEntry->y,nodeEntry->z,0);
mapId = nodeEntry->map_id;
+ Relocate(nodeEntry->x, nodeEntry->y, nodeEntry->z,0.0f);
+
// flight will started later
}
}
+
// Map could be changed before
mapEntry = sMapStore.LookupEntry(mapId);
// client without expansion support
if(GetSession()->Expansion() < mapEntry->Expansion())
{
sLog.outDebug("Player %s using client without required expansion tried login at non accessible map %u", GetName(), mapId);
- RelocateToHomebind(mapId);
- instanceId = 0;
+ RelocateToHomebind();
}
// fix crash (because of if(Map *map = _FindMap(instanceId)) in MapInstanced::CreateInstance)
@@ -14806,7 +14825,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
else
{
sLog.outError("Player (guidlow %d) is teleported to home (Map: %u X: %f Y: %f Z: %f O: %f).",guid,mapId,GetPositionX(),GetPositionY(),GetPositionZ(),GetOrientation());
- RelocateToHomebind(mapId);
+ RelocateToHomebind();
}
map = MapManager::Instance().CreateMap(mapId, this, 0);
@@ -14835,8 +14854,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
else
{
sLog.outError("Player %s(GUID: %u) logged in to a reset instance (map: %u) and there is no area-trigger leading to this map. Thus he can't be ported back to the entrance. This _might_ be an exploit attempt.", GetName(), GetGUIDLow(), mapId);
- RelocateToHomebind(mapId);
- instanceId = 0;
+ RelocateToHomebind();
}
}
@@ -16116,7 +16134,7 @@ void Player::SaveToDB()
"taximask, online, cinematic, "
"totaltime, leveltime, rest_bonus, logout_time, is_logout_resting, resettalents_cost, resettalents_time, "
"trans_x, trans_y, trans_z, trans_o, transguid, extra_flags, stable_slots, at_login, zone, "
- "death_expire_time, taxi_path, arena_pending_points, latency, bgid, bgteam, bgmap, bgx, bgy, bgz, bgo) VALUES ("
+ "death_expire_time, taxi_path, arena_pending_points, latency) VALUES ("
<< GetGUIDLow() << ", "
<< GetSession()->GetAccountId() << ", '"
<< sql_name << "', "
@@ -16198,14 +16216,7 @@ void Player::SaveToDB()
ss << m_taxi.SaveTaxiDestinationsToString() << "', ";
ss << "'0', "; // arena_pending_points
- ss << GetSession()->GetLatency() << ", ";
- ss << GetBattleGroundId() << ", ";
- ss << GetBGTeam() << ", ";
- ss << m_bgEntryPoint.mapid << ", "
- << finiteAlways(m_bgEntryPoint.coord_x) << ", "
- << finiteAlways(m_bgEntryPoint.coord_y) << ", "
- << finiteAlways(m_bgEntryPoint.coord_z) << ", "
- << finiteAlways(m_bgEntryPoint.orientation);
+ ss << GetSession()->GetLatency();
ss << ")";
CharacterDatabase.Execute( ss.str().c_str() );
@@ -16213,6 +16224,7 @@ void Player::SaveToDB()
if(m_mailsUpdated) //save mails only when needed
_SaveMail();
+ _SaveBGData();
_SaveInventory();
_SaveQuestStatus();
_SaveDailyQuestStatus();
@@ -16779,10 +16791,10 @@ void Player::SendResetInstanceFailed(uint32 reason, uint32 MapId)
///checks the 15 afk reports per 5 minutes limit
void Player::UpdateAfkReport(time_t currTime)
{
- if(m_bgAfkReportedTimer <= currTime)
+ if(m_bgData.bgAfkReportedTimer <= currTime)
{
- m_bgAfkReportedCount = 0;
- m_bgAfkReportedTimer = currTime+5*MINUTE;
+ m_bgData.bgAfkReportedCount = 0;
+ m_bgData.bgAfkReportedTimer = currTime+5*MINUTE;
}
}
@@ -17768,6 +17780,59 @@ void Player::CleanupAfterTaxiFlight()
getHostilRefManager().setOnlineOfflineState(true);
}
+void Player::ContinueTaxiFlight()
+{
+ uint32 sourceNode = m_taxi.GetTaxiSource();
+ if (!sourceNode)
+ return;
+
+ sLog.outDebug( "WORLD: Restart character %u taxi flight", GetGUIDLow() );
+
+ uint32 mountDisplayId = objmgr.GetTaxiMountDisplayId(sourceNode, GetTeam(),true);
+ uint32 path = m_taxi.GetCurrentTaxiPath();
+
+ // search appropriate start path node
+ uint32 startNode = 0;
+
+ TaxiPathNodeList const& nodeList = sTaxiPathNodesByPath[path];
+
+ float distPrev = MAP_SIZE*MAP_SIZE;
+ float distNext =
+ (nodeList[0].x-GetPositionX())*(nodeList[0].x-GetPositionX())+
+ (nodeList[0].y-GetPositionY())*(nodeList[0].y-GetPositionY())+
+ (nodeList[0].z-GetPositionZ())*(nodeList[0].z-GetPositionZ());
+
+ for(uint32 i = 1; i < nodeList.size(); ++i)
+ {
+ TaxiPathNode const& node = nodeList[i];
+ TaxiPathNode const& prevNode = nodeList[i-1];
+
+ // skip nodes at another map
+ if(node.mapid != GetMapId())
+ continue;
+
+ distPrev = distNext;
+
+ distNext =
+ (node.x-GetPositionX())*(node.x-GetPositionX())+
+ (node.y-GetPositionY())*(node.y-GetPositionY())+
+ (node.z-GetPositionZ())*(node.z-GetPositionZ());
+
+ float distNodes =
+ (node.x-prevNode.x)*(node.x-prevNode.x)+
+ (node.y-prevNode.y)*(node.y-prevNode.y)+
+ (node.z-prevNode.z)*(node.z-prevNode.z);
+
+ if(distNext + distPrev < distNodes)
+ {
+ startNode = i;
+ break;
+ }
+ }
+
+ GetSession()->SendDoFlight(mountDisplayId, path, startNode);
+}
+
void Player::ProhibitSpellScholl(SpellSchoolMask idSchoolMask, uint32 unTimeMs )
{
// last check 2.0.10
@@ -18492,6 +18557,56 @@ void Player::ToggleMetaGemsActive(uint8 exceptslot, bool apply)
}
}
+void Player::SetBattleGroundEntryPoint()
+{
+ // Taxi path store
+ if (!m_taxi.empty())
+ {
+ m_bgData.mountSpell = 0;
+ m_bgData.taxiPath[0] = m_taxi.GetTaxiSource();
+ m_bgData.taxiPath[1] = m_taxi.GetTaxiDestination();
+
+ // On taxi we don't need check for dungeon
+ m_bgData.joinPos = WorldLocation(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ return;
+ }
+ else
+ {
+ m_bgData.ClearTaxiPath();
+
+ // Mount spell id storing
+ if (IsMounted())
+ {
+ AuraEffectList const& auras = GetAurasByType(SPELL_AURA_MOUNTED);
+ if (!auras.empty())
+ m_bgData.mountSpell = (*auras.begin())->GetId();
+ }
+ else
+ m_bgData.mountSpell = 0;
+
+ // If map is dungeon find linked graveyard
+ if(GetMap()->IsDungeon())
+ {
+ if (const WorldSafeLocsEntry* entry = objmgr.GetClosestGraveYard(GetPositionX(), GetPositionY(), GetPositionZ(), GetMapId(), GetTeam()))
+ {
+ m_bgData.joinPos = WorldLocation(entry->map_id, entry->x, entry->y, entry->z, 0.0f);
+ return;
+ }
+ else
+ sLog.outError("SetBattleGroundEntryPoint: Dungeon map %u has no linked graveyard, setting home location as entry point.", GetMapId());
+ }
+ // If new entry point is not BG or arena set it
+ else if (!GetMap()->IsBattleGroundOrArena())
+ {
+ m_bgData.joinPos = WorldLocation(GetMapId(), GetPositionX(), GetPositionY(), GetPositionZ(), GetOrientation());
+ return;
+ }
+ }
+
+ // In error cases use homebind position
+ m_bgData.joinPos = WorldLocation(m_homebindMapId, m_homebindX, m_homebindY, m_homebindZ, 0.0f);
+}
+
void Player::LeaveBattleground(bool teleportToEntryPoint)
{
if(BattleGround *bg = GetBattleGround())
@@ -18528,9 +18643,9 @@ bool Player::CanJoinToBattleground() const
bool Player::CanReportAfkDueToLimit()
{
// a player can complain about 15 people per 5 minutes
- if(m_bgAfkReportedCount >= 15)
+ if(m_bgData.bgAfkReportedCount++ >= 15)
return false;
- ++m_bgAfkReportedCount;
+
return true;
}
@@ -18542,15 +18657,15 @@ void Player::ReportedAfkBy(Player* reporter)
return;
// check if player has 'Idle' or 'Inactive' debuff
- if(m_bgAfkReporter.find(reporter->GetGUIDLow())==m_bgAfkReporter.end() && !HasAura(43680) && !HasAura(43681) && reporter->CanReportAfkDueToLimit())
+ if(m_bgData.bgAfkReporter.find(reporter->GetGUIDLow())==m_bgData.bgAfkReporter.end() && !HasAura(43680) && !HasAura(43681) && reporter->CanReportAfkDueToLimit())
{
- m_bgAfkReporter.insert(reporter->GetGUIDLow());
+ m_bgData.bgAfkReporter.insert(reporter->GetGUIDLow());
// 3 players have to complain to apply debuff
- if(m_bgAfkReporter.size() >= 3)
+ if(m_bgData.bgAfkReporter.size() >= 3)
{
// cast 'Idle' spell
CastSpell(this, 43680, true);
- m_bgAfkReporter.clear();
+ m_bgData.bgAfkReporter.clear();
}
}
}
@@ -19308,7 +19423,7 @@ BattleGround* Player::GetBattleGround() const
if(GetBattleGroundId()==0)
return NULL;
- return sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgTypeID);
+ return sBattleGroundMgr.GetBattleGround(GetBattleGroundId(), m_bgData.bgTypeID);
}
bool Player::InArena() const
@@ -21334,6 +21449,18 @@ void Player::_SaveEquipmentSets()
}
}
+void Player::_SaveBGData()
+{
+ CharacterDatabase.PExecute("DELETE FROM character_battleground_data WHERE guid='%u'", GetGUIDLow());
+ if (m_bgData.bgInstanceID)
+ {
+ /* guid, bgInstanceID, bgTeam, x, y, z, o, map, taxi[0], taxi[1], mountSpell */
+ CharacterDatabase.PExecute("INSERT INTO character_battleground_data VALUES ('%u', '%u', '%u', '%f', '%f', '%f', '%f', '%u', '%u', '%u', '%u')",
+ GetGUIDLow(), m_bgData.bgInstanceID, m_bgData.bgTeam, m_bgData.joinPos.coord_x, m_bgData.joinPos.coord_y, m_bgData.joinPos.coord_z,
+ m_bgData.joinPos.orientation, m_bgData.joinPos.mapid, m_bgData.taxiPath[0], m_bgData.taxiPath[1], m_bgData.mountSpell);
+ }
+}
+
void Player::DeleteEquipmentSet(uint64 setGuid)
{
for(EquipmentSets::iterator itr = m_EquipmentSets.begin(); itr != m_EquipmentSets.end(); ++itr)
diff --git a/src/game/Player.h b/src/game/Player.h
index a6f1b37f2ab..cc0cc83b3b0 100644
--- a/src/game/Player.h
+++ b/src/game/Player.h
@@ -789,14 +789,17 @@ enum PlayerLoginQueryIndex
PLAYER_LOGIN_QUERY_LOADACHIEVEMENTS = 18,
PLAYER_LOGIN_QUERY_LOADCRITERIAPROGRESS = 19,
PLAYER_LOGIN_QUERY_LOADEQUIPMENTSETS = 20,
- MAX_PLAYER_LOGIN_QUERY = 21
+ PLAYER_LOGIN_QUERY_LOADBGDATA = 21,
+ MAX_PLAYER_LOGIN_QUERY = 22
};
enum PlayerDelayedOperations
{
- DELAYED_SAVE_PLAYER = 1,
- DELAYED_RESURRECT_PLAYER = 2,
- DELAYED_SPELL_CAST_DESERTER = 4,
+ DELAYED_SAVE_PLAYER = 0x01,
+ DELAYED_RESURRECT_PLAYER = 0x02,
+ DELAYED_SPELL_CAST_DESERTER = 0x04,
+ DELAYED_BG_MOUNT_RESTORE = 0x08, ///< Flag to restore mount state after teleport from BG
+ DELAYED_BG_TAXI_RESTORE = 0x10, ///< Flag to restore taxi state after teleport from BG
DELAYED_END
};
@@ -882,7 +885,36 @@ class TRINITY_DLL_SPEC PlayerTaxi
std::ostringstream& operator<< (std::ostringstream& ss, PlayerTaxi const& taxi);
-class TRINITY_DLL_SPEC Player : public Unit
+class Player;
+
+/// Holder for BattleGround data
+struct BGData
+{
+ BGData() : bgInstanceID(0), bgTypeID(BATTLEGROUND_TYPE_NONE), bgAfkReportedCount(0), bgAfkReportedTimer(0),
+ bgTeam(0), mountSpell(0) { ClearTaxiPath(); }
+
+
+ uint32 bgInstanceID; ///< This variable is set to bg->m_InstanceID,
+ /// when player is teleported to BG - (it is battleground's GUID)
+ BattleGroundTypeId bgTypeID;
+
+ std::set<uint32> bgAfkReporter;
+ uint8 bgAfkReportedCount;
+ time_t bgAfkReportedTimer;
+
+ uint32 bgTeam; ///< What side the player will be added to
+
+
+ uint32 mountSpell;
+ uint32 taxiPath[2];
+
+ WorldLocation joinPos; ///< From where player entered BG
+
+ void ClearTaxiPath() { taxiPath[0] = taxiPath[1] = 0; }
+ bool HasTaxiPath() const { return taxiPath[0] && taxiPath[1]; }
+};
+
+class MANGOS_DLL_SPEC Player : public Unit
{
friend class WorldSession;
friend void Item::AddToUpdateQueueOf(Player *player);
@@ -907,6 +939,8 @@ class TRINITY_DLL_SPEC Player : public Unit
return TeleportTo(loc.mapid, loc.coord_x, loc.coord_y, loc.coord_z, loc.orientation, options);
}
+ bool TeleportToBGEntryPoint();
+
void SetSummonPoint(uint32 mapid, float x, float y, float z)
{
m_summon_expire = time(NULL) + MAX_PLAYER_SUMMON_DELAY;
@@ -954,6 +988,7 @@ class TRINITY_DLL_SPEC Player : public Unit
bool ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc = NULL, uint32 spellid = 0);
bool ActivateTaxiPathTo(uint32 taxi_path_id, uint32 spellid = 0);
void CleanupAfterTaxiFlight();
+ void ContinueTaxiFlight();
// mount_id can be used in scripting calls
bool isAcceptWhispers() const { return m_ExtraFlags & PLAYER_EXTRA_ACCEPT_WHISPERS; }
void SetAcceptWhispers(bool on) { if(on) m_ExtraFlags |= PLAYER_EXTRA_ACCEPT_WHISPERS; else m_ExtraFlags &= ~PLAYER_EXTRA_ACCEPT_WHISPERS; }
@@ -1855,10 +1890,10 @@ class TRINITY_DLL_SPEC Player : public Unit
/*** BATTLEGROUND SYSTEM ***/
/*********************************************************/
- bool InBattleGround() const { return m_bgBattleGroundID != 0; }
+ bool InBattleGround() const { return m_bgData.bgInstanceID != 0; }
bool InArena() const;
- uint32 GetBattleGroundId() const { return m_bgBattleGroundID; }
- BattleGroundTypeId GetBattleGroundTypeId() const { return m_bgTypeID; }
+ uint32 GetBattleGroundId() const { return m_bgData.bgInstanceID; }
+ BattleGroundTypeId GetBattleGroundTypeId() const { return m_bgData.bgTypeID; }
BattleGround* GetBattleGround() const;
@@ -1894,8 +1929,8 @@ class TRINITY_DLL_SPEC Player : public Unit
void SetBattleGroundId(uint32 val, BattleGroundTypeId bgTypeId)
{
- m_bgBattleGroundID = val;
- m_bgTypeID = bgTypeId;
+ m_bgData.bgInstanceID = val;
+ m_bgData.bgTypeID = bgTypeId;
}
uint32 AddBattleGroundQueueId(BattleGroundQueueTypeId val)
{
@@ -1942,20 +1977,17 @@ class TRINITY_DLL_SPEC Player : public Unit
return true;
return false;
}
- WorldLocation const& GetBattleGroundEntryPoint() const { return m_bgEntryPoint; }
- void SetBattleGroundEntryPoint(uint32 Map, float PosX, float PosY, float PosZ, float PosO )
- {
- m_bgEntryPoint = WorldLocation(Map,PosX,PosY,PosZ,PosO);
- }
+ WorldLocation const& GetBattleGroundEntryPoint() const { return m_bgData.joinPos; }
+ void SetBattleGroundEntryPoint();
- void SetBGTeam(uint32 team) { m_bgTeam = team; }
- uint32 GetBGTeam() const { return m_bgTeam ? m_bgTeam : GetTeam(); }
+ void SetBGTeam(uint32 team) { m_bgData.bgTeam = team; }
+ uint32 GetBGTeam() const { return m_bgData.bgTeam ? m_bgData.bgTeam : GetTeam(); }
void LeaveBattleground(bool teleportToEntryPoint = true);
bool CanJoinToBattleground() const;
bool CanReportAfkDueToLimit();
void ReportedAfkBy(Player* reporter);
- void ClearAfkReports() { m_bgAfkReporter.clear(); }
+ void ClearAfkReports() { m_bgData.bgAfkReporter.clear(); }
bool GetBGAccessByLevel(BattleGroundTypeId bgTypeId) const;
bool isTotalImmunity();
@@ -2035,7 +2067,6 @@ class TRINITY_DLL_SPEC Player : public Unit
float m_homebindX;
float m_homebindY;
float m_homebindZ;
- void RelocateToHomebind(uint32 & newMap) { newMap = m_homebindMapId; Relocate(m_homebindX,m_homebindY,m_homebindZ); }
// currently visible objects at player client
typedef std::set<uint64> ClientGUIDs;
@@ -2158,13 +2189,12 @@ class TRINITY_DLL_SPEC Player : public Unit
bool canSeeSpellClickOn(Creature const* creature) const;
protected:
+ uint32 m_contestedPvPTimer;
+
/*********************************************************/
/*** BATTLEGROUND SYSTEM ***/
/*********************************************************/
- /* this variable is set to bg->m_InstanceID, when player is teleported to BG - (it is battleground's GUID)*/
- uint32 m_bgBattleGroundID;
- BattleGroundTypeId m_bgTypeID;
/*
this is an array of BG queues (BgTypeIDs) in which is player
*/
@@ -2173,15 +2203,9 @@ class TRINITY_DLL_SPEC Player : public Unit
BattleGroundQueueTypeId bgQueueTypeId;
uint32 invitedToInstance;
};
- BgBattleGroundQueueID_Rec m_bgBattleGroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES];
- WorldLocation m_bgEntryPoint;
- std::set<uint32> m_bgAfkReporter;
- uint8 m_bgAfkReportedCount;
- time_t m_bgAfkReportedTimer;
- uint32 m_contestedPvPTimer;
-
- uint32 m_bgTeam; // what side the player will be added to
+ BgBattleGroundQueueID_Rec m_bgBattleGroundQueueID[PLAYER_MAX_BATTLEGROUND_QUEUES];
+ BGData m_bgData;
/*********************************************************/
/*** QUEST SYSTEM ***/
@@ -2214,6 +2238,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void _LoadDeclinedNames(QueryResult *result);
void _LoadArenaTeamInfo(QueryResult *result);
void _LoadEquipmentSets(QueryResult *result);
+ void _LoadBGData(QueryResult* result);
/*********************************************************/
/*** SAVE SYSTEM ***/
@@ -2227,6 +2252,7 @@ class TRINITY_DLL_SPEC Player : public Unit
void _SaveDailyQuestStatus();
void _SaveSpells();
void _SaveEquipmentSets();
+ void _SaveBGData();
void _SetCreateBits(UpdateMask *updateMask, Player *target) const;
void _SetUpdateBits(UpdateMask *updateMask, Player *target) const;
@@ -2389,7 +2415,11 @@ class TRINITY_DLL_SPEC Player : public Unit
bool IsHasDelayedTeleport() const { return m_bHasDelayedTeleport; }
void SetDelayedTeleportFlag(bool setting) { m_bHasDelayedTeleport = setting; }
- void ScheduleDelayedOperation(uint32 operation);
+ void ScheduleDelayedOperation(uint32 operation)
+ {
+ if(operation < DELAYED_END)
+ m_DelayedOperations |= operation;
+ }
GridReference<Player> m_gridRef;
MapReference m_mapRef;