Merge branch 'master' into Playerbot

# Conflicts:
#	src/server/game/Entities/Player/Player.cpp
#	src/server/game/Entities/Player/Player.h
#	src/server/game/Entities/Unit/Unit.h
This commit is contained in:
郑佩茹
2022-08-16 16:13:26 -06:00
159 changed files with 5246 additions and 2794 deletions

View File

@@ -506,6 +506,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
sAuctionMgr->SendAuctionSalePendingMail(auction, trans);
sAuctionMgr->SendAuctionSuccessfulMail(auction, trans);
sAuctionMgr->SendAuctionWonMail(auction, trans);
sScriptMgr->OnAuctionSuccessful(auctionHouse, auction);
SendAuctionCommandResult(auction->Id, AUCTION_PLACE_BID, ERR_AUCTION_OK);

View File

@@ -533,13 +533,20 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData)
}
else // leave queue
{
bgQueue.RemovePlayer(_player->GetGUID(), true);
_player->RemoveBattlegroundQueueId(bgQueueTypeId);
for (auto const& playerGuid : ginfo.Players)
{
auto player = ObjectAccessor::FindConnectedPlayer(playerGuid);
if (!player)
continue;
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL);
SendPacket(&data);
bgQueue.RemovePlayer(playerGuid, true);
player->RemoveBattlegroundQueueId(bgQueueTypeId);
LOG_DEBUG("bg.battleground", "Battleground: player {} {} left queue for bgtype {}, queue type {}.", _player->GetName(), _player->GetGUID().ToString(), bg->GetBgTypeID(), bgQueueTypeId);
sBattlegroundMgr->BuildBattlegroundStatusPacket(&data, bg, queueSlot, STATUS_NONE, 0, 0, 0, TEAM_NEUTRAL);
player->SendDirectMessage(&data);
LOG_DEBUG("bg.battleground", "Battleground: player {} {} left queue for bgtype {}, queue type {}.", player->GetName(), playerGuid.ToString(), bg->GetBgTypeID(), bgQueueTypeId);
}
// player left queue, we should update it - do not update Arena Queue
if (!ginfo.ArenaType)

View File

@@ -2189,7 +2189,7 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
// Update Taxi path
TaxiMask newTaxiMask;
memset(newTaxiMask, 0, sizeof(newTaxiMask));
newTaxiMask.fill(0);
TaxiMask const& factionMask = newTeam == TEAM_HORDE ? sHordeTaxiNodesMask : sAllianceTaxiNodesMask;
for (auto const& itr : sTaxiPathSetBySource)
@@ -2535,6 +2535,12 @@ void WorldSession::HandleCharFactionOrRaceChangeCallback(std::shared_ptr<Charact
}
}
// Re-check all achievement criterias
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_ADD_AT_LOGIN_FLAG);
stmt->SetData(0, uint16(AT_LOGIN_CHECK_ACHIEVS));
stmt->SetData(1, lowGuid);
trans->Append(stmt);
CharacterDatabase.CommitTransaction(trans);
LOG_DEBUG("entities.player", "{} (IP: {}) changed race from {} to {}", GetPlayerInfo(), GetRemoteAddress(), oldRace, factionChangeInfo->Race);

View File

@@ -188,6 +188,22 @@ void WorldSession::HandleMoveWorldportAck()
GetPlayer()->SendInitialPacketsAfterAddToMap();
// flight fast teleport case
if (GetPlayer()->IsInFlight())
{
if (!GetPlayer()->InBattleground())
{
// short preparations to continue flight
MovementGenerator* movementGenerator = GetPlayer()->GetMotionMaster()->top();
movementGenerator->Initialize(GetPlayer());
return;
}
// battleground state prepare, stop flight
GetPlayer()->GetMotionMaster()->MovementExpired();
GetPlayer()->CleanupAfterTaxiFlight();
}
// resurrect character at enter into instance where his corpse exist after add to map
Corpse* corpse = GetPlayer()->GetMap()->GetCorpseByPlayer(GetPlayer()->GetGUID());
if (corpse && corpse->GetType() != CORPSE_BONES)

View File

@@ -15,6 +15,7 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "GameTime.h"
#include "ObjectMgr.h"
#include "Opcodes.h"
#include "Player.h"
@@ -36,25 +37,24 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
void WorldSession::SendTaxiStatus(ObjectGuid guid)
{
// cheating checks
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
if (!unit)
Player* const player = GetPlayer();
Creature* unit = ObjectAccessor::GetCreature(*player, guid);
if (!unit || unit->IsHostileTo(player) || !unit->HasNpcFlag(UNIT_NPC_FLAG_FLIGHTMASTER))
{
LOG_DEBUG("network", "WorldSession::SendTaxiStatus - Unit ({}) not found.", guid.ToString());
return;
}
uint32 curloc = sObjectMgr->GetNearestTaxiNode(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetMapId(), GetPlayer()->GetTeamId());
// not found nearest
if (curloc == 0)
// find taxi node
uint32 nearest = sObjectMgr->GetNearestTaxiNode(unit->GetPositionX(), unit->GetPositionY(), unit->GetPositionZ(), unit->GetMapId(), player->GetTeamId());
if (!nearest)
{
return;
LOG_DEBUG("network", "WORLD: current location {} ", curloc);
}
WorldPacket data(SMSG_TAXINODE_STATUS, 9);
data << guid;
data << uint8(GetPlayer()->m_taxi.IsTaximaskNodeKnown(curloc) ? 1 : 0);
data << uint8(player->m_taxi.IsTaximaskNodeKnown(nearest) ? 1 : 0);
SendPacket(&data);
LOG_DEBUG("network", "WORLD: Sent SMSG_TAXINODE_STATUS");
}
@@ -166,7 +166,7 @@ void WorldSession::SendDiscoverNewTaxiNode(uint32 nodeid)
}
}
void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
void WorldSession::HandleActivateTaxiExpressOpcode(WorldPacket& recvData)
{
LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS");
@@ -179,6 +179,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
if (!npc)
{
LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - Unit ({}) not found or you can't interact with it.", guid.ToString());
SendActivateTaxiReply(ERR_TAXITOOFARAWAY);
return;
}
std::vector<uint32> nodes;
@@ -218,6 +219,46 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
ReadMovementInfo(recvData, &movementInfo);
recvData.read_skip<uint32>(); // spline id
// in taxi flight packet received in 2 case:
// 1) end taxi path in far (multi-node) flight
// 2) switch from one map to other in case multim-map taxi path
// we need process only (1)
uint32 curDest = GetPlayer()->m_taxi.GetTaxiDestination();
if (curDest)
{
TaxiNodesEntry const* curDestNode = sTaxiNodesStore.LookupEntry(curDest);
// far teleport case
if (curDestNode && curDestNode->map_id != GetPlayer()->GetMapId() && GetPlayer()->GetMotionMaster()->GetCurrentMovementGeneratorType() == FLIGHT_MOTION_TYPE)
{
if (FlightPathMovementGenerator* flight = dynamic_cast<FlightPathMovementGenerator*>(GetPlayer()->GetMotionMaster()->top()))
{
// short preparations to continue flight
flight->SetCurrentNodeAfterTeleport();
TaxiPathNodeEntry const* node = flight->GetPath()[flight->GetCurrentNode()];
flight->SkipCurrentNode();
GetPlayer()->TeleportTo(curDestNode->map_id, node->x, node->y, node->z, GetPlayer()->GetOrientation(), TELE_TO_NOT_LEAVE_TAXI);
}
}
return;
}
// at this point only 1 node is expected (final destination)
if (GetPlayer()->m_taxi.GetPath().size() != 1)
{
return;
}
GetPlayer()->CleanupAfterTaxiFlight();
GetPlayer()->SetFallInformation(GameTime::GetGameTime().count(), GetPlayer()->GetPositionZ());
if (GetPlayer()->pvpInfo.IsHostile)
{
GetPlayer()->CastSpell(GetPlayer(), 2479, true);
}
}
void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
@@ -234,6 +275,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
if (!npc)
{
LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - Unit ({}) not found or you can't interact with it.", guid.ToString());
SendActivateTaxiReply(ERR_TAXITOOFARAWAY);
return;
}