mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[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 <apoc@nymfe.net>
This commit is contained in:
parent
5c2ae96e38
commit
6d9448dd7f
12 changed files with 328 additions and 160 deletions
|
|
@ -59,7 +59,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,bgid,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 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_index,stackcount,amount,maxduration,remaintime,remaincharges FROM character_aura WHERE guid = '%u'", GUID_LOPART(m_guid));
|
||||
|
|
@ -82,6 +82,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;
|
||||
}
|
||||
|
|
@ -745,54 +746,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))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue