[8339] Improved storing/restoring BG entry point

* Introduced new table character_battleground_data
    * Entry point is now stored on BG enter event not join event
    * Entry point for dungeons is now correctly set to nearest graveyard
      (this prevent well known assert in GetInstance because of porting to already destroyed instance)
    * Teleporting from BG correctly restore mount state
    * Teleporting from BG correctly restore taxi flight
      (in multipath flight you will end up in nearest transition point on the route)

    Signed-off-by: ApoC <[email protected]>

--HG--
branch : trunk
This commit is contained in:
megamage
2009-08-12 20:27:00 -05:00
parent ed637fbf1f
commit 4f4775a31b
8 changed files with 344 additions and 196 deletions
+221 -94
View File
@@ -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,18 +1917,31 @@ void Player::ProcessDelayedOperations()
CastSpell(this, SPELL_ID_DESERTER, true); // Deserter
}
if (m_DelayedOperations & DELAYED_BG_MOUNT_RESTORE)
{
if (m_bgData.mountSpell)
{
CastSpell(this, m_bgData.mountSpell, true);
m_bgData.mountSpell = 0;
}
}
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();
ContinueTaxiFlight();
}
}
//we have executed ALL delayed ops, so clear the flag
m_DelayedOperations = 0;
}
void Player::ScheduleDelayedOperation(uint32 operation)
{
if(operation >= DELAYED_END)
return;
m_DelayedOperations |= operation;
}
void Player::AddToWorld()
{
///- Do not add/remove the player from the object storage
@@ -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());
BattleGround *currentBg = NULL;
if(m_bgData.bgInstanceID) //saved in BattleGround
currentBg = sBattleGroundMgr.GetBattleGround(m_bgData.bgInstanceID, BATTLEGROUND_TYPE_NONE);
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);
// 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)