mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-28 16:16:27 +00:00
feat(Core/Misc): implement ObjectGuid class (port from TC) (#4885)
This commit is contained in:
@@ -23,10 +23,10 @@ void WorldSession::HandleInspectArenaTeamsOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "MSG_INSPECT_ARENA_TEAMS");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Inspect Arena stats (GUID: %u TypeId: %u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
|
||||
LOG_DEBUG("network", "Inspect Arena stats (%s)", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayer(guid))
|
||||
@@ -118,7 +118,7 @@ void WorldSession::HandleArenaTeamInviteOpcode(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// OK result but don't send invite
|
||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUID()))
|
||||
return;
|
||||
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && player->GetTeamId() != GetPlayer()->GetTeamId())
|
||||
@@ -179,7 +179,7 @@ void WorldSession::HandleArenaTeamAcceptOpcode(WorldPacket& /*recvData*/)
|
||||
}
|
||||
|
||||
// Only allow members of the other faction to join the team if cross faction interaction is enabled
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(arenaTeam->GetCaptain()))
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && _player->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(arenaTeam->GetCaptain().GetCounter()))
|
||||
{
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_CREATE_S, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
return;
|
||||
@@ -363,7 +363,7 @@ void WorldSession::HandleArenaTeamRemoveOpcode(WorldPacket& recvData)
|
||||
arenaTeam->DelMember(member->Guid, true);
|
||||
|
||||
// Broadcast event
|
||||
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, 0, 3, name, arenaTeam->GetName(), _player->GetName());
|
||||
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_REMOVE_SSS, ObjectGuid::Empty, 3, name, arenaTeam->GetName(), _player->GetName());
|
||||
}
|
||||
|
||||
void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
|
||||
@@ -408,7 +408,7 @@ void WorldSession::HandleArenaTeamLeaderOpcode(WorldPacket& recvData)
|
||||
arenaTeam->SetCaptain(member->Guid);
|
||||
|
||||
// Broadcast event
|
||||
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, 0, 3, _player->GetName().c_str(), name, arenaTeam->GetName());
|
||||
arenaTeam->BroadcastEvent(ERR_ARENA_TEAM_LEADER_CHANGED_SSS, ObjectGuid::Empty, 3, _player->GetName().c_str(), name, arenaTeam->GetName());
|
||||
}
|
||||
|
||||
void WorldSession::SendArenaTeamCommandResult(uint32 teamAction, const std::string& team, const std::string& player, uint32 errorId)
|
||||
|
||||
@@ -23,14 +23,14 @@
|
||||
//void called when player click on auctioneer npc
|
||||
void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid; //NPC guid
|
||||
ObjectGuid guid; //NPC guid
|
||||
recvData >> guid;
|
||||
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_AUCTIONEER);
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionHelloOpcode - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ void WorldSession::HandleAuctionHelloOpcode(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
//this void causes that auction window is opened
|
||||
void WorldSession::SendAuctionHello(uint64 guid, Creature* unit)
|
||||
void WorldSession::SendAuctionHello(ObjectGuid guid, Creature* unit)
|
||||
{
|
||||
if (GetPlayer()->getLevel() < sWorld->getIntConfig(CONFIG_AUCTION_LEVEL_REQ))
|
||||
{
|
||||
@@ -59,7 +59,7 @@ void WorldSession::SendAuctionHello(uint64 guid, Creature* unit)
|
||||
return;
|
||||
|
||||
WorldPacket data(MSG_AUCTION_HELLO, 12);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
data << uint32(ahEntry->houseId);
|
||||
data << uint8(1); // 3.3.3: 1 - AH enabled, 0 - AH disabled
|
||||
SendPacket(&data);
|
||||
@@ -78,12 +78,12 @@ void WorldSession::SendAuctionCommandResult(uint32 auctionId, uint32 Action, uin
|
||||
}
|
||||
|
||||
//this function sends notification, if bidder is online
|
||||
void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, uint64 bidder, uint32 bidSum, uint32 diff, uint32 item_template)
|
||||
void WorldSession::SendAuctionBidderNotification(uint32 location, uint32 auctionId, ObjectGuid bidder, uint32 bidSum, uint32 diff, uint32 item_template)
|
||||
{
|
||||
WorldPacket data(SMSG_AUCTION_BIDDER_NOTIFICATION, (8 * 4));
|
||||
data << uint32(location);
|
||||
data << uint32(auctionId);
|
||||
data << uint64(bidder);
|
||||
data << bidder;
|
||||
data << uint32(bidSum);
|
||||
data << uint32(diff);
|
||||
data << uint32(item_template);
|
||||
@@ -108,13 +108,12 @@ void WorldSession::SendAuctionOwnerNotification(AuctionEntry* auction)
|
||||
//this void creates new auction and adds auction to some auctionhouse
|
||||
void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
{
|
||||
uint64 auctioneer;
|
||||
ObjectGuid auctioneer;
|
||||
uint32 itemsCount, etime, bid, buyout;
|
||||
recvData >> auctioneer;
|
||||
recvData >> itemsCount;
|
||||
|
||||
uint64 itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
|
||||
memset(itemGUIDs, 0, sizeof(itemGUIDs));
|
||||
ObjectGuid itemGUIDs[MAX_AUCTION_ITEMS]; // 160 slot = 4x 36 slot bag + backpack 16 slot
|
||||
uint32 count[MAX_AUCTION_ITEMS];
|
||||
memset(count, 0, sizeof(count));
|
||||
|
||||
@@ -147,7 +146,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
if (bid > MAX_MONEY_AMOUNT || buyout > MAX_MONEY_AMOUNT)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Player %s (GUID %u) attempted to sell item with higher price than max gold amount.", _player->GetName().c_str(), _player->GetGUIDLow());
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Player %s (%s) attempted to sell item with higher price than max gold amount.",
|
||||
_player->GetName().c_str(), _player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
SendAuctionCommandResult(0, AUCTION_SELL_ITEM, ERR_AUCTION_DATABASE_ERROR);
|
||||
return;
|
||||
@@ -157,7 +157,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(auctioneer));
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) not found or you can't interact with him.", auctioneer.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -166,7 +166,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
if (!auctionHouseEntry)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (GUID: %u) has wrong faction.", GUID_LOPART(auctioneer));
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionSellItem - Unit (%s) has wrong faction.", auctioneer.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
if (itemEntry == 0)
|
||||
itemEntry = item->GetTemplate()->ItemId;
|
||||
|
||||
if (sAuctionMgr->GetAItem(item->GetGUIDLow()) || !item->CanBeTraded() || item->IsNotEmptyBag() ||
|
||||
if (sAuctionMgr->GetAItem(item->GetGUID()) || !item->CanBeTraded() || item->IsNotEmptyBag() ||
|
||||
item->GetTemplate()->Flags & ITEM_FLAG_CONJURED || item->GetUInt32Value(ITEM_FIELD_DURATION) ||
|
||||
item->GetCount() < count[i] || itemEntry != item->GetTemplate()->ItemId)
|
||||
{
|
||||
@@ -266,19 +266,36 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
AH->Id = sObjectMgr->GenerateAuctionID();
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_AUCTION))
|
||||
AH->auctioneer = 23442;
|
||||
AH->houseId = AUCTIONHOUSE_NEUTRAL;
|
||||
else
|
||||
AH->auctioneer = GUID_LOPART(auctioneer);
|
||||
{
|
||||
CreatureData const* auctioneerData = sObjectMgr->GetCreatureData(creature->GetSpawnId());
|
||||
if (!auctioneerData)
|
||||
{
|
||||
LOG_ERROR("server", "Data for auctioneer not found (%s)", auctioneer.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
CreatureTemplate const* auctioneerInfo = sObjectMgr->GetCreatureTemplate(auctioneerData->id);
|
||||
if (!auctioneerInfo)
|
||||
{
|
||||
LOG_ERROR("server", "Non existing auctioneer (%s)", auctioneer.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
const AuctionHouseEntry* AHEntry = sAuctionMgr->GetAuctionHouseEntry(auctioneerInfo->faction);
|
||||
AH->houseId = AHEntry->houseId;
|
||||
}
|
||||
|
||||
// Required stack size of auction matches to current item stack size, just move item to auctionhouse
|
||||
if (itemsCount == 1 && item->GetCount() == count[i])
|
||||
{
|
||||
AH->item_guidlow = item->GetGUIDLow();
|
||||
AH->item_guid = item->GetGUID();
|
||||
AH->item_template = item->GetEntry();
|
||||
AH->itemCount = item->GetCount();
|
||||
AH->owner = _player->GetGUIDLow();
|
||||
AH->owner = _player->GetGUID();
|
||||
AH->startbid = bid;
|
||||
AH->bidder = 0;
|
||||
AH->bidder = ObjectGuid::Empty;
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->expire_time = time(nullptr) + auctionTime;
|
||||
@@ -286,7 +303,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUIDLow(), AH->auctioneer, item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
|
||||
LOG_DEBUG("server", "CMSG_AUCTION_SELL_ITEM: Player %s (%s) is selling item %s entry %u (%s) with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u",
|
||||
_player->GetName().c_str(), _player->GetGUID().ToString().c_str(), item->GetTemplate()->Name1.c_str(), item->GetEntry(), item->GetGUID().ToString().c_str(), item->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
|
||||
#endif
|
||||
sAuctionMgr->AddAItem(item);
|
||||
auctionHouse->AddAuction(AH);
|
||||
@@ -315,12 +333,12 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
AH->item_guidlow = newItem->GetGUIDLow();
|
||||
AH->item_guid = newItem->GetGUID();
|
||||
AH->item_template = newItem->GetEntry();
|
||||
AH->itemCount = newItem->GetCount();
|
||||
AH->owner = _player->GetGUIDLow();
|
||||
AH->owner = _player->GetGUID();
|
||||
AH->startbid = bid;
|
||||
AH->bidder = 0;
|
||||
AH->bidder = ObjectGuid::Empty;
|
||||
AH->bid = 0;
|
||||
AH->buyout = buyout;
|
||||
AH->expire_time = time(nullptr) + auctionTime;
|
||||
@@ -328,7 +346,8 @@ void WorldSession::HandleAuctionSellItem(WorldPacket& recvData)
|
||||
AH->auctionHouseEntry = auctionHouseEntry;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "CMSG_AUCTION_SELL_ITEM: Player %s (guid %d) is selling item %s entry %u (guid %d) to auctioneer %u with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u", _player->GetName().c_str(), _player->GetGUIDLow(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUIDLow(), AH->auctioneer, newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
|
||||
LOG_DEBUG("server", "CMSG_AUCTION_SELL_ITEM: Player %s (%s) is selling item %s entry %u (%s) with count %u with initial bid %u with buyout %u and with time %u (in sec) in auctionhouse %u",
|
||||
_player->GetName().c_str(), _player->GetGUID().ToString().c_str(), newItem->GetTemplate()->Name1.c_str(), newItem->GetEntry(), newItem->GetGUID().ToString().c_str(), newItem->GetCount(), bid, buyout, auctionTime, AH->GetHouseId());
|
||||
#endif
|
||||
sAuctionMgr->AddAItem(newItem);
|
||||
auctionHouse->AddAuction(AH);
|
||||
@@ -382,7 +401,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_PLACE_BID");
|
||||
#endif
|
||||
|
||||
uint64 auctioneer;
|
||||
ObjectGuid auctioneer;
|
||||
uint32 auctionId;
|
||||
uint32 price;
|
||||
recvData >> auctioneer;
|
||||
@@ -395,7 +414,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionPlaceBid - Unit (%s) not found or you can't interact with him.", auctioneer.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -409,7 +428,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
AuctionEntry* auction = auctionHouse->GetAuction(auctionId);
|
||||
Player* player = GetPlayer();
|
||||
|
||||
if (!auction || auction->owner == player->GetGUIDLow())
|
||||
if (!auction || auction->owner == player->GetGUID())
|
||||
{
|
||||
//you cannot bid your own auction:
|
||||
SendAuctionCommandResult(0, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
|
||||
@@ -417,8 +436,8 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// impossible have online own another character (use this for speedup check in case online owner)
|
||||
Player* auction_owner = ObjectAccessor::FindPlayerInOrOutOfWorld(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER));
|
||||
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(MAKE_NEW_GUID(auction->owner, 0, HIGHGUID_PLAYER)) == GetAccountId())
|
||||
Player* auction_owner = ObjectAccessor::FindConnectedPlayer(auction->owner);
|
||||
if (!auction_owner && sObjectMgr->GetPlayerAccountIdByGUID(auction->owner.GetCounter()) == GetAccountId())
|
||||
{
|
||||
//you cannot bid your another character auction:
|
||||
SendAuctionCommandResult(0, AUCTION_PLACE_BID, ERR_AUCTION_BID_OWN);
|
||||
@@ -448,9 +467,9 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
|
||||
if (price < auction->buyout || auction->buyout == 0)
|
||||
{
|
||||
if (auction->bidder > 0)
|
||||
if (auction->bidder)
|
||||
{
|
||||
if (auction->bidder == player->GetGUIDLow())
|
||||
if (auction->bidder == player->GetGUID())
|
||||
player->ModifyMoney(-int32(price - auction->bid));
|
||||
else
|
||||
{
|
||||
@@ -462,12 +481,12 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
else
|
||||
player->ModifyMoney(-int32(price));
|
||||
|
||||
auction->bidder = player->GetGUIDLow();
|
||||
auction->bidder = player->GetGUID();
|
||||
auction->bid = price;
|
||||
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, price);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_AUCTION_BID);
|
||||
stmt->setUInt32(0, auction->bidder);
|
||||
stmt->setUInt32(0, auction->bidder.GetCounter());
|
||||
stmt->setUInt32(1, auction->bid);
|
||||
stmt->setUInt32(2, auction->Id);
|
||||
trans->Append(stmt);
|
||||
@@ -477,7 +496,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
else
|
||||
{
|
||||
//buyout:
|
||||
if (player->GetGUIDLow() == auction->bidder)
|
||||
if (player->GetGUID() == auction->bidder)
|
||||
player->ModifyMoney(-int32(auction->buyout - auction->bid));
|
||||
else
|
||||
{
|
||||
@@ -485,7 +504,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
if (auction->bidder) //buyout for bidded auction ..
|
||||
sAuctionMgr->SendAuctionOutbiddedMail(auction, auction->buyout, GetPlayer(), trans);
|
||||
}
|
||||
auction->bidder = player->GetGUIDLow();
|
||||
auction->bidder = player->GetGUID();
|
||||
auction->bid = auction->buyout;
|
||||
GetPlayer()->UpdateAchievementCriteria(ACHIEVEMENT_CRITERIA_TYPE_HIGHEST_AUCTION_BID, auction->buyout);
|
||||
|
||||
@@ -498,7 +517,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket& recvData)
|
||||
|
||||
auction->DeleteFromDB(trans);
|
||||
|
||||
sAuctionMgr->RemoveAItem(auction->item_guidlow);
|
||||
sAuctionMgr->RemoveAItem(auction->item_guid);
|
||||
auctionHouse->RemoveAuction(auction);
|
||||
}
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
@@ -512,7 +531,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_REMOVE_ITEM");
|
||||
#endif
|
||||
|
||||
uint64 auctioneer;
|
||||
ObjectGuid auctioneer;
|
||||
uint32 auctionId;
|
||||
recvData >> auctioneer;
|
||||
recvData >> auctionId;
|
||||
@@ -521,7 +540,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)));
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionRemoveItem - Unit (%s) not found or you can't interact with him.", auctioneer.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -536,12 +555,12 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
Player* player = GetPlayer();
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
if (auction && auction->owner == player->GetGUIDLow())
|
||||
if (auction && auction->owner == player->GetGUID())
|
||||
{
|
||||
Item* pItem = sAuctionMgr->GetAItem(auction->item_guidlow);
|
||||
Item* pItem = sAuctionMgr->GetAItem(auction->item_guid);
|
||||
if (pItem)
|
||||
{
|
||||
if (auction->bidder > 0) // If we have a bidder, we have to send him the money he paid
|
||||
if (auction->bidder) // If we have a bidder, we have to send him the money he paid
|
||||
{
|
||||
uint32 auctionCut = auction->GetAuctionCut();
|
||||
if (!player->HasEnoughMoney(auctionCut)) //player doesn't have enough money, maybe message needed
|
||||
@@ -552,13 +571,13 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// item will deleted or added to received mail list
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELED), AuctionEntry::BuildAuctionMailBody(0, 0, auction->buyout, auction->deposit, 0))
|
||||
MailDraft(auction->BuildAuctionMailSubject(AUCTION_CANCELED), AuctionEntry::BuildAuctionMailBody(ObjectGuid::Empty, 0, auction->buyout, auction->deposit, 0))
|
||||
.AddItem(pItem)
|
||||
.SendMailTo(trans, player, auction, MAIL_CHECK_MASK_COPIED);
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("server", "Auction id: %u has non-existed item (item guid : %u)!!!", auction->Id, auction->item_guidlow);
|
||||
LOG_ERROR("server", "Auction id: %u has non-existed item (item: %s)!!!", auction->Id, auction->item_guid.ToString().c_str());
|
||||
SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR);
|
||||
return;
|
||||
}
|
||||
@@ -567,7 +586,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
{
|
||||
SendAuctionCommandResult(0, AUCTION_CANCEL, ERR_AUCTION_DATABASE_ERROR);
|
||||
//this code isn't possible ... maybe there should be assert
|
||||
LOG_ERROR("server", "CHEATER : %u, he tried to cancel auction (id: %u) of another player, or auction is nullptr", player->GetGUIDLow(), auctionId);
|
||||
LOG_ERROR("server", "CHEATER : %s, he tried to cancel auction (id: %u) of another player, or auction is nullptr", player->GetGUID().ToString().c_str(), auctionId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -580,7 +599,7 @@ void WorldSession::HandleAuctionRemoveItem(WorldPacket& recvData)
|
||||
auction->DeleteFromDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
sAuctionMgr->RemoveAItem(auction->item_guidlow);
|
||||
sAuctionMgr->RemoveAItem(auction->item_guid);
|
||||
auctionHouse->RemoveAuction(auction);
|
||||
}
|
||||
|
||||
@@ -591,7 +610,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_BIDDER_ITEMS");
|
||||
#endif
|
||||
|
||||
uint64 guid; //NPC guid
|
||||
ObjectGuid guid; //NPC guid
|
||||
uint32 listfrom; //page of auctions
|
||||
uint32 outbiddedCount; //count of outbidded auctions
|
||||
|
||||
@@ -608,7 +627,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionListBidderItems - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
recvData.rfinish();
|
||||
return;
|
||||
@@ -649,7 +668,7 @@ void WorldSession::HandleAuctionListBidderItems(WorldPacket& recvData)
|
||||
void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
|
||||
{
|
||||
// prevent crash caused by malformed packet
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 listfrom;
|
||||
|
||||
recvData >> guid;
|
||||
@@ -668,7 +687,7 @@ void WorldSession::HandleAuctionListOwnerItems(WorldPacket& recvData)
|
||||
_player->m_Events.AddEvent(new AuctionListOwnerItemsDelayEvent(guid, _player->GetGUID(), true), _player->m_Events.CalculateTime(delay - diff));
|
||||
}
|
||||
|
||||
void WorldSession::HandleAuctionListOwnerItemsEvent(uint64 creatureGuid)
|
||||
void WorldSession::HandleAuctionListOwnerItemsEvent(ObjectGuid creatureGuid)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_AUCTION_LIST_OWNER_ITEMS");
|
||||
@@ -680,7 +699,7 @@ void WorldSession::HandleAuctionListOwnerItemsEvent(uint64 creatureGuid)
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(creatureGuid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleAuctionListOwnerItems - Unit (%s) not found or you can't interact with him.", creatureGuid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -714,7 +733,7 @@ void WorldSession::HandleAuctionListItems(WorldPacket& recvData)
|
||||
std::string searchedname;
|
||||
uint8 levelmin, levelmax, usable;
|
||||
uint32 listfrom, auctionSlotID, auctionMainCategory, auctionSubCategory, quality;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid;
|
||||
recvData >> listfrom; // start, used for page control listing by 50 elements
|
||||
|
||||
@@ -25,10 +25,10 @@
|
||||
|
||||
void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (GUID: %u TypeId:%u)", GUID_LOPART(guid), GuidHigh2TypeId(GUID_HIPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_BATTLEMASTER_HELLO Message from (%s)", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
@@ -53,7 +53,7 @@ void WorldSession::HandleBattlemasterHelloOpcode(WorldPacket& recvData)
|
||||
SendBattleGroundList(guid, bgTypeId);
|
||||
}
|
||||
|
||||
void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId)
|
||||
void WorldSession::SendBattleGroundList(ObjectGuid guid, BattlegroundTypeId bgTypeId)
|
||||
{
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundListPacket(&data, guid, _player, bgTypeId, 0);
|
||||
@@ -62,7 +62,7 @@ void WorldSession::SendBattleGroundList(uint64 guid, BattlegroundTypeId bgTypeId
|
||||
|
||||
void WorldSession::HandleBattlemasterJoinOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 bgTypeId_;
|
||||
uint32 instanceId; // sent to queue for particular bg from battlemaster's list, currently not used
|
||||
uint8 joinAsGroup;
|
||||
@@ -279,14 +279,14 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvDa
|
||||
Player* allianceFlagCarrier = nullptr;
|
||||
Player* hordeFlagCarrier = nullptr;
|
||||
|
||||
if (uint64 guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
|
||||
if (ObjectGuid guid = bg->GetFlagPickerGUID(TEAM_ALLIANCE))
|
||||
{
|
||||
allianceFlagCarrier = ObjectAccessor::FindPlayer(guid);
|
||||
if (allianceFlagCarrier)
|
||||
++flagCarrierCount;
|
||||
}
|
||||
|
||||
if (uint64 guid = bg->GetFlagPickerGUID(TEAM_HORDE))
|
||||
if (ObjectGuid guid = bg->GetFlagPickerGUID(TEAM_HORDE))
|
||||
{
|
||||
hordeFlagCarrier = ObjectAccessor::FindPlayer(guid);
|
||||
if (hordeFlagCarrier)
|
||||
@@ -303,14 +303,14 @@ void WorldSession::HandleBattlegroundPlayerPositionsOpcode(WorldPacket& /*recvDa
|
||||
data << flagCarrierCount;
|
||||
if (allianceFlagCarrier)
|
||||
{
|
||||
data << uint64(allianceFlagCarrier->GetGUID());
|
||||
data << allianceFlagCarrier->GetGUID();
|
||||
data << float(allianceFlagCarrier->GetPositionX());
|
||||
data << float(allianceFlagCarrier->GetPositionY());
|
||||
}
|
||||
|
||||
if (hordeFlagCarrier)
|
||||
{
|
||||
data << uint64(hordeFlagCarrier->GetGUID());
|
||||
data << hordeFlagCarrier->GetGUID();
|
||||
data << float(hordeFlagCarrier->GetPositionX());
|
||||
data << float(hordeFlagCarrier->GetPositionY());
|
||||
}
|
||||
@@ -361,7 +361,7 @@ void WorldSession::HandleBattlefieldListOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
|
||||
WorldPacket data;
|
||||
sBattlegroundMgr->BuildBattlegroundListPacket(&data, 0, _player, BattlegroundTypeId(bgTypeId), fromWhere);
|
||||
sBattlegroundMgr->BuildBattlegroundListPacket(&data, ObjectGuid::Empty, _player, BattlegroundTypeId(bgTypeId), fromWhere);
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -479,7 +479,7 @@ void WorldSession::HandleBattleFieldPortOpcode(WorldPacket& recvData)
|
||||
if (sWorld->getBoolConfig(CONFIG_BATTLEGROUND_TRACK_DESERTERS))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_DESERTER_TRACK);
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(1, BG_DESERTION_TYPE_LEAVE_QUEUE);
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
@@ -576,7 +576,7 @@ void WorldSession::HandleBattlefieldStatusOpcode(WorldPacket& /*recvData*/)
|
||||
|
||||
void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid; // arena Battlemaster guid
|
||||
ObjectGuid guid; // arena Battlemaster guid
|
||||
uint8 arenaslot; // 2v2, 3v3 or 5v5
|
||||
uint8 asGroup; // asGroup
|
||||
uint8 isRated; // isRated
|
||||
@@ -801,7 +801,7 @@ void WorldSession::HandleBattlemasterJoinArena(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleReportPvPAFK(WorldPacket& recvData)
|
||||
{
|
||||
uint64 playerGuid;
|
||||
ObjectGuid playerGuid;
|
||||
recvData >> playerGuid;
|
||||
Player* reportedPlayer = ObjectAccessor::FindPlayer(playerGuid);
|
||||
|
||||
|
||||
@@ -38,8 +38,8 @@ Copied events should probably have a new owner
|
||||
|
||||
void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [" UI64FMTD "]", guid);
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GET_CALENDAR [%s]", guid.ToString().c_str());
|
||||
|
||||
time_t currTime = time(nullptr);
|
||||
|
||||
@@ -57,12 +57,12 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent((*itr)->GetEventId()))
|
||||
{
|
||||
data << uint8(calendarEvent->IsGuildEvent());
|
||||
data.appendPackGUID(calendarEvent->GetCreatorGUID());
|
||||
data << calendarEvent->GetCreatorGUID().WriteAsPacked();
|
||||
}
|
||||
else
|
||||
{
|
||||
data << uint8(0);
|
||||
data.appendPackGUID((*itr)->GetSenderGUID());
|
||||
data << (*itr)->GetSenderGUID().WriteAsPacked();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -78,7 +78,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
||||
data.AppendPackedTime(calendarEvent->GetEventTime());
|
||||
data << uint32(calendarEvent->GetFlags());
|
||||
data << int32(calendarEvent->GetDungeonId());
|
||||
data.appendPackGUID(calendarEvent->GetCreatorGUID());
|
||||
data << calendarEvent->GetCreatorGUID().WriteAsPacked();
|
||||
}
|
||||
|
||||
data << uint32(currTime); // server time
|
||||
@@ -88,7 +88,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
||||
uint32 boundCounter = 0;
|
||||
for (uint8 i = 0; i < MAX_DIFFICULTY; ++i)
|
||||
{
|
||||
BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(_player->GetGUIDLow(), Difficulty(i));
|
||||
BoundInstancesMap const& m_boundInstances = sInstanceSaveMgr->PlayerGetBoundInstances(_player->GetGUID(), Difficulty(i));
|
||||
for (BoundInstancesMap::const_iterator itr = m_boundInstances.begin(); itr != m_boundInstances.end(); ++itr)
|
||||
{
|
||||
if (itr->second.perm)
|
||||
@@ -98,7 +98,7 @@ void WorldSession::HandleCalendarGetCalendar(WorldPacket& /*recvData*/)
|
||||
dataBuffer << uint32(save->GetMapId());
|
||||
dataBuffer << uint32(save->GetDifficulty());
|
||||
dataBuffer << uint32(resetTime >= currTime ? resetTime - currTime : 0);
|
||||
dataBuffer << uint64(MAKE_NEW_GUID(save->GetInstanceId(), 0, HIGHGUID_INSTANCE)); // instance save id as unique instance copy id
|
||||
dataBuffer << ObjectGuid::Create<HighGuid::Instance>(save->GetInstanceId()); // instance save id as unique instance copy id
|
||||
++boundCounter;
|
||||
}
|
||||
}
|
||||
@@ -171,8 +171,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData)
|
||||
uint64 eventId;
|
||||
recvData >> eventId;
|
||||
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player ["
|
||||
UI64FMTD "] Event [" UI64FMTD "]", _player->GetGUID(), eventId);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GET_EVENT. Player [%s] Event [" UI64FMTD "]", _player->GetGUID().ToString().c_str(), eventId);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
sCalendarMgr->SendCalendarEvent(_player->GetGUID(), *calendarEvent, CALENDAR_SENDTYPE_GET);
|
||||
@@ -182,7 +181,7 @@ void WorldSession::HandleCalendarGetEvent(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData)
|
||||
{
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [" UI64FMTD "]", _player->GetGUID());
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GUILD_FILTER [%s]", _player->GetGUID().ToString().c_str());
|
||||
|
||||
uint32 minLevel;
|
||||
uint32 maxLevel;
|
||||
@@ -198,7 +197,7 @@ void WorldSession::HandleCalendarGuildFilter(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData)
|
||||
{
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [" UI64FMTD "]", _player->GetGUID());
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_ARENA_TEAM [%s]", _player->GetGUID().ToString().c_str());
|
||||
|
||||
uint32 arenaTeamId;
|
||||
recvData >> arenaTeamId;
|
||||
@@ -207,11 +206,12 @@ void WorldSession::HandleCalendarArenaTeam(WorldPacket& recvData)
|
||||
team->MassInviteToEvent(this);
|
||||
}
|
||||
|
||||
bool validUtf8String(WorldPacket& recvData, std::string& s, std::string action, uint64 playerGUID)
|
||||
bool validUtf8String(WorldPacket& recvData, std::string& s, std::string action, ObjectGuid playerGUID)
|
||||
{
|
||||
if (!utf8::is_valid(s.begin(), s.end()))
|
||||
{
|
||||
LOG_INFO("server", "CalendarHandler: Player with guid %llu attempt to %s an event with invalid name or description (packet modification)", (unsigned long long)playerGUID, action.c_str());
|
||||
LOG_INFO("server", "CalendarHandler: Player (%s) attempt to %s an event with invalid name or description (packet modification)",
|
||||
playerGUID.ToString().c_str(), action.c_str());
|
||||
recvData.rfinish();
|
||||
return false;
|
||||
}
|
||||
@@ -220,7 +220,7 @@ bool validUtf8String(WorldPacket& recvData, std::string& s, std::string action,
|
||||
|
||||
void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
|
||||
std::string title;
|
||||
std::string description;
|
||||
@@ -293,23 +293,22 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
|
||||
time_t(eventPackedTime), flags, time_t(unkPackedTime), title, description);
|
||||
|
||||
if (calendarEvent->IsGuildEvent() || calendarEvent->IsGuildAnnouncement())
|
||||
if (Player* creator = ObjectAccessor::FindPlayerInOrOutOfWorld(guid))
|
||||
if (Player* creator = ObjectAccessor::FindConnectedPlayer(guid))
|
||||
calendarEvent->SetGuildId(creator->GetGuildId());
|
||||
|
||||
if (calendarEvent->IsGuildAnnouncement())
|
||||
{
|
||||
// 946684800 is 01/01/2000 00:00:00 - default response time
|
||||
CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), 0, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
|
||||
CalendarInvite* invite = new CalendarInvite(0, calendarEvent->GetEventId(), ObjectGuid::Empty, guid, 946684800, CALENDAR_STATUS_NOT_SIGNED_UP, CALENDAR_RANK_PLAYER, "");
|
||||
sCalendarMgr->AddInvite(calendarEvent, invite);
|
||||
}
|
||||
else
|
||||
{
|
||||
uint32 inviteCount;
|
||||
uint64 invitee[CALENDAR_MAX_INVITES];
|
||||
ObjectGuid invitee[CALENDAR_MAX_INVITES];
|
||||
uint8 status[CALENDAR_MAX_INVITES];
|
||||
uint8 rank[CALENDAR_MAX_INVITES];
|
||||
|
||||
memset(invitee, 0, sizeof(invitee));
|
||||
memset(status, 0, sizeof(status));
|
||||
memset(rank, 0, sizeof(rank));
|
||||
|
||||
@@ -319,7 +318,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
|
||||
|
||||
for (uint32 i = 0; i < inviteCount && i < CALENDAR_MAX_INVITES; ++i)
|
||||
{
|
||||
recvData.readPackGUID(invitee[i]);
|
||||
recvData >> invitee[i].ReadAsPacked();
|
||||
recvData >> status[i] >> rank[i];
|
||||
}
|
||||
}
|
||||
@@ -350,7 +349,7 @@ void WorldSession::HandleCalendarAddEvent(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
time_t oldEventTime;
|
||||
|
||||
uint64 eventId;
|
||||
@@ -382,10 +381,10 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [" UI64FMTD "] EventId [" UI64FMTD
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_UPDATE_EVENT [%s] EventId [" UI64FMTD
|
||||
"], InviteId [" UI64FMTD "] Title %s, Description %s, type %u "
|
||||
"Repeatable %u, MaxInvites %u, Dungeon ID %d, Time %u "
|
||||
"Time2 %u, Flags %u", guid, eventId, inviteId, title.c_str(),
|
||||
"Time2 %u, Flags %u", guid.ToString().c_str(), eventId, inviteId, title.c_str(),
|
||||
description.c_str(), type, repetitionType, maxInvites, dungeonId,
|
||||
eventPackedTime, timeZoneTime, flags);
|
||||
|
||||
@@ -410,7 +409,7 @@ void WorldSession::HandleCalendarUpdateEvent(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
uint64 eventId;
|
||||
|
||||
recvData >> eventId;
|
||||
@@ -421,15 +420,15 @@ void WorldSession::HandleCalendarRemoveEvent(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarCopyEvent(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
uint64 eventId;
|
||||
uint64 inviteId;
|
||||
uint32 eventTime;
|
||||
|
||||
recvData >> eventId >> inviteId;
|
||||
recvData.ReadPackedTime(eventTime);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [" UI64FMTD "], EventId [" UI64FMTD
|
||||
"] inviteId [" UI64FMTD "] Time: %u", guid, eventId, inviteId, eventTime);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_COPY_EVENT [%s], EventId [" UI64FMTD
|
||||
"] inviteId [" UI64FMTD "] Time: %u", guid.ToString().c_str(), eventId, inviteId, eventTime);
|
||||
|
||||
// prevent events in the past
|
||||
// To Do: properly handle timezones and remove the "- time_t(86400L)" hack
|
||||
@@ -509,7 +508,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
|
||||
{
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_INVITE");
|
||||
|
||||
uint64 playerGuid = _player->GetGUID();
|
||||
ObjectGuid playerGuid = _player->GetGUID();
|
||||
|
||||
uint64 eventId;
|
||||
uint64 inviteId;
|
||||
@@ -517,7 +516,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
|
||||
bool isPreInvite;
|
||||
bool isGuildEvent;
|
||||
|
||||
uint64 inviteeGuid = 0;
|
||||
ObjectGuid inviteeGuid;
|
||||
uint32 inviteeTeamId = TEAM_NEUTRAL;
|
||||
uint32 inviteeGuildId = 0;
|
||||
|
||||
@@ -533,11 +532,11 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
|
||||
else
|
||||
{
|
||||
// xinef: Get Data From global storage
|
||||
if (uint32 guidLow = sWorld->GetGlobalPlayerGUID(name))
|
||||
if (ObjectGuid guid = sWorld->GetGlobalPlayerGUID(name))
|
||||
{
|
||||
if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow))
|
||||
if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid.GetCounter()))
|
||||
{
|
||||
inviteeGuid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
||||
inviteeGuid = guid;
|
||||
inviteeTeamId = Player::TeamIdForRace(playerData->race);
|
||||
inviteeGuildId = playerData->guildId;
|
||||
}
|
||||
@@ -557,7 +556,7 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// xinef: zomg! sync query
|
||||
if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = " UI64FMTD " AND friend = " UI64FMTD, inviteeGuid, playerGuid))
|
||||
if (QueryResult result = CharacterDatabase.PQuery("SELECT flags FROM character_social WHERE guid = %u AND friend = %u", inviteeGuid.GetCounter(), playerGuid.GetCounter()))
|
||||
{
|
||||
Field* fields = result->Fetch();
|
||||
if (fields[0].GetUInt8() & SOCIAL_FLAG_IGNORED)
|
||||
@@ -601,12 +600,12 @@ void WorldSession::HandleCalendarEventInvite(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
uint64 eventId;
|
||||
bool tentative;
|
||||
|
||||
recvData >> eventId >> tentative;
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [" UI64FMTD "] EventId [" UI64FMTD "] Tentative %u", guid, eventId, tentative);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_SIGNUP [%s] EventId [" UI64FMTD "] Tentative %u", guid.ToString().c_str(), eventId, tentative);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
{
|
||||
@@ -627,14 +626,14 @@ void WorldSession::HandleCalendarEventSignup(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
uint64 eventId;
|
||||
uint64 inviteId;
|
||||
uint32 status;
|
||||
|
||||
recvData >> eventId >> inviteId >> status;
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [" UI64FMTD"] EventId ["
|
||||
UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid, eventId,
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_RSVP [%s] EventId ["
|
||||
UI64FMTD "], InviteId [" UI64FMTD "], status %u", guid.ToString().c_str(), eventId,
|
||||
inviteId, status);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
@@ -664,19 +663,17 @@ void WorldSession::HandleCalendarEventRsvp(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
uint64 invitee;
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
ObjectGuid invitee;
|
||||
uint64 eventId;
|
||||
uint64 ownerInviteId; // isn't it sender's inviteId?
|
||||
uint64 inviteId;
|
||||
|
||||
recvData.readPackGUID(invitee);
|
||||
recvData>> invitee.ReadAsPacked();
|
||||
recvData >> inviteId >> ownerInviteId >> eventId;
|
||||
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE ["
|
||||
UI64FMTD "] EventId [" UI64FMTD "], ownerInviteId ["
|
||||
UI64FMTD "], Invitee ([" UI64FMTD "] id: [" UI64FMTD "])",
|
||||
guid, eventId, ownerInviteId, invitee, inviteId);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_REMOVE_INVITE [%s] EventId [" UI64FMTD "], ownerInviteId [" UI64FMTD "], Invitee ([%s] id: [" UI64FMTD "])",
|
||||
guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
{
|
||||
@@ -694,18 +691,17 @@ void WorldSession::HandleCalendarEventRemoveInvite(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
uint64 invitee;
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
ObjectGuid invitee;
|
||||
uint64 eventId;
|
||||
uint64 inviteId;
|
||||
uint64 ownerInviteId; // isn't it sender's inviteId?
|
||||
uint8 status;
|
||||
|
||||
recvData.readPackGUID(invitee);
|
||||
recvData >> invitee.ReadAsPacked();
|
||||
recvData >> eventId >> inviteId >> ownerInviteId >> status;
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [" UI64FMTD"] EventId ["
|
||||
UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
|
||||
UI64FMTD "], status %u", guid, eventId, ownerInviteId, invitee, inviteId, status);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_STATUS [%s] EventId [" UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee (%s) id: [" UI64FMTD "], status %u",
|
||||
guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, status);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
{
|
||||
@@ -728,18 +724,18 @@ void WorldSession::HandleCalendarEventStatus(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
uint64 invitee;
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
ObjectGuid invitee;
|
||||
uint64 eventId;
|
||||
uint64 inviteId;
|
||||
uint64 ownerInviteId; // isn't it sender's inviteId?
|
||||
uint8 rank;
|
||||
|
||||
recvData.readPackGUID(invitee);
|
||||
recvData>> invitee.ReadAsPacked();
|
||||
recvData >> eventId >> inviteId >> ownerInviteId >> rank;
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [" UI64FMTD "] EventId ["
|
||||
UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([" UI64FMTD "] id: ["
|
||||
UI64FMTD "], rank %u", guid, eventId, ownerInviteId, invitee, inviteId, rank);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_EVENT_MODERATOR_STATUS [%s] EventId ["
|
||||
UI64FMTD "] ownerInviteId [" UI64FMTD "], Invitee ([%s] id: ["
|
||||
UI64FMTD "], rank %u", guid.ToString().c_str(), eventId, ownerInviteId, invitee.ToString().c_str(), inviteId, rank);
|
||||
|
||||
if (CalendarEvent* calendarEvent = sCalendarMgr->GetEvent(eventId))
|
||||
{
|
||||
@@ -758,24 +754,23 @@ void WorldSession::HandleCalendarEventModeratorStatus(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCalendarComplain(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
uint64 eventId;
|
||||
uint64 complainGUID;
|
||||
ObjectGuid complainGUID;
|
||||
|
||||
recvData >> eventId >> complainGUID;
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [" UI64FMTD "] EventId ["
|
||||
UI64FMTD "] guid [" UI64FMTD "]", guid, eventId, complainGUID);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_COMPLAIN [%s] EventId ["
|
||||
UI64FMTD "] guid [%s]", guid.ToString().c_str(), eventId, complainGUID.ToString().c_str());
|
||||
|
||||
// what to do with complains?
|
||||
}
|
||||
|
||||
void WorldSession::HandleCalendarGetNumPending(WorldPacket& /*recvData*/)
|
||||
{
|
||||
uint64 guid = _player->GetGUID();
|
||||
ObjectGuid guid = _player->GetGUID();
|
||||
uint32 pending = sCalendarMgr->GetPlayerNumPending(guid);
|
||||
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [" UI64FMTD
|
||||
"] Pending: %u", guid, pending);
|
||||
LOG_DEBUG("network", "CMSG_CALENDAR_GET_NUM_PENDING: [%s] Pending: %u", guid.ToString().c_str(), pending);
|
||||
|
||||
WorldPacket data(SMSG_CALENDAR_SEND_NUM_PENDING, 4);
|
||||
data << uint32(pending);
|
||||
@@ -792,7 +787,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData)
|
||||
if (!entry || !entry->IsRaid())
|
||||
return;
|
||||
|
||||
InstancePlayerBind* instanceBind = sInstanceSaveMgr->PlayerGetBoundInstance(GetPlayer()->GetGUIDLow(), mapId, Difficulty(difficulty));
|
||||
InstancePlayerBind* instanceBind = sInstanceSaveMgr->PlayerGetBoundInstance(GetPlayer()->GetGUID(), mapId, Difficulty(difficulty));
|
||||
if (!instanceBind || !instanceBind->perm || (bool)toggleExtendOn == instanceBind->extended)
|
||||
return;
|
||||
|
||||
@@ -801,7 +796,7 @@ void WorldSession::HandleSetSavedInstanceExtend(WorldPacket& recvData)
|
||||
// update in db
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INSTANCE_EXTENDED);
|
||||
stmt->setUInt8(0, toggleExtendOn ? 1 : 0);
|
||||
stmt->setUInt32(1, GetPlayer()->GetGUIDLow());
|
||||
stmt->setUInt32(1, GetPlayer()->GetGUID().GetCounter());
|
||||
stmt->setUInt32(2, instanceBind->save->GetInstanceId());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
@@ -825,7 +820,7 @@ void WorldSession::SendCalendarRaidLockout(InstanceSave const* save, bool add)
|
||||
data << uint32(save->GetMapId());
|
||||
data << uint32(save->GetDifficulty());
|
||||
data << uint32(save->GetResetTime() >= currTime ? save->GetResetTime() - currTime : 0);
|
||||
data << uint64(MAKE_NEW_GUID(save->GetInstanceId(), 0, HIGHGUID_INSTANCE));
|
||||
data << ObjectGuid::Create<HighGuid::Instance>(save->GetInstanceId());
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
|
||||
@@ -48,11 +48,11 @@ class LoginQueryHolder : public SQLQueryHolder
|
||||
{
|
||||
private:
|
||||
uint32 m_accountId;
|
||||
uint64 m_guid;
|
||||
ObjectGuid m_guid;
|
||||
public:
|
||||
LoginQueryHolder(uint32 accountId, uint64 guid)
|
||||
LoginQueryHolder(uint32 accountId, ObjectGuid guid)
|
||||
: m_accountId(accountId), m_guid(guid) { }
|
||||
uint64 GetGuid() const { return m_guid; }
|
||||
ObjectGuid GetGuid() const { return m_guid; }
|
||||
uint32 GetAccountId() const { return m_accountId; }
|
||||
bool Initialize();
|
||||
};
|
||||
@@ -62,7 +62,7 @@ bool LoginQueryHolder::Initialize()
|
||||
SetSize(MAX_PLAYER_LOGIN_QUERY);
|
||||
|
||||
bool res = true;
|
||||
uint32 lowGuid = GUID_LOPART(m_guid);
|
||||
ObjectGuid::LowType lowGuid = m_guid.GetCounter();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER);
|
||||
stmt->setUInt32(0, lowGuid);
|
||||
@@ -193,6 +193,10 @@ bool LoginQueryHolder::Initialize()
|
||||
stmt->setUInt32(0, m_accountId);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_INSTANCE_LOCK_TIMES, stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CORPSE_LOCATION);
|
||||
stmt->setUInt64(0, lowGuid);
|
||||
res &= SetPreparedQuery(PLAYER_LOGIN_QUERY_LOAD_CORPSE_LOCATION, stmt);
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -209,13 +213,13 @@ void WorldSession::HandleCharEnum(PreparedQueryResult result)
|
||||
{
|
||||
do
|
||||
{
|
||||
uint32 guidlow = (*result)[0].GetUInt32();
|
||||
ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>((*result)[0].GetUInt32());
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Loading char guid %u from account %u.", guidlow, GetAccountId());
|
||||
LOG_DEBUG("server", "Loading char %s from account %u.", guid.ToString().c_str(), GetAccountId());
|
||||
#endif
|
||||
if (Player::BuildEnumData(result, &data))
|
||||
{
|
||||
_legitCharacters.insert(guidlow);
|
||||
_legitCharacters.insert(guid);
|
||||
++num;
|
||||
}
|
||||
} while (result->NextRow());
|
||||
@@ -617,7 +621,7 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
|
||||
Player newChar(this);
|
||||
newChar.GetMotionMaster()->Initialize();
|
||||
if (!newChar.Create(sObjectMgr->GenerateLowGuid(HIGHGUID_PLAYER), createInfo))
|
||||
if (!newChar.Create(sObjectMgr->GetGenerator<HighGuid::Player>().Generate(), createInfo))
|
||||
{
|
||||
// Player not create (race/class/etc problem?)
|
||||
newChar.CleanupsBeforeDelete();
|
||||
@@ -660,11 +664,11 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
|
||||
LOG_DEBUG("server", "Account: %d (IP: %s) Create Character:[%s] (%s)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUID().ToString().c_str());
|
||||
#endif
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s) Create Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUIDLow());
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s) Create Character:[%s] (%s)", GetAccountId(), IP_str.c_str(), createInfo->Name.c_str(), newChar.GetGUID().ToString().c_str());
|
||||
sScriptMgr->OnPlayerCreate(&newChar);
|
||||
sWorld->AddGlobalPlayerData(newChar.GetGUIDLow(), GetAccountId(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel(), 0, 0);
|
||||
sWorld->AddGlobalPlayerData(newChar.GetGUID().GetCounter(), GetAccountId(), newChar.GetName(), newChar.getGender(), newChar.getRace(), newChar.getClass(), newChar.getLevel(), 0, 0);
|
||||
|
||||
newChar.CleanupsBeforeDelete();
|
||||
delete createInfo;
|
||||
@@ -676,13 +680,14 @@ void WorldSession::HandleCharCreateCallback(PreparedQueryResult result, Characte
|
||||
|
||||
void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
// Initiating
|
||||
uint32 initAccountId = GetAccountId();
|
||||
|
||||
// can't delete loaded character
|
||||
if (ObjectAccessor::FindPlayerInOrOutOfWorld(guid) || sWorld->FindOfflineSessionForCharacterGUID(GUID_LOPART(guid)))
|
||||
if (ObjectAccessor::FindConnectedPlayer(guid) || sWorld->FindOfflineSessionForCharacterGUID(guid.GetCounter()))
|
||||
{
|
||||
sScriptMgr->OnPlayerFailedDelete(guid, initAccountId);
|
||||
WorldPacket data(SMSG_CHAR_DELETE, 1);
|
||||
@@ -714,7 +719,7 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid)))
|
||||
if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid.GetCounter()))
|
||||
{
|
||||
accountId = playerData->accountId;
|
||||
name = playerData->name;
|
||||
@@ -729,9 +734,9 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
|
||||
LOG_DEBUG("server", "Account: %d (IP: %s) Delete Character:[%s] (%s)", GetAccountId(), IP_str.c_str(), name.c_str(), guid.ToString().c_str());
|
||||
#endif
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s) Delete Character:[%s] (GUID: %u)", GetAccountId(), IP_str.c_str(), name.c_str(), GUID_LOPART(guid));
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s) Delete Character:[%s] (%s)", GetAccountId(), IP_str.c_str(), name.c_str(), guid.ToString().c_str());
|
||||
|
||||
// To prevent hook failure, place hook before removing reference from DB
|
||||
sScriptMgr->OnPlayerDelete(guid, initAccountId); // To prevent race conditioning, but as it also makes sense, we hand the accountId over for successful delete.
|
||||
@@ -740,15 +745,14 @@ void WorldSession::HandleCharDeleteOpcode(WorldPacket& recvData)
|
||||
if (sLog->ShouldLog("entities.player.dump", LogLevel::LOG_LEVEL_INFO)) // optimize GetPlayerDump call
|
||||
{
|
||||
std::string dump;
|
||||
|
||||
if (PlayerDumpWriter().GetDump(GUID_LOPART(guid), dump))\
|
||||
LOG_CHAR_DUMP(dump.c_str(), GetAccountId(), GUID_LOPART(guid), name.c_str());
|
||||
if (PlayerDumpWriter().GetDump(guid.GetCounter(), dump))
|
||||
LOG_CHAR_DUMP(dump.c_str(), GetAccountId(), guid.GetCounter(), name.c_str());
|
||||
}
|
||||
|
||||
sCalendarMgr->RemoveAllPlayerEventsAndInvites(guid);
|
||||
Player::DeleteFromDB(guid, GetAccountId(), true, false);
|
||||
Player::DeleteFromDB(guid.GetCounter(), GetAccountId(), true, false);
|
||||
|
||||
sWorld->DeleteGlobalPlayerData(GUID_LOPART(guid), name);
|
||||
sWorld->DeleteGlobalPlayerData(guid.GetCounter(), name);
|
||||
WorldPacket data(SMSG_CHAR_DELETE, 1);
|
||||
data << (uint8)CHAR_DELETE_SUCCESS;
|
||||
SendPacket(&data);
|
||||
@@ -763,18 +767,18 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 playerGuid = 0;
|
||||
ObjectGuid playerGuid;
|
||||
recvData >> playerGuid;
|
||||
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(playerGuid)))
|
||||
if (!playerGuid.IsPlayer() || !IsLegitCharacterForAccount(playerGuid))
|
||||
{
|
||||
LOG_ERROR("server", "Account (%u) can't login with that character (%u).", GetAccountId(), GUID_LOPART(playerGuid));
|
||||
LOG_ERROR("server", "Account (%u) can't login with that character (%s).", GetAccountId(), playerGuid.ToString().c_str());
|
||||
KickPlayer("Account can't login with this character");
|
||||
return;
|
||||
}
|
||||
|
||||
// pussywizard:
|
||||
if (WorldSession* sess = sWorld->FindOfflineSessionForCharacterGUID(GUID_LOPART(playerGuid)))
|
||||
if (WorldSession* sess = sWorld->FindOfflineSessionForCharacterGUID(playerGuid.GetCounter()))
|
||||
if (sess->GetAccountId() != GetAccountId())
|
||||
{
|
||||
WorldPacket data(SMSG_CHARACTER_LOGIN_FAILED, 1);
|
||||
@@ -835,7 +839,7 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
|
||||
if (!plMover)
|
||||
break;
|
||||
WorldPacket pkt(MSG_MOVE_TELEPORT_ACK, 20);
|
||||
pkt.append(plMover->GetPackGUID());
|
||||
pkt << plMover->GetPackGUID();
|
||||
pkt << uint32(0); // flags
|
||||
pkt << uint32(0); // time
|
||||
sess->HandleMoveTeleportAck(pkt);
|
||||
@@ -874,14 +878,14 @@ void WorldSession::HandlePlayerLoginOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
{
|
||||
uint64 playerGuid = holder->GetGuid();
|
||||
ObjectGuid playerGuid = holder->GetGuid();
|
||||
|
||||
Player* pCurrChar = new Player(this);
|
||||
// for send server info and strings (config)
|
||||
ChatHandler chH = ChatHandler(this);
|
||||
|
||||
// "GetAccountId() == db stored account id" checked in LoadFromDB (prevent login not own character using cheating tools)
|
||||
if (!pCurrChar->LoadFromDB(GUID_LOPART(playerGuid), holder))
|
||||
if (!pCurrChar->LoadFromDB(playerGuid, holder))
|
||||
{
|
||||
SetPlayer(nullptr);
|
||||
KickPlayer("HandlePlayerLoginFromDB"); // disconnect client, player no set to session and it will not deleted or saved at kick
|
||||
@@ -924,7 +928,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
#endif
|
||||
}
|
||||
|
||||
if (uint32 guildId = Player::GetGuildIdFromStorage(pCurrChar->GetGUIDLow()))
|
||||
if (uint32 guildId = Player::GetGuildIdFromStorage(pCurrChar->GetGUID().GetCounter()))
|
||||
{
|
||||
Guild* guild = sGuildMgr->GetGuildById(guildId);
|
||||
Guild::Member const* member = guild ? guild->GetMember(pCurrChar->GetGUID()) : nullptr;
|
||||
@@ -936,7 +940,8 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG_ERROR("server", "Player %s (GUID: %u) marked as member of not existing guild (id: %u), removing guild membership for player.", pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), guildId);
|
||||
LOG_ERROR("server", "Player %s (%s) marked as member of not existing guild (id: %u), removing guild membership for player.",
|
||||
pCurrChar->GetName().c_str(), pCurrChar->GetGUID().ToString().c_str(), guildId);
|
||||
pCurrChar->SetInGuild(0);
|
||||
pCurrChar->SetRank(0);
|
||||
}
|
||||
@@ -973,7 +978,7 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
}
|
||||
|
||||
// Xinef: moved this from below
|
||||
sObjectAccessor->AddObject(pCurrChar);
|
||||
ObjectAccessor::AddObject(pCurrChar);
|
||||
|
||||
if (!pCurrChar->GetMap()->AddPlayerToMap(pCurrChar) || !pCurrChar->CheckInstanceLoginValid())
|
||||
{
|
||||
@@ -984,15 +989,10 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
pCurrChar->TeleportTo(pCurrChar->m_homebindMapId, pCurrChar->m_homebindX, pCurrChar->m_homebindY, pCurrChar->m_homebindZ, pCurrChar->GetOrientation());
|
||||
}
|
||||
|
||||
// pussywizard: optimization
|
||||
std::string charName = pCurrChar->GetName();
|
||||
std::transform(charName.begin(), charName.end(), charName.begin(), ::tolower);
|
||||
sObjectAccessor->playerNameToPlayerPointer[charName] = pCurrChar;
|
||||
|
||||
pCurrChar->SendInitialPacketsAfterAddToMap();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_ONLINE);
|
||||
stmt->setUInt32(0, pCurrChar->GetGUIDLow());
|
||||
stmt->setUInt32(0, pCurrChar->GetGUID().GetCounter());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
stmt = LoginDatabase.GetPreparedStatement(LOGIN_UPD_ACCOUNT_ONLINE);
|
||||
@@ -1030,10 +1030,10 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
}
|
||||
|
||||
// friend status
|
||||
sSocialMgr->SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetGUIDLow(), true);
|
||||
sSocialMgr->SendFriendStatus(pCurrChar, FRIEND_ONLINE, pCurrChar->GetGUID(), true);
|
||||
|
||||
// Place character in world (and load zone) before some object loading
|
||||
pCurrChar->LoadCorpse();
|
||||
pCurrChar->LoadCorpse(holder->GetPreparedResult(PLAYER_LOGIN_QUERY_LOAD_CORPSE_LOCATION));
|
||||
|
||||
// setting Ghost+speed if dead
|
||||
if (pCurrChar->m_deathState != ALIVE)
|
||||
@@ -1128,8 +1128,8 @@ void WorldSession::HandlePlayerLoginFromDB(LoginQueryHolder* holder)
|
||||
SendNotification(LANG_GM_ON);
|
||||
|
||||
std::string IP_str = GetRemoteAddress();
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s) Login Character:[%s] (GUID: %u) Level: %d",
|
||||
GetAccountId(), IP_str.c_str(), pCurrChar->GetName().c_str(), pCurrChar->GetGUIDLow(), pCurrChar->getLevel());
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s) Login Character:[%s] (%s) Level: %d",
|
||||
GetAccountId(), IP_str.c_str(), pCurrChar->GetName().c_str(), pCurrChar->GetGUID().ToString().c_str(), pCurrChar->getLevel());
|
||||
|
||||
if (!pCurrChar->IsStandState() && !pCurrChar->HasUnitState(UNIT_STATE_STUNNED))
|
||||
pCurrChar->SetStandState(UNIT_STAND_STATE_STAND);
|
||||
@@ -1423,7 +1423,7 @@ void WorldSession::HandleShowingCloakOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::string newName;
|
||||
|
||||
recvData >> guid;
|
||||
@@ -1443,7 +1443,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1 + 8 + (newName.size() + 1));
|
||||
data << uint8(res);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
data << newName;
|
||||
SendPacket(&data);
|
||||
return;
|
||||
@@ -1464,7 +1464,7 @@ void WorldSession::HandleCharRenameOpcode(WorldPacket& recvData)
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_FREE_NAME);
|
||||
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
stmt->setUInt32(1, GetAccountId());
|
||||
stmt->setUInt16(2, AT_LOGIN_RENAME);
|
||||
stmt->setUInt16(3, AT_LOGIN_RENAME);
|
||||
@@ -1485,13 +1485,13 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
|
||||
|
||||
Field* fields = result->Fetch();
|
||||
|
||||
uint32 guidLow = fields[0].GetUInt32();
|
||||
ObjectGuid::LowType guidLow = fields[0].GetUInt32();
|
||||
std::string oldName = fields[1].GetString();
|
||||
|
||||
uint64 guid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
||||
ObjectGuid guid = ObjectGuid::Create<HighGuid::Player>(guidLow);
|
||||
|
||||
// pussywizard:
|
||||
if (ObjectAccessor::FindPlayerInOrOutOfWorld(guid) || sWorld->FindOfflineSessionForCharacterGUID(guidLow))
|
||||
if (ObjectAccessor::FindConnectedPlayer(guid) || sWorld->FindOfflineSessionForCharacterGUID(guidLow))
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1);
|
||||
data << uint8(CHAR_CREATE_ERROR);
|
||||
@@ -1522,7 +1522,7 @@ void WorldSession::HandleChangePlayerNameOpcodeCallBack(PreparedQueryResult resu
|
||||
|
||||
WorldPacket data(SMSG_CHAR_RENAME, 1 + 8 + (newName.size() + 1));
|
||||
data << uint8(RESPONSE_SUCCESS);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
data << newName;
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -1537,17 +1537,17 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
if (!sWorld->getBoolConfig(CONFIG_DECLINED_NAMES_USED))
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid;
|
||||
|
||||
// not accept declined names for unsupported languages
|
||||
std::string name;
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(guid, name))
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(guid.GetCounter(), name))
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
@@ -1557,7 +1557,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
@@ -1566,7 +1566,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
@@ -1580,7 +1580,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
@@ -1592,7 +1592,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
@@ -1602,7 +1602,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
{
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(1);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
@@ -1613,11 +1613,11 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_DECLINED_NAME);
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_DECLINED_NAME);
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
|
||||
for (uint8 i = 0; i < 5; i++)
|
||||
stmt->setString(i + 1, declinedname.name[i]);
|
||||
@@ -1628,7 +1628,7 @@ void WorldSession::HandleSetPlayerDeclinedNames(WorldPacket& recvData)
|
||||
|
||||
WorldPacket data(SMSG_SET_PLAYER_DECLINED_NAMES_RESULT, 4 + 8);
|
||||
data << uint32(0); // OK
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -1732,21 +1732,21 @@ void WorldSession::HandleRemoveGlyph(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::string newName;
|
||||
|
||||
recvData >> guid;
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
|
||||
if (!IsLegitCharacterForAccount(guid))
|
||||
{
|
||||
LOG_ERROR("server", "Account %u, IP: %s tried to customise character %u, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Account %u, IP: %s tried to customise character %s, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), guid.ToString().c_str());
|
||||
recvData.rfinish();
|
||||
KickPlayer("HandleCharCustomize");
|
||||
return;
|
||||
}
|
||||
|
||||
// pussywizard:
|
||||
if (ObjectAccessor::FindPlayerInOrOutOfWorld(guid) || sWorld->FindOfflineSessionForCharacterGUID(GUID_LOPART(guid)))
|
||||
if (ObjectAccessor::FindConnectedPlayer(guid) || sWorld->FindOfflineSessionForCharacterGUID(guid.GetCounter()))
|
||||
{
|
||||
recvData.rfinish();
|
||||
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1);
|
||||
@@ -1763,7 +1763,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
// xinef: zomg! sync query
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_AT_LOGIN);
|
||||
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
|
||||
PreparedQueryResult result = CharacterDatabase.Query(stmt);
|
||||
|
||||
@@ -1776,7 +1776,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// get the players old (at this moment current) race
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid));
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid.GetCounter());
|
||||
if (!playerData)
|
||||
{
|
||||
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1);
|
||||
@@ -1824,7 +1824,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// character with this name already exist
|
||||
if (uint64 newguid = sObjectMgr->GetPlayerGUIDByName(newName))
|
||||
if (ObjectGuid newguid = sObjectMgr->GetPlayerGUIDByName(newName))
|
||||
{
|
||||
if (newguid != guid)
|
||||
{
|
||||
@@ -1835,7 +1835,8 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s), Character [%s] (guid: %u) Customized to: %s", GetAccountId(), GetRemoteAddress().c_str(), playerData->name.c_str(), GUID_LOPART(guid), newName.c_str());
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s), Character [%s] (%s) Customized to: %s",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), playerData->name.c_str(), guid.ToString().c_str(), newName.c_str());
|
||||
|
||||
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
|
||||
|
||||
@@ -1843,7 +1844,7 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
|
||||
stmt->setString(0, newName);
|
||||
stmt->setUInt16(1, uint16(AT_LOGIN_CUSTOMIZE));
|
||||
stmt->setUInt32(2, GUID_LOPART(guid));
|
||||
stmt->setUInt32(2, guid.GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
@@ -1851,18 +1852,18 @@ void WorldSession::HandleCharCustomize(WorldPacket& recvData)
|
||||
{
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_DECLINED_NAME);
|
||||
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
}
|
||||
|
||||
// xinef: update global data
|
||||
sWorld->UpdateGlobalNameData(GUID_LOPART(guid), playerData->name, newName);
|
||||
sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid), PLAYER_UPDATE_DATA_NAME | PLAYER_UPDATE_DATA_GENDER, newName, 0, gender);
|
||||
sWorld->UpdateGlobalNameData(guid.GetCounter(), playerData->name, newName);
|
||||
sWorld->UpdateGlobalPlayerData(guid.GetCounter(), PLAYER_UPDATE_DATA_NAME | PLAYER_UPDATE_DATA_GENDER, newName, 0, gender);
|
||||
|
||||
WorldPacket data(SMSG_CHAR_CUSTOMIZE, 1 + 8 + (newName.size() + 1) + 6);
|
||||
data << uint8(RESPONSE_SUCCESS);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
data << newName;
|
||||
data << uint8(gender);
|
||||
data << uint8(skin);
|
||||
@@ -1902,18 +1903,18 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData)
|
||||
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
uint64 itemGuid;
|
||||
recvData.readPackGUID(itemGuid);
|
||||
ObjectGuid itemGuid;
|
||||
recvData >> itemGuid.ReadAsPacked();
|
||||
|
||||
// xinef: if client sends 0, it means empty slot
|
||||
if (itemGuid == 0)
|
||||
if (!itemGuid)
|
||||
{
|
||||
eqSet.Items[i] = 0;
|
||||
eqSet.Items[i].Clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
// equipment manager sends "1" (as raw GUID) for slots set to "ignore" (don't touch slot at equip set)
|
||||
if (itemGuid == 1)
|
||||
if (itemGuid.GetRawValue() == 1)
|
||||
{
|
||||
// ignored slots saved as bit mask because we have no free special values for Items[i]
|
||||
eqSet.IgnoreMask |= 1 << i;
|
||||
@@ -1924,11 +1925,11 @@ void WorldSession::HandleEquipmentSetSave(WorldPacket& recvData)
|
||||
Item* item = _player->GetItemByPos(INVENTORY_SLOT_BAG_0, i);
|
||||
if (!item || item->GetGUID() != itemGuid)
|
||||
{
|
||||
eqSet.Items[i] = 0;
|
||||
eqSet.Items[i].Clear();
|
||||
continue;
|
||||
}
|
||||
|
||||
eqSet.Items[i] = GUID_LOPART(itemGuid);
|
||||
eqSet.Items[i] = itemGuid;
|
||||
}
|
||||
|
||||
_player->SetEquipmentSet(index, eqSet);
|
||||
@@ -1954,18 +1955,18 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData)
|
||||
|
||||
for (uint32 i = 0; i < EQUIPMENT_SLOT_END; ++i)
|
||||
{
|
||||
uint64 itemGuid;
|
||||
recvData.readPackGUID(itemGuid);
|
||||
ObjectGuid itemGuid;
|
||||
recvData >> itemGuid.ReadAsPacked();
|
||||
|
||||
uint8 srcbag, srcslot;
|
||||
recvData >> srcbag >> srcslot;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("entities.player.items", "Item " UI64FMTD ": srcbag %u, srcslot %u", itemGuid, srcbag, srcslot);
|
||||
LOG_DEBUG("entities.player.items", "Item %s: srcbag %u, srcslot %u", itemGuid.ToString().c_str(), srcbag, srcslot);
|
||||
#endif
|
||||
|
||||
// check if item slot is set to "ignored" (raw value == 1), must not be unequipped then
|
||||
if (itemGuid == 1)
|
||||
if (itemGuid.GetRawValue() == 1)
|
||||
continue;
|
||||
|
||||
// Only equip weapons in combat
|
||||
@@ -1973,7 +1974,7 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData)
|
||||
continue;
|
||||
|
||||
Item* item = nullptr;
|
||||
if (itemGuid > 0)
|
||||
if (itemGuid)
|
||||
item = _player->GetItemByGuid(itemGuid);
|
||||
|
||||
uint16 dstpos = i | (INVENTORY_SLOT_BAG_0 << 8);
|
||||
@@ -2036,22 +2037,22 @@ void WorldSession::HandleEquipmentSetUse(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::string newname;
|
||||
uint8 gender, skin, face, hairStyle, hairColor, facialHair, race;
|
||||
recvData >> guid;
|
||||
|
||||
if (!IsLegitCharacterForAccount(GUID_LOPART(guid)))
|
||||
if (!IsLegitCharacterForAccount(guid))
|
||||
{
|
||||
LOG_ERROR("server", "Account %u, IP: %s tried to factionchange character %u, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Account %u, IP: %s tried to factionchange character %s, but it does not belong to their account!",
|
||||
GetAccountId(), GetRemoteAddress().c_str(), guid.ToString().c_str());
|
||||
recvData.rfinish();
|
||||
KickPlayer("HandleCharFactionOrRaceChange");
|
||||
return;
|
||||
}
|
||||
|
||||
// pussywizard:
|
||||
if (ObjectAccessor::FindPlayerInOrOutOfWorld(guid) || sWorld->FindOfflineSessionForCharacterGUID(GUID_LOPART(guid)))
|
||||
if (ObjectAccessor::FindConnectedPlayer(guid) || sWorld->FindOfflineSessionForCharacterGUID(guid.GetCounter()))
|
||||
{
|
||||
recvData.rfinish();
|
||||
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1);
|
||||
@@ -2063,7 +2064,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
recvData >> newname;
|
||||
recvData >> gender >> skin >> hairColor >> hairStyle >> facialHair >> face >> race;
|
||||
|
||||
uint32 lowGuid = GUID_LOPART(guid);
|
||||
ObjectGuid::LowType lowGuid = guid.GetCounter();
|
||||
|
||||
// get the players old (at this moment current) race
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(lowGuid);
|
||||
@@ -2115,7 +2116,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
for (; itr != _end; ++itr)
|
||||
{
|
||||
AuctionEntry* Aentry = itr->second;
|
||||
if (Aentry && (Aentry->owner == lowGuid || Aentry->bidder == lowGuid))
|
||||
if (Aentry && (Aentry->owner == guid || Aentry->bidder == guid))
|
||||
{
|
||||
has_auctions = true;
|
||||
break;
|
||||
@@ -2239,7 +2240,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// character with this name already exist
|
||||
if (uint64 newguid = sObjectMgr->GetPlayerGUIDByName(newname))
|
||||
if (ObjectGuid newguid = sObjectMgr->GetPlayerGUIDByName(newname))
|
||||
{
|
||||
if (newguid != guid)
|
||||
{
|
||||
@@ -2252,8 +2253,12 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
|
||||
CharacterDatabase.EscapeString(newname);
|
||||
Player::Customize(guid, gender, skin, face, hairStyle, hairColor, facialHair);
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
// resurrect the character in case he's dead
|
||||
Player::OfflineResurrect(guid, trans);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_FACTION_OR_RACE);
|
||||
stmt->setString(0, newname);
|
||||
stmt->setUInt8(1, race);
|
||||
@@ -2268,9 +2273,8 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
LOG_INFO("entities.player", "Account: %d (IP: %s), Character [%s] (guid: %u) Changed Race/Faction to: %s", GetAccountId(), GetRemoteAddress().c_str(), playerData->name.c_str(), lowGuid, newname.c_str());
|
||||
|
||||
// xinef: update global data
|
||||
sWorld->UpdateGlobalNameData(GUID_LOPART(guid), playerData->name, newname);
|
||||
sWorld->UpdateGlobalPlayerData(GUID_LOPART(guid),
|
||||
PLAYER_UPDATE_DATA_NAME | PLAYER_UPDATE_DATA_RACE | PLAYER_UPDATE_DATA_GENDER, newname, 0, gender, race);
|
||||
sWorld->UpdateGlobalNameData(lowGuid, playerData->name, newname);
|
||||
sWorld->UpdateGlobalPlayerData(lowGuid, PLAYER_UPDATE_DATA_NAME | PLAYER_UPDATE_DATA_RACE | PLAYER_UPDATE_DATA_GENDER, newname, 0, gender, race);
|
||||
|
||||
if (oldRace != race)
|
||||
{
|
||||
@@ -2404,7 +2408,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
{
|
||||
if (uint32 guildId = playerData->guildId)
|
||||
if (Guild* guild = sGuildMgr->GetGuildById(guildId))
|
||||
guild->DeleteMember(MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER), false, false, true);
|
||||
guild->DeleteMember(guid, false, false, true);
|
||||
}
|
||||
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND))
|
||||
@@ -2436,7 +2440,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
stmt->setFloat (3, -8867.68f);
|
||||
stmt->setFloat (4, 673.373f);
|
||||
stmt->setFloat (5, 97.9034f);
|
||||
Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, lowGuid);
|
||||
Player::SavePositionInDB(0, -8867.68f, 673.373f, 97.9034f, 0.0f, 1519, guid);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -2445,7 +2449,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
stmt->setFloat (3, 1633.33f);
|
||||
stmt->setFloat (4, -4439.11f);
|
||||
stmt->setFloat (5, 15.7588f);
|
||||
Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, lowGuid);
|
||||
Player::SavePositionInDB(1, 1633.33f, -4439.11f, 15.7588f, 0.0f, 1637, guid);
|
||||
}
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -2480,13 +2484,13 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_INVENTORY_FACTION_CHANGE);
|
||||
stmt->setUInt32(0, new_entry);
|
||||
stmt->setUInt32(1, old_entry);
|
||||
stmt->setUInt32(2, guid);
|
||||
stmt->setUInt32(2, guid.GetCounter());
|
||||
trans->Append(stmt);
|
||||
}
|
||||
|
||||
// Delete all current quests
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_CHAR_QUESTSTATUS);
|
||||
stmt->setUInt32(0, GUID_LOPART(guid));
|
||||
stmt->setUInt32(0, guid.GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
// Quest conversion
|
||||
@@ -2675,7 +2679,7 @@ void WorldSession::HandleCharFactionOrRaceChange(WorldPacket& recvData)
|
||||
|
||||
WorldPacket data(SMSG_CHAR_FACTION_CHANGE, 1 + 8 + (newname.size() + 1) + 1 + 1 + 1 + 1 + 1 + 1 + 1);
|
||||
data << uint8(RESPONSE_SUCCESS);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
data << newname;
|
||||
data << uint8(gender);
|
||||
data << uint8(skin);
|
||||
|
||||
@@ -152,8 +152,8 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
}
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("network", "Player %s (GUID: %u) sent a chatmessage with an invalid language/message type combination",
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||
LOG_ERROR("network", "Player %s (%s) sent a chatmessage with an invalid language/message type combination",
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
|
||||
recvData.rfinish();
|
||||
return;
|
||||
@@ -276,8 +276,8 @@ void WorldSession::HandleMessagechatOpcode(WorldPacket& recvData)
|
||||
{
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_SEVERITY) && !ChatHandler(this).isValidChatMessage(msg.c_str()))
|
||||
{
|
||||
//LOG_ERROR("server", "Player %s (GUID: %u) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName().c_str(),
|
||||
// GetPlayer()->GetGUIDLow(), msg.c_str());
|
||||
//LOG_ERROR("server", "Player %s (%s) sent a chatmessage with an invalid link: %s", GetPlayer()->GetName().c_str(),
|
||||
// GetPlayer()->GetGUID().ToString().c_str(), msg.c_str());
|
||||
|
||||
if (sWorld->getIntConfig(CONFIG_CHAT_STRICT_LINK_CHECKING_KICK))
|
||||
KickPlayer("CONFIG_CHAT_STRICT_LINK_CHECKING_KICK");
|
||||
@@ -686,7 +686,7 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
|
||||
uint32 text_emote, emoteNum;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> text_emote;
|
||||
recvData >> emoteNum;
|
||||
@@ -737,13 +737,13 @@ void WorldSession::HandleTextEmoteOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleChatIgnoredOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 iguid;
|
||||
ObjectGuid iguid;
|
||||
uint8 unk;
|
||||
|
||||
recvData >> iguid;
|
||||
recvData >> unk; // probably related to spam reporting
|
||||
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(iguid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(iguid);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@
|
||||
|
||||
void WorldSession::HandleAttackSwingOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING Message guidlow:%u guidhigh:%u", GUID_LOPART(guid), GUID_HIPART(guid));
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_ATTACKSWING: %s", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
Unit* pEnemy = ObjectAccessor::GetUnit(*_player, guid);
|
||||
@@ -80,8 +80,8 @@ void WorldSession::HandleSetSheathedOpcode(WorldPacket& recvData)
|
||||
void WorldSession::SendAttackStop(Unit const* enemy)
|
||||
{
|
||||
WorldPacket data(SMSG_ATTACKSTOP, (8 + 8 + 4)); // we guess size
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data.append(enemy ? enemy->GetPackGUID() : 0); // must be packed guid
|
||||
data << GetPlayer()->GetPackGUID();
|
||||
data << (enemy ? enemy->GetPackGUID() : PackedGuid()); // must be packed guid
|
||||
data << uint32(0); // unk, can be 1 also
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
|
||||
void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
Player* player;
|
||||
Player* plTarget;
|
||||
|
||||
@@ -30,8 +30,8 @@ void WorldSession::HandleDuelAcceptedOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player 1 is: %u (%s)", player->GetGUIDLow(), player->GetName().c_str());
|
||||
LOG_DEBUG("server", "Player 2 is: %u (%s)", plTarget->GetGUIDLow(), plTarget->GetName().c_str());
|
||||
LOG_DEBUG("server", "Player 1 is: %s (%s)", player->GetGUID().ToString().c_str(), player->GetName().c_str());
|
||||
LOG_DEBUG("server", "Player 2 is: %s (%s)", plTarget->GetGUID().ToString().c_str(), plTarget->GetName().c_str());
|
||||
#endif
|
||||
|
||||
time_t now = time(nullptr);
|
||||
@@ -47,7 +47,7 @@ void WorldSession::HandleDuelCancelledOpcode(WorldPacket& recvPacket)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_DUEL_CANCELLED");
|
||||
#endif
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvPacket >> guid;
|
||||
|
||||
// no duel requested
|
||||
|
||||
@@ -109,7 +109,7 @@ void WorldSession::HandleGroupInviteOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
||||
if (player->GetSocial()->HasIgnore(GetPlayer()->GetGUID()))
|
||||
{
|
||||
SendPartyResult(PARTY_OP_INVITE, membername, ERR_IGNORING_YOU_S);
|
||||
return;
|
||||
@@ -233,7 +233,8 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData)
|
||||
|
||||
if (group->GetLeaderGUID() == GetPlayer()->GetGUID())
|
||||
{
|
||||
LOG_ERROR("server", "HandleGroupAcceptOpcode: player %s(%d) tried to accept an invite to his own group", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||
LOG_ERROR("server", "HandleGroupAcceptOpcode: player %s (%s) tried to accept an invite to his own group",
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -244,7 +245,7 @@ void WorldSession::HandleGroupAcceptOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* leader = ObjectAccessor::FindPlayerInOrOutOfWorld(group->GetLeaderGUID());
|
||||
Player* leader = ObjectAccessor::FindConnectedPlayer(group->GetLeaderGUID());
|
||||
|
||||
// Forming a new group, create it
|
||||
if (!group->IsCreated())
|
||||
@@ -281,7 +282,7 @@ void WorldSession::HandleGroupDeclineOpcode(WorldPacket& /*recvData*/)
|
||||
return;
|
||||
|
||||
// Remember leader if online (group pointer will be invalid if group gets disbanded)
|
||||
Player* leader = ObjectAccessor::FindPlayerInOrOutOfWorld(group->GetLeaderGUID());
|
||||
Player* leader = ObjectAccessor::FindConnectedPlayer(group->GetLeaderGUID());
|
||||
|
||||
// uninvite, group can be deleted
|
||||
GetPlayer()->UninviteFromGroup();
|
||||
@@ -301,7 +302,7 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_UNINVITE_GUID");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::string reason, name;
|
||||
recvData >> guid;
|
||||
recvData >> reason;
|
||||
@@ -309,12 +310,13 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket& recvData)
|
||||
//can't uninvite yourself
|
||||
if (guid == GetPlayer()->GetGUID())
|
||||
{
|
||||
LOG_ERROR("server", "WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||
LOG_ERROR("server", "WorldSession::HandleGroupUninviteGuidOpcode: leader %s (%s) tried to uninvite himself from the group.",
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// Xinef: name is properly filled in packets
|
||||
sObjectMgr->GetPlayerNameByGUID(guid, name);
|
||||
sObjectMgr->GetPlayerNameByGUID(guid.GetCounter(), name);
|
||||
|
||||
PartyResult res = GetPlayer()->CanUninviteFromGroup();
|
||||
if (res != ERR_PARTY_RESULT_OK)
|
||||
@@ -371,7 +373,8 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData)
|
||||
// can't uninvite yourself
|
||||
if (GetPlayer()->GetName() == membername)
|
||||
{
|
||||
LOG_ERROR("server", "WorldSession::HandleGroupUninviteOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||
LOG_ERROR("server", "WorldSession::HandleGroupUninviteOpcode: leader %s (%s) tried to uninvite himself from the group.",
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -386,7 +389,7 @@ void WorldSession::HandleGroupUninviteOpcode(WorldPacket& recvData)
|
||||
if (!grp)
|
||||
return;
|
||||
|
||||
if (uint64 guid = grp->GetMemberGUID(membername))
|
||||
if (ObjectGuid guid = grp->GetMemberGUID(membername))
|
||||
{
|
||||
Player::RemoveFromGroup(grp, guid, GROUP_REMOVEMETHOD_KICK, GetPlayer()->GetGUID());
|
||||
return;
|
||||
@@ -407,10 +410,10 @@ void WorldSession::HandleGroupSetLeaderOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_GROUP_SET_LEADER");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
|
||||
if (!group || !player)
|
||||
@@ -456,7 +459,7 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
|
||||
#endif
|
||||
|
||||
uint32 lootMethod;
|
||||
uint64 lootMaster;
|
||||
ObjectGuid lootMaster;
|
||||
uint32 lootThreshold;
|
||||
recvData >> lootMethod >> lootMaster >> lootThreshold;
|
||||
|
||||
@@ -488,7 +491,7 @@ void WorldSession::HandleLootMethodOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleLootRoll(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 itemSlot;
|
||||
uint8 rollType;
|
||||
recvData >> guid; // guid of the item rolled
|
||||
@@ -530,7 +533,7 @@ void WorldSession::HandleMinimapPingOpcode(WorldPacket& recvData)
|
||||
|
||||
// everything's fine, do it
|
||||
WorldPacket data(MSG_MINIMAP_PING, (8 + 4 + 4));
|
||||
data << uint64(GetPlayer()->GetGUID());
|
||||
data << GetPlayer()->GetGUID();
|
||||
data << float(x);
|
||||
data << float(y);
|
||||
GetPlayer()->GetGroup()->BroadcastPacket(&data, true, -1, GetPlayer()->GetGUID());
|
||||
@@ -558,7 +561,7 @@ void WorldSession::HandleRandomRollOpcode(WorldPacket& recvData)
|
||||
data << uint32(minimum);
|
||||
data << uint32(maximum);
|
||||
data << uint32(roll);
|
||||
data << uint64(GetPlayer()->GetGUID());
|
||||
data << GetPlayer()->GetGUID();
|
||||
if (GetPlayer()->GetGroup())
|
||||
GetPlayer()->GetGroup()->BroadcastPacket(&data, false);
|
||||
else
|
||||
@@ -591,12 +594,12 @@ void WorldSession::HandleRaidTargetUpdateOpcode(WorldPacket& recvData)
|
||||
if (group->isRaidGroup() && !group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
if (IS_PLAYER_GUID(guid))
|
||||
if (guid.IsPlayer())
|
||||
{
|
||||
Player* target = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
Player* target = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
|
||||
if (!target || target->IsHostileTo(GetPlayer()))
|
||||
return;
|
||||
@@ -648,7 +651,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
|
||||
if (groupNr >= MAX_RAID_SUBGROUPS)
|
||||
return;
|
||||
|
||||
uint64 senderGuid = GetPlayer()->GetGUID();
|
||||
ObjectGuid senderGuid = GetPlayer()->GetGUID();
|
||||
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
|
||||
return;
|
||||
|
||||
@@ -656,7 +659,7 @@ void WorldSession::HandleGroupChangeSubGroupOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
|
||||
Player* movedPlayer = ObjectAccessor::FindPlayerByName(name, false);
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
if (movedPlayer)
|
||||
{
|
||||
guid = movedPlayer->GetGUID();
|
||||
@@ -683,7 +686,7 @@ void WorldSession::HandleGroupAssistantLeaderOpcode(WorldPacket& recvData)
|
||||
if (!group->IsLeader(GetPlayer()->GetGUID()))
|
||||
return;
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
bool apply;
|
||||
recvData >> guid;
|
||||
recvData >> apply;
|
||||
@@ -703,13 +706,13 @@ void WorldSession::HandlePartyAssignmentOpcode(WorldPacket& recvData)
|
||||
if (!group)
|
||||
return;
|
||||
|
||||
uint64 senderGuid = GetPlayer()->GetGUID();
|
||||
ObjectGuid senderGuid = GetPlayer()->GetGUID();
|
||||
if (!group->IsLeader(senderGuid) && !group->IsAssistant(senderGuid))
|
||||
return;
|
||||
|
||||
uint8 assignment;
|
||||
bool apply;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> assignment >> apply;
|
||||
recvData >> guid;
|
||||
|
||||
@@ -771,7 +774,7 @@ void WorldSession::HandleRaidReadyCheckOpcode(WorldPacket& recvData)
|
||||
|
||||
// everything's fine, do it
|
||||
WorldPacket data(MSG_RAID_READY_CHECK_CONFIRM, 9);
|
||||
data << uint64(GetPlayer()->GetGUID());
|
||||
data << GetPlayer()->GetGUID();
|
||||
data << uint8(state);
|
||||
group->BroadcastReadyCheck(&data);
|
||||
}
|
||||
@@ -808,7 +811,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
|
||||
byteCount += GroupUpdateLength[i];
|
||||
|
||||
data->Initialize(SMSG_PARTY_MEMBER_STATS, 8 + 4 + byteCount);
|
||||
data->append(player->GetPackGUID());
|
||||
*data << player->GetPackGUID();
|
||||
*data << uint32(mask);
|
||||
|
||||
if (mask & GROUP_UPDATE_FLAG_STATUS)
|
||||
@@ -884,7 +887,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
|
||||
if (mask & GROUP_UPDATE_FLAG_PET_GUID)
|
||||
{
|
||||
if (pet)
|
||||
*data << (uint64) pet->GetGUID();
|
||||
*data << pet->GetGUID();
|
||||
else
|
||||
*data << (uint64) 0;
|
||||
}
|
||||
@@ -978,7 +981,7 @@ void WorldSession::BuildPartyMemberStatsChangedPacket(Player* player, WorldPacke
|
||||
void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
|
||||
{
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_REQUEST_PARTY_MEMBER_STATS");
|
||||
uint64 Guid;
|
||||
ObjectGuid Guid;
|
||||
recvData >> Guid;
|
||||
|
||||
Player* player = HashMapHolder<Player>::Find(Guid);
|
||||
@@ -986,7 +989,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
|
||||
{
|
||||
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 3 + 4 + 2);
|
||||
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
|
||||
data.appendPackGUID(Guid);
|
||||
data << Guid.WriteAsPacked();
|
||||
data << uint32(GROUP_UPDATE_FLAG_STATUS);
|
||||
data << uint16(MEMBER_STATUS_OFFLINE);
|
||||
SendPacket(&data);
|
||||
@@ -998,7 +1001,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
|
||||
|
||||
WorldPacket data(SMSG_PARTY_MEMBER_STATS_FULL, 4 + 2 + 2 + 2 + 1 + 2 * 6 + 8 + 1 + 8);
|
||||
data << uint8(0); // only for SMSG_PARTY_MEMBER_STATS_FULL, probably arena/bg related
|
||||
data.append(player->GetPackGUID());
|
||||
data << player->GetPackGUID();
|
||||
|
||||
uint32 updateFlags = GROUP_UPDATE_FLAG_STATUS | GROUP_UPDATE_FLAG_CUR_HP | GROUP_UPDATE_FLAG_MAX_HP
|
||||
| GROUP_UPDATE_FLAG_CUR_POWER | GROUP_UPDATE_FLAG_MAX_POWER | GROUP_UPDATE_FLAG_LEVEL
|
||||
@@ -1066,7 +1069,7 @@ void WorldSession::HandleRequestPartyMemberStatsOpcode(WorldPacket& recvData)
|
||||
data.put<uint64>(maskPos, auraMask); // GROUP_UPDATE_FLAG_AURAS
|
||||
|
||||
if (pet && (updateFlags & GROUP_UPDATE_FLAG_PET_GUID))
|
||||
data << uint64(pet->GetGUID());
|
||||
data << pet->GetGUID();
|
||||
|
||||
data << std::string(pet ? pet->GetName() : ""); // GROUP_UPDATE_FLAG_PET_NAME
|
||||
data << uint16(pet ? pet->GetDisplayId() : 0); // GROUP_UPDATE_FLAG_PET_MODEL_ID
|
||||
@@ -1167,7 +1170,7 @@ void WorldSession::HandleGroupSwapSubGroupOpcode(WorldPacket& recv_data)
|
||||
// no player, cheating?
|
||||
if (!group->GetMemberGUID(playerName))
|
||||
{
|
||||
return uint64(0);
|
||||
return ObjectGuid::Empty;
|
||||
}
|
||||
|
||||
if (Player* player = ObjectAccessor::FindPlayerByName(playerName.c_str()))
|
||||
@@ -1176,19 +1179,19 @@ void WorldSession::HandleGroupSwapSubGroupOpcode(WorldPacket& recv_data)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (uint64 guid = sObjectMgr->GetPlayerGUIDByName(playerName))
|
||||
if (ObjectGuid guid = sObjectMgr->GetPlayerGUIDByName(playerName))
|
||||
{
|
||||
return guid;
|
||||
}
|
||||
else
|
||||
{
|
||||
return uint64(0); // no player - again, cheating?
|
||||
return ObjectGuid::Empty; // no player - again, cheating?
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
uint64 guid1 = getGuid(playerName1);
|
||||
uint64 guid2 = getGuid(playerName2);
|
||||
ObjectGuid guid1 = getGuid(playerName1);
|
||||
ObjectGuid guid2 = getGuid(playerName2);
|
||||
|
||||
if(!guid1 || !guid2)
|
||||
{
|
||||
|
||||
@@ -342,16 +342,15 @@ void WorldSession::HandleGuildChangeInfoTextOpcode(WorldPacket& recvPacket)
|
||||
|
||||
void WorldSession::HandleSaveGuildEmblemOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
uint64 vendorGuid;
|
||||
ObjectGuid vendorGuid;
|
||||
recvPacket >> vendorGuid;
|
||||
|
||||
EmblemInfo emblemInfo;
|
||||
emblemInfo.ReadPacket(recvPacket);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [" UI64FMTD
|
||||
"] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
|
||||
, GetPlayerInfo().c_str(), vendorGuid, emblemInfo.GetStyle()
|
||||
LOG_DEBUG("guild", "MSG_SAVE_GUILD_EMBLEM [%s]: Guid: [%s] Style: %d, Color: %d, BorderStyle: %d, BorderColor: %d, BackgroundColor: %d"
|
||||
, GetPlayerInfo().c_str(), vendorGuid.ToString().c_str(), emblemInfo.GetStyle()
|
||||
, emblemInfo.GetColor(), emblemInfo.GetBorderStyle()
|
||||
, emblemInfo.GetBorderColor(), emblemInfo.GetBackgroundColor());
|
||||
#endif
|
||||
@@ -403,13 +402,13 @@ void WorldSession::HandleGuildPermissions(WorldPacket& /* recvData */)
|
||||
// Called when clicking on Guild bank gameobject
|
||||
void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
bool sendAllSlots;
|
||||
recvData >> guid >> sendAllSlots;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [" UI64FMTD "] AllSlots: %u"
|
||||
, GetPlayerInfo().c_str(), guid, sendAllSlots);
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANKER_ACTIVATE [%s]: Go: [%s] AllSlots: %u"
|
||||
, GetPlayerInfo().c_str(), guid.ToString().c_str(), sendAllSlots);
|
||||
#endif
|
||||
Guild* const guild = GetPlayer()->GetGuild();
|
||||
if (!guild)
|
||||
@@ -424,15 +423,15 @@ void WorldSession::HandleGuildBankerActivate(WorldPacket& recvData)
|
||||
// Called when opening guild bank tab only (first one)
|
||||
void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint8 tabId;
|
||||
bool full;
|
||||
|
||||
recvData >> guid >> tabId >> full;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, ShowTabs: %u"
|
||||
, GetPlayerInfo().c_str(), guid, tabId, full);
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_QUERY_TAB [%s]: Go: [%s], TabId: %u, ShowTabs: %u"
|
||||
, GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, full);
|
||||
#endif
|
||||
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
@@ -441,13 +440,13 @@ void WorldSession::HandleGuildBankQueryTab(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 money;
|
||||
recvData >> guid >> money;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [" UI64FMTD "], money: %u",
|
||||
GetPlayerInfo().c_str(), guid, money);
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_DEPOSIT_MONEY [%s]: Go: [%s], money: %u",
|
||||
GetPlayerInfo().c_str(), guid.ToString().c_str(), money);
|
||||
#endif
|
||||
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
if (money && GetPlayer()->HasEnoughMoney(money))
|
||||
@@ -457,13 +456,13 @@ void WorldSession::HandleGuildBankDepositMoney(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleGuildBankWithdrawMoney(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 money;
|
||||
recvData >> guid >> money;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [" UI64FMTD "], money: %u",
|
||||
GetPlayerInfo().c_str(), guid, money);
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_WITHDRAW_MONEY [%s]: Go: [%s], money: %u",
|
||||
GetPlayerInfo().c_str(), guid.ToString().c_str(), money);
|
||||
#endif
|
||||
if (money && GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
if (Guild* guild = GetPlayer()->GetGuild())
|
||||
@@ -476,7 +475,7 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData)
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_SWAP_ITEMS [%s]", GetPlayerInfo().c_str());
|
||||
#endif
|
||||
|
||||
uint64 GoGuid;
|
||||
ObjectGuid GoGuid;
|
||||
recvData >> GoGuid;
|
||||
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
@@ -555,13 +554,13 @@ void WorldSession::HandleGuildBankSwapItems(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint8 tabId;
|
||||
|
||||
recvData >> guid >> tabId;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [" UI64FMTD "], TabId: %u", GetPlayerInfo().c_str(), guid, tabId);
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_BUY_TAB [%s]: Go: [%s], TabId: %u", GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId);
|
||||
#endif
|
||||
|
||||
if (GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||
@@ -571,15 +570,15 @@ void WorldSession::HandleGuildBankBuyTab(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleGuildBankUpdateTab(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint8 tabId;
|
||||
std::string name, icon;
|
||||
|
||||
recvData >> guid >> tabId >> name >> icon;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [" UI64FMTD "], TabId: %u, Name: %s, Icon: %s"
|
||||
, GetPlayerInfo().c_str(), guid, tabId, name.c_str(), icon.c_str());
|
||||
LOG_DEBUG("guild", "CMSG_GUILD_BANK_UPDATE_TAB [%s]: Go: [%s], TabId: %u, Name: %s, Icon: %s"
|
||||
, GetPlayerInfo().c_str(), guid.ToString().c_str(), tabId, name.c_str(), icon.c_str());
|
||||
#endif
|
||||
|
||||
// Check for overflow
|
||||
|
||||
@@ -74,13 +74,13 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
|
||||
|
||||
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, srcslot) && !CanUseBank())
|
||||
{
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player->IsBankPos(INVENTORY_SLOT_BAG_0, dstslot) && !CanUseBank())
|
||||
{
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleSwapInvItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ void WorldSession::HandleSwapInvItemOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleAutoEquipItemSlotOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 itemguid;
|
||||
ObjectGuid itemguid;
|
||||
uint8 dstslot;
|
||||
recvData >> itemguid >> dstslot;
|
||||
|
||||
@@ -137,13 +137,13 @@ void WorldSession::HandleSwapItem(WorldPacket& recvData)
|
||||
|
||||
if (_player->IsBankPos(srcbag, srcslot) && !CanUseBank())
|
||||
{
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player->IsBankPos(dstbag, dstslot) && !CanUseBank())
|
||||
{
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleSwapItem - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -625,7 +625,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_SELL_ITEM");
|
||||
#endif
|
||||
uint64 vendorguid, itemguid;
|
||||
ObjectGuid vendorguid, itemguid;
|
||||
uint32 count;
|
||||
|
||||
recvData >> vendorguid >> itemguid >> count;
|
||||
@@ -637,7 +637,7 @@ void WorldSession::HandleSellItemOpcode(WorldPacket& recvData)
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleSellItemOpcode - Unit (%s) not found or you can not interact with him.", vendorguid.ToString().c_str());
|
||||
#endif
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, itemguid, 0);
|
||||
return;
|
||||
@@ -756,7 +756,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_BUYBACK_ITEM");
|
||||
#endif
|
||||
uint64 vendorguid;
|
||||
ObjectGuid vendorguid;
|
||||
uint32 slot;
|
||||
|
||||
recvData >> vendorguid >> slot;
|
||||
@@ -765,9 +765,9 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorguid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleBuybackItem - Unit (%s) not found or you can not interact with him.", vendorguid.ToString().c_str());
|
||||
#endif
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, 0, 0);
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, ObjectGuid::Empty, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -792,7 +792,7 @@ void WorldSession::HandleBuybackItem(WorldPacket& recvData)
|
||||
if (sWorld->getBoolConfig(CONFIG_ITEMDELETE_VENDOR))
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_RECOVERY_ITEM);
|
||||
stmt->setUInt32(0, _player->GetGUID());
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, pItem->GetEntry());
|
||||
stmt->setUInt32(2, pItem->GetCount());
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -817,7 +817,7 @@ void WorldSession::HandleBuyItemInSlotOpcode(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM_IN_SLOT");
|
||||
#endif
|
||||
uint64 vendorguid, bagguid;
|
||||
ObjectGuid vendorguid, bagguid;
|
||||
uint32 item, slot, count;
|
||||
uint8 bagslot;
|
||||
|
||||
@@ -861,7 +861,7 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_BUY_ITEM");
|
||||
#endif
|
||||
uint64 vendorguid;
|
||||
ObjectGuid vendorguid;
|
||||
uint32 item, slot, count;
|
||||
uint8 unk1;
|
||||
|
||||
@@ -878,7 +878,7 @@ void WorldSession::HandleBuyItemOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid;
|
||||
|
||||
@@ -892,7 +892,7 @@ void WorldSession::HandleListInventoryOpcode(WorldPacket& recvData)
|
||||
SendListInventory(guid);
|
||||
}
|
||||
|
||||
void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry)
|
||||
void WorldSession::SendListInventory(ObjectGuid vendorGuid, uint32 vendorEntry)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Sent SMSG_LIST_INVENTORY");
|
||||
@@ -902,9 +902,9 @@ void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry)
|
||||
if (!vendor)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: SendListInventory - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(vendorGuid)));
|
||||
LOG_DEBUG("network", "WORLD: SendListInventory - Unit (%s) not found or you can not interact with him.", vendorGuid.ToString().c_str());
|
||||
#endif
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, 0, 0);
|
||||
_player->SendSellError(SELL_ERR_CANT_FIND_VENDOR, nullptr, ObjectGuid::Empty, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -922,7 +922,7 @@ void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry)
|
||||
if (!items)
|
||||
{
|
||||
WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + 1);
|
||||
data << uint64(vendorGuid);
|
||||
data << vendorGuid;
|
||||
data << uint8(0); // count == 0, next will be error code
|
||||
data << uint8(0); // "Vendor has no inventory"
|
||||
SendPacket(&data);
|
||||
@@ -933,7 +933,7 @@ void WorldSession::SendListInventory(uint64 vendorGuid, uint32 vendorEntry)
|
||||
uint8 count = 0;
|
||||
|
||||
WorldPacket data(SMSG_LIST_INVENTORY, 8 + 1 + itemCount * 8 * 4);
|
||||
data << uint64(vendorGuid);
|
||||
data << vendorGuid;
|
||||
|
||||
size_t countPos = data.wpos();
|
||||
data << uint8(count);
|
||||
@@ -1053,12 +1053,12 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_BUY_BANK_SLOT");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvPacket >> guid;
|
||||
|
||||
if (!CanUseBank(guid))
|
||||
{
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleBuyBankSlotOpcode - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1114,7 +1114,7 @@ void WorldSession::HandleAutoBankItemOpcode(WorldPacket& recvPacket)
|
||||
|
||||
if (!CanUseBank())
|
||||
{
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleAutoBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1156,7 +1156,7 @@ void WorldSession::HandleAutoStoreBankItemOpcode(WorldPacket& recvPacket)
|
||||
|
||||
if (!CanUseBank())
|
||||
{
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(m_currentBankerGUID)));
|
||||
//TC_LOG_DEBUG("network", "WORLD: HandleAutoStoreBankItemOpcode - Unit (%s) not found or you can't interact with him.", m_currentBankerGUID.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1223,24 +1223,24 @@ void WorldSession::HandleSetAmmoOpcode(WorldPacket& recvData)
|
||||
_player->RemoveAmmo();
|
||||
}
|
||||
|
||||
void WorldSession::SendEnchantmentLog(uint64 target, uint64 caster, uint32 itemId, uint32 enchantId)
|
||||
void WorldSession::SendEnchantmentLog(ObjectGuid target, ObjectGuid caster, uint32 itemId, uint32 enchantId)
|
||||
{
|
||||
WorldPacket data(SMSG_ENCHANTMENTLOG, (8 + 8 + 4 + 4)); // last check 2.0.10
|
||||
data.appendPackGUID(target);
|
||||
data.appendPackGUID(caster);
|
||||
data << target.WriteAsPacked();
|
||||
data << caster.WriteAsPacked();
|
||||
data << uint32(itemId);
|
||||
data << uint32(enchantId);
|
||||
GetPlayer()->SendMessageToSet(&data, true);
|
||||
}
|
||||
|
||||
void WorldSession::SendItemEnchantTimeUpdate(uint64 Playerguid, uint64 Itemguid, uint32 slot, uint32 Duration)
|
||||
void WorldSession::SendItemEnchantTimeUpdate(ObjectGuid Playerguid, ObjectGuid Itemguid, uint32 slot, uint32 Duration)
|
||||
{
|
||||
// last check 2.0.10
|
||||
WorldPacket data(SMSG_ITEM_ENCHANT_TIME_UPDATE, (8 + 4 + 4 + 8));
|
||||
data << uint64(Itemguid);
|
||||
data << Itemguid;
|
||||
data << uint32(slot);
|
||||
data << uint32(Duration);
|
||||
data << uint64(Playerguid);
|
||||
data << Playerguid;
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -1325,7 +1325,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
if (item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
|
||||
if (item->GetGuidValue(ITEM_FIELD_GIFTCREATOR)) // HasFlag(ITEM_FIELD_FLAGS, ITEM_FLAGS_WRAPPED);
|
||||
{
|
||||
_player->SendEquipError(EQUIP_ERR_WRAPPED_CANT_BE_WRAPPED, item, nullptr);
|
||||
return;
|
||||
@@ -1359,8 +1359,8 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_CHAR_GIFT);
|
||||
stmt->setUInt32(0, GUID_LOPART(item->GetOwnerGUID()));
|
||||
stmt->setUInt32(1, item->GetGUIDLow());
|
||||
stmt->setUInt32(0, item->GetOwnerGUID().GetCounter());
|
||||
stmt->setUInt32(1, item->GetGUID().GetCounter());
|
||||
stmt->setUInt32(2, item->GetEntry());
|
||||
stmt->setUInt32(3, item->GetUInt32Value(ITEM_FIELD_FLAGS));
|
||||
trans->Append(stmt);
|
||||
@@ -1388,7 +1388,7 @@ void WorldSession::HandleWrapItemOpcode(WorldPacket& recvData)
|
||||
item->SetEntry(21831);
|
||||
break;
|
||||
}
|
||||
item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
|
||||
item->SetGuidValue(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
|
||||
item->SetUInt32Value(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED);
|
||||
item->SetState(ITEM_CHANGED, _player);
|
||||
|
||||
@@ -1407,8 +1407,8 @@ void WorldSession::HandleSocketOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_SOCKET_GEMS");
|
||||
#endif
|
||||
|
||||
uint64 item_guid;
|
||||
uint64 gem_guids[MAX_GEM_SOCKETS];
|
||||
ObjectGuid item_guid;
|
||||
ObjectGuid gem_guids[MAX_GEM_SOCKETS];
|
||||
|
||||
recvData >> item_guid;
|
||||
if (!item_guid)
|
||||
@@ -1633,7 +1633,7 @@ void WorldSession::HandleItemRefundInfoRequest(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND_INFO");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid; // item guid
|
||||
|
||||
Item* item = _player->GetItemByGuid(guid);
|
||||
@@ -1653,7 +1653,7 @@ void WorldSession::HandleItemRefund(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_ITEM_REFUND");
|
||||
#endif
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid; // item guid
|
||||
|
||||
Item* item = _player->GetItemByGuid(guid);
|
||||
@@ -1679,11 +1679,11 @@ void WorldSession::HandleItemRefund(WorldPacket& recvData)
|
||||
*/
|
||||
void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
|
||||
{
|
||||
uint64 itemGuid;
|
||||
ObjectGuid itemGuid;
|
||||
recvData >> itemGuid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY item guid: %u", GUID_LOPART(itemGuid));
|
||||
LOG_DEBUG("network", "CMSG_ITEM_TEXT_QUERY item: %s", itemGuid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
WorldPacket data(SMSG_ITEM_TEXT_QUERY_RESPONSE, 50); // guess size
|
||||
@@ -1691,7 +1691,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
|
||||
if (Item* item = _player->GetItemByGuid(itemGuid))
|
||||
{
|
||||
data << uint8(0); // has text
|
||||
data << uint64(itemGuid); // item guid
|
||||
data << itemGuid; // item guid
|
||||
data << item->GetText();
|
||||
}
|
||||
else
|
||||
@@ -1702,7 +1702,7 @@ void WorldSession::HandleItemTextQuery(WorldPacket& recvData )
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
bool WorldSession::CanUseBank(uint64 bankerGUID) const
|
||||
bool WorldSession::CanUseBank(ObjectGuid bankerGUID) const
|
||||
{
|
||||
// bankerGUID parameter is optional, set to 0 by default.
|
||||
if (!bankerGUID)
|
||||
@@ -1728,7 +1728,7 @@ bool WorldSession::recoveryItem(Item* pItem)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_RECOVERY_ITEM);
|
||||
|
||||
stmt->setUInt32(0, pItem->GetOwnerGUID());
|
||||
stmt->setUInt32(0, pItem->GetOwnerGUID().GetCounter());
|
||||
stmt->setUInt32(1, pItem->GetTemplate()->ItemId);
|
||||
stmt->setUInt32(2, pItem->GetCount());
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ void BuildPartyLockDungeonBlock(WorldPacket& data, const lfg::LfgLockPartyMap& l
|
||||
data << uint8(lockMap.size());
|
||||
for (lfg::LfgLockPartyMap::const_iterator it = lockMap.begin(); it != lockMap.end(); ++it)
|
||||
{
|
||||
data << uint64(it->first); // Player guid
|
||||
data << it->first; // Player guid
|
||||
BuildPlayerLockDungeonBlock(data, it->second);
|
||||
}
|
||||
}
|
||||
@@ -57,7 +57,7 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
|
||||
if (!numDungeons)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_JOIN [" UI64FMTD "] no dungeons selected", GetPlayer()->GetGUID());
|
||||
LOG_DEBUG("network", "CMSG_LFG_JOIN [%s] no dungeons selected", GetPlayer()->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
recvData.rfinish();
|
||||
return;
|
||||
@@ -78,7 +78,8 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
|
||||
std::string comment;
|
||||
recvData >> comment;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_JOIN [" UI64FMTD "] roles: %u, Dungeons: %u, Comment: %s", GetPlayer()->GetGUID(), roles, uint8(newDungeons.size()), comment.c_str());
|
||||
LOG_DEBUG("network", "CMSG_LFG_JOIN [%s] roles: %u, Dungeons: %u, Comment: %s",
|
||||
GetPlayer()->GetGUID().ToString().c_str(), roles, uint8(newDungeons.size()), comment.c_str());
|
||||
#endif
|
||||
|
||||
sLFGMgr->JoinLfg(GetPlayer(), uint8(roles), newDungeons, comment);
|
||||
@@ -87,18 +88,18 @@ void WorldSession::HandleLfgJoinOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleLfgLeaveOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
uint64 gguid = group ? group->GetGUID() : guid;
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
ObjectGuid gguid = group ? group->GetGUID() : guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_LEAVE [" UI64FMTD "] in group: %u", guid, group ? 1 : 0);
|
||||
LOG_DEBUG("network", "CMSG_LFG_LEAVE [%s] in group: %u", guid.ToString().c_str(), group ? 1 : 0);
|
||||
#endif
|
||||
|
||||
// Check cheating - only leader can leave the queue
|
||||
if (!group || group->GetLeaderGUID() == guid)
|
||||
{
|
||||
sLFGMgr->LeaveLfg(sLFGMgr->GetState(guid) == lfg::LFG_STATE_RAIDBROWSER ? guid : gguid);
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true, group ? group->GetGUID() : 0);
|
||||
sLFGMgr->LeaveAllLfgQueues(guid, true, group ? group->GetGUID() : ObjectGuid::Empty);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -110,7 +111,7 @@ void WorldSession::HandleLfgProposalResultOpcode(WorldPacket& recvData)
|
||||
recvData >> accept;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_PROPOSAL_RESULT [" UI64FMTD "] proposal: %u accept: %u", GetPlayer()->GetGUID(), proposalID, accept ? 1 : 0);
|
||||
LOG_DEBUG("network", "CMSG_LFG_PROPOSAL_RESULT [%s] proposal: %u accept: %u", GetPlayer()->GetGUID().ToString().c_str(), proposalID, accept ? 1 : 0);
|
||||
#endif
|
||||
sLFGMgr->UpdateProposal(proposalID, GetPlayer()->GetGUID(), accept);
|
||||
}
|
||||
@@ -119,18 +120,18 @@ void WorldSession::HandleLfgSetRolesOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint8 roles;
|
||||
recvData >> roles; // Player Group Roles
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
if (!group)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_SET_ROLES [" UI64FMTD "] Not in group", guid);
|
||||
LOG_DEBUG("network", "CMSG_LFG_SET_ROLES [%s] Not in group", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
uint64 gguid = group->GetGUID();
|
||||
ObjectGuid gguid = group->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_SET_ROLES: Group [" UI64FMTD "], Player [" UI64FMTD "], Roles: %u", gguid, guid, roles);
|
||||
LOG_DEBUG("network", "CMSG_LFG_SET_ROLES: Group [%s], Player [%s], Roles: %u", gguid.ToString().c_str(), guid.ToString().c_str(), roles);
|
||||
#endif
|
||||
sLFGMgr->UpdateRoleCheck(gguid, guid, roles);
|
||||
}
|
||||
@@ -140,8 +141,8 @@ void WorldSession::HandleLfgSetCommentOpcode(WorldPacket& recvData)
|
||||
std::string comment;
|
||||
recvData >> comment;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
LOG_DEBUG("network", "CMSG_LFG_SET_COMMENT [" UI64FMTD "] comment: %s", guid, comment.c_str());
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
LOG_DEBUG("network", "CMSG_LFG_SET_COMMENT [%s] comment: %s", guid.ToString().c_str(), comment.c_str());
|
||||
#endif
|
||||
|
||||
sLFGMgr->SetComment(GetPlayer()->GetGUID(), comment);
|
||||
@@ -153,9 +154,9 @@ void WorldSession::HandleLfgSetBootVoteOpcode(WorldPacket& recvData)
|
||||
bool agree; // Agree to kick player
|
||||
recvData >> agree;
|
||||
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_SET_BOOT_VOTE [" UI64FMTD "] agree: %u", guid, agree ? 1 : 0);
|
||||
LOG_DEBUG("network", "CMSG_LFG_SET_BOOT_VOTE [%s] agree: %u", guid.ToString().c_str(), agree ? 1 : 0);
|
||||
#endif
|
||||
sLFGMgr->UpdateBoot(guid, agree);
|
||||
}
|
||||
@@ -166,16 +167,16 @@ void WorldSession::HandleLfgTeleportOpcode(WorldPacket& recvData)
|
||||
recvData >> out;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_TELEPORT [" UI64FMTD "] out: %u", GetPlayer()->GetGUID(), out ? 1 : 0);
|
||||
LOG_DEBUG("network", "CMSG_LFG_TELEPORT [%s] out: %u", GetPlayer()->GetGUID().ToString().c_str(), out ? 1 : 0);
|
||||
#endif
|
||||
sLFGMgr->TeleportPlayer(GetPlayer(), out, true);
|
||||
}
|
||||
|
||||
void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST [" UI64FMTD "]", guid);
|
||||
LOG_DEBUG("network", "CMSG_LFG_PLAYER_LOCK_INFO_REQUEST [%s]", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
// Get Random dungeons that can be done at a certain level and expansion
|
||||
@@ -190,7 +191,7 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
|
||||
uint32 lsize = uint32(lock.size());
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_PLAYER_INFO [" UI64FMTD "]", guid);
|
||||
LOG_DEBUG("network", "SMSG_LFG_PLAYER_INFO [%s]", guid.ToString().c_str());
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_PLAYER_INFO, 1 + rsize * (4 + 1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4) + 4 + lsize * (1 + 4 + 4 + 4 + 4 + 1 + 4 + 4 + 4));
|
||||
|
||||
@@ -248,9 +249,9 @@ void WorldSession::HandleLfgPlayerLockInfoRequestOpcode(WorldPacket& /*recvData*
|
||||
|
||||
void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_LFG_PARTY_LOCK_INFO_REQUEST [" UI64FMTD "]", guid);
|
||||
LOG_DEBUG("network", "CMSG_LFG_PARTY_LOCK_INFO_REQUEST [%s]", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
Group* group = GetPlayer()->GetGroup();
|
||||
@@ -265,7 +266,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*
|
||||
if (!plrg)
|
||||
continue;
|
||||
|
||||
uint64 pguid = plrg->GetGUID();
|
||||
ObjectGuid pguid = plrg->GetGUID();
|
||||
if (pguid == guid)
|
||||
continue;
|
||||
|
||||
@@ -278,7 +279,7 @@ void WorldSession::HandleLfgPartyLockInfoRequestOpcode(WorldPacket& /*recvData*
|
||||
size += 8 + 4 + uint32(it->second.size()) * (4 + 4);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_PARTY_INFO [" UI64FMTD "]", guid);
|
||||
LOG_DEBUG("network", "SMSG_LFG_PARTY_INFO [%s]", guid.ToString().c_str());
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_PARTY_INFO, 1 + size);
|
||||
BuildPartyLockDungeonBlock(data, lockMap);
|
||||
@@ -307,7 +308,7 @@ void WorldSession::HandleLfgGetStatus(WorldPacket& /*recvData*/)
|
||||
LOG_DEBUG("lfg", "CMSG_LFG_GET_STATUS %s", GetPlayerInfo().c_str());
|
||||
#endif
|
||||
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
lfg::LfgUpdateData updateData = sLFGMgr->GetLfgStatus(guid);
|
||||
|
||||
if (GetPlayer()->GetGroup())
|
||||
@@ -409,14 +410,14 @@ void WorldSession::SendLfgUpdateParty(lfg::LfgUpdateData const& updateData)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendLfgRoleChosen(uint64 guid, uint8 roles)
|
||||
void WorldSession::SendLfgRoleChosen(ObjectGuid guid, uint8 roles)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_ROLE_CHOSEN [" UI64FMTD "] guid: [" UI64FMTD "] roles: %u", GetPlayer()->GetGUID(), guid, roles);
|
||||
LOG_DEBUG("network", "SMSG_LFG_ROLE_CHOSEN [%s] guid: [%s] roles: %u", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str(), roles);
|
||||
#endif
|
||||
|
||||
WorldPacket data(SMSG_LFG_ROLE_CHOSEN, 8 + 1 + 4);
|
||||
data << uint64(guid); // Guid
|
||||
data << guid; // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
SendPacket(&data);
|
||||
@@ -431,7 +432,7 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck)
|
||||
dungeons = roleCheck.dungeons;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_ROLE_CHECK_UPDATE [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
LOG_DEBUG("network", "SMSG_LFG_ROLE_CHECK_UPDATE [%s]", GetPlayer()->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_ROLE_CHECK_UPDATE, 4 + 1 + 1 + dungeons.size() * 4 + 1 + roleCheck.roles.size() * (8 + 1 + 4 + 1));
|
||||
|
||||
@@ -446,12 +447,12 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck)
|
||||
if (!roleCheck.roles.empty())
|
||||
{
|
||||
// Leader info MUST be sent 1st :S
|
||||
uint64 guid = roleCheck.leader;
|
||||
ObjectGuid guid = roleCheck.leader;
|
||||
uint8 roles = roleCheck.roles.find(guid)->second;
|
||||
data << uint64(guid); // Guid
|
||||
data << guid; // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
data << uint8(player ? player->getLevel() : 0); // Level
|
||||
|
||||
for (lfg::LfgRolesMap::const_iterator it = roleCheck.roles.begin(); it != roleCheck.roles.end(); ++it)
|
||||
@@ -461,10 +462,10 @@ void WorldSession::SendLfgRoleCheckUpdate(lfg::LfgRoleCheck const& roleCheck)
|
||||
|
||||
guid = it->first;
|
||||
roles = it->second;
|
||||
data << uint64(guid); // Guid
|
||||
data << guid; // Guid
|
||||
data << uint8(roles > 0); // Ready
|
||||
data << uint32(roles); // Roles
|
||||
player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
data << uint8(player ? player->getLevel() : 0);// Level
|
||||
}
|
||||
}
|
||||
@@ -478,7 +479,7 @@ void WorldSession::SendLfgJoinResult(lfg::LfgJoinResultData const& joinData)
|
||||
size += 8 + 4 + uint32(it->second.size()) * (4 + 4);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_JOIN_RESULT [" UI64FMTD "] checkResult: %u checkValue: %u", GetPlayer()->GetGUID(), joinData.result, joinData.state);
|
||||
LOG_DEBUG("network", "SMSG_LFG_JOIN_RESULT [%s] checkResult: %u checkValue: %u", GetPlayer()->GetGUID().ToString().c_str(), joinData.result, joinData.state);
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_JOIN_RESULT, 4 + 4 + size);
|
||||
data << uint32(joinData.result); // Check Result
|
||||
@@ -491,8 +492,9 @@ void WorldSession::SendLfgJoinResult(lfg::LfgJoinResultData const& joinData)
|
||||
void WorldSession::SendLfgQueueStatus(lfg::LfgQueueStatusData const& queueData)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_QUEUE_STATUS [" UI64FMTD "] dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u",
|
||||
GetPlayer()->GetGUID(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank, queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps);
|
||||
LOG_DEBUG("network", "SMSG_LFG_QUEUE_STATUS [%s] dungeon: %u - waitTime: %d - avgWaitTime: %d - waitTimeTanks: %d - waitTimeHealer: %d - waitTimeDps: %d - queuedTime: %u - tanks: %u - healers: %u - dps: %u",
|
||||
GetPlayer()->GetGUID().ToString().c_str(), queueData.dungeonId, queueData.waitTime, queueData.waitTimeAvg, queueData.waitTimeTank,
|
||||
queueData.waitTimeHealer, queueData.waitTimeDps, queueData.queuedTime, queueData.tanks, queueData.healers, queueData.dps);
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_QUEUE_STATUS, 4 + 4 + 4 + 4 + 4 + 4 + 1 + 1 + 1 + 4);
|
||||
data << uint32(queueData.dungeonId); // Dungeon
|
||||
@@ -544,7 +546,7 @@ void WorldSession::SendLfgPlayerReward(lfg::LfgPlayerRewardData const& rewardDat
|
||||
|
||||
void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
|
||||
{
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
lfg::LfgAnswer playerVote = boot.votes.find(guid)->second;
|
||||
uint8 votesNum = 0;
|
||||
uint8 agreeNum = 0;
|
||||
@@ -559,31 +561,32 @@ void WorldSession::SendLfgBootProposalUpdate(lfg::LfgPlayerBoot const& boot)
|
||||
}
|
||||
}
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_BOOT_PROPOSAL_UPDATE [" UI64FMTD "] inProgress: %u - didVote: %u - agree: %u - victim: [" UI64FMTD "] votes: %u - agrees: %u - left: %u - needed: %u - reason %s",
|
||||
guid, uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING), uint8(playerVote == lfg::LFG_ANSWER_AGREE), boot.victim, votesNum, agreeNum, secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
|
||||
LOG_DEBUG("network", "SMSG_LFG_BOOT_PROPOSAL_UPDATE [%s] inProgress: %u - didVote: %u - agree: %u - victim: [%s] votes: %u - agrees: %u - left: %u - needed: %u - reason %s",
|
||||
guid.ToString().c_str(), uint8(boot.inProgress), uint8(playerVote != lfg::LFG_ANSWER_PENDING), uint8(playerVote == lfg::LFG_ANSWER_AGREE),
|
||||
boot.victim.ToString().c_str(), votesNum, agreeNum, secsleft, lfg::LFG_GROUP_KICK_VOTES_NEEDED, boot.reason.c_str());
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_BOOT_PROPOSAL_UPDATE, 1 + 1 + 1 + 8 + 4 + 4 + 4 + 4 + boot.reason.length());
|
||||
data << uint8(boot.inProgress); // Vote in progress
|
||||
data << uint8(playerVote != lfg::LFG_ANSWER_PENDING); // Did Vote
|
||||
data << uint8(playerVote == lfg::LFG_ANSWER_AGREE); // Agree
|
||||
data << uint64(boot.victim); // Victim GUID
|
||||
data << uint8(playerVote != lfg::LFG_ANSWER_PENDING); // Did Vote
|
||||
data << uint8(playerVote == lfg::LFG_ANSWER_AGREE); // Agree
|
||||
data << boot.victim; // Victim GUID
|
||||
data << uint32(votesNum); // Total Votes
|
||||
data << uint32(agreeNum); // Agree Count
|
||||
data << uint32(secsleft); // Time Left
|
||||
data << uint32(lfg::LFG_GROUP_KICK_VOTES_NEEDED); // Needed Votes
|
||||
data << uint32(lfg::LFG_GROUP_KICK_VOTES_NEEDED); // Needed Votes
|
||||
data << boot.reason.c_str(); // Kick reason
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal)
|
||||
{
|
||||
uint64 guid = GetPlayer()->GetGUID();
|
||||
uint64 gguid = proposal.players.find(guid)->second.group;
|
||||
ObjectGuid guid = GetPlayer()->GetGUID();
|
||||
ObjectGuid gguid = proposal.players.find(guid)->second.group;
|
||||
bool silent = !proposal.isNew && gguid == proposal.group;
|
||||
uint32 dungeonEntry = proposal.dungeonId;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_PROPOSAL_UPDATE [" UI64FMTD "] state: %u", guid, proposal.state);
|
||||
LOG_DEBUG("network", "SMSG_LFG_PROPOSAL_UPDATE [%s state: %u", guid.ToString().c_str(), proposal.state);
|
||||
#endif
|
||||
|
||||
// show random dungeon if player selected random dungeon and it's not lfg group
|
||||
@@ -628,7 +631,7 @@ void WorldSession::SendLfgUpdateProposal(lfg::LfgProposal const& proposal)
|
||||
void WorldSession::SendLfgLfrList(bool update)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_LFR_LIST [" UI64FMTD "] update: %u", GetPlayer()->GetGUID(), update ? 1 : 0);
|
||||
LOG_DEBUG("network", "SMSG_LFG_LFR_LIST [%s] update: %u", GetPlayer()->GetGUID().ToString().c_str(), update ? 1 : 0);
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_UPDATE_SEARCH, 1);
|
||||
data << uint8(update); // In Lfg Queue?
|
||||
@@ -638,7 +641,7 @@ void WorldSession::SendLfgLfrList(bool update)
|
||||
void WorldSession::SendLfgDisabled()
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_DISABLED [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
LOG_DEBUG("network", "SMSG_LFG_DISABLED [%s]", GetPlayer()->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_DISABLED, 0);
|
||||
SendPacket(&data);
|
||||
@@ -647,7 +650,7 @@ void WorldSession::SendLfgDisabled()
|
||||
void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_OFFER_CONTINUE [" UI64FMTD "] dungeon entry: %u", GetPlayer()->GetGUID(), dungeonEntry);
|
||||
LOG_DEBUG("network", "SMSG_LFG_OFFER_CONTINUE [%s] dungeon entry: %u", GetPlayer()->GetGUID().ToString().c_str(), dungeonEntry);
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_OFFER_CONTINUE, 4);
|
||||
data << uint32(dungeonEntry);
|
||||
@@ -657,7 +660,7 @@ void WorldSession::SendLfgOfferContinue(uint32 dungeonEntry)
|
||||
void WorldSession::SendLfgTeleportError(uint8 err)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "SMSG_LFG_TELEPORT_DENIED [" UI64FMTD "] reason: %u", GetPlayer()->GetGUID(), err);
|
||||
LOG_DEBUG("network", "SMSG_LFG_TELEPORT_DENIED [%s] reason: %u", GetPlayer()->GetGUID().ToString().c_str(), err);
|
||||
#endif
|
||||
WorldPacket data(SMSG_LFG_TELEPORT_DENIED, 4);
|
||||
data << uint32(err); // Error
|
||||
|
||||
@@ -31,13 +31,13 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_AUTOSTORE_LOOT_ITEM");
|
||||
#endif
|
||||
Player* player = GetPlayer();
|
||||
uint64 lguid = player->GetLootGUID();
|
||||
ObjectGuid lguid = player->GetLootGUID();
|
||||
Loot* loot = nullptr;
|
||||
uint8 lootSlot = 0;
|
||||
|
||||
recvData >> lootSlot;
|
||||
|
||||
if (IS_GAMEOBJECT_GUID(lguid))
|
||||
if (lguid.IsGameObject())
|
||||
{
|
||||
GameObject* go = player->GetMap()->GetGameObject(lguid);
|
||||
// xinef: cheating protection
|
||||
@@ -53,7 +53,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
||||
|
||||
loot = &go->loot;
|
||||
}
|
||||
else if (IS_ITEM_GUID(lguid))
|
||||
else if (lguid.IsItem())
|
||||
{
|
||||
Item* pItem = player->GetItemByGuid(lguid);
|
||||
|
||||
@@ -65,7 +65,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
||||
|
||||
loot = &pItem->loot;
|
||||
}
|
||||
else if (IS_CORPSE_GUID(lguid))
|
||||
else if (lguid.IsCorpse())
|
||||
{
|
||||
Corpse* bones = ObjectAccessor::GetCorpse(*player, lguid);
|
||||
if (!bones)
|
||||
@@ -93,7 +93,7 @@ void WorldSession::HandleAutostoreLootItemOpcode(WorldPacket& recvData)
|
||||
player->StoreLootItem(lootSlot, loot);
|
||||
|
||||
// If player is removing the last LootItem, delete the empty container.
|
||||
if (loot->isLooted() && IS_ITEM_GUID(lguid))
|
||||
if (loot->isLooted() && lguid.IsItem())
|
||||
DoLootRelease(lguid);
|
||||
}
|
||||
|
||||
@@ -104,16 +104,16 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
|
||||
#endif
|
||||
|
||||
Player* player = GetPlayer();
|
||||
uint64 guid = player->GetLootGUID();
|
||||
ObjectGuid guid = player->GetLootGUID();
|
||||
if (!guid)
|
||||
return;
|
||||
|
||||
Loot* loot = nullptr;
|
||||
bool shareMoney = true;
|
||||
|
||||
switch (GUID_HIPART(guid))
|
||||
switch (guid.GetHigh())
|
||||
{
|
||||
case HIGHGUID_GAMEOBJECT:
|
||||
case HighGuid::GameObject:
|
||||
{
|
||||
GameObject* go = GetPlayer()->GetMap()->GetGameObject(guid);
|
||||
|
||||
@@ -123,7 +123,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
|
||||
|
||||
break;
|
||||
}
|
||||
case HIGHGUID_CORPSE: // remove insignia ONLY in BG
|
||||
case HighGuid::Corpse: // remove insignia ONLY in BG
|
||||
{
|
||||
Corpse* bones = ObjectAccessor::GetCorpse(*player, guid);
|
||||
|
||||
@@ -135,7 +135,7 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
|
||||
|
||||
break;
|
||||
}
|
||||
case HIGHGUID_ITEM:
|
||||
case HighGuid::Item:
|
||||
{
|
||||
if (Item* item = player->GetItemByGuid(guid))
|
||||
{
|
||||
@@ -144,8 +144,8 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
|
||||
}
|
||||
break;
|
||||
}
|
||||
case HIGHGUID_UNIT:
|
||||
case HIGHGUID_VEHICLE:
|
||||
case HighGuid::Unit:
|
||||
case HighGuid::Vehicle:
|
||||
{
|
||||
Creature* creature = player->GetMap()->GetCreature(guid);
|
||||
bool lootAllowed = creature && creature->IsAlive() == (player->getClass() == CLASS_ROGUE && creature->loot.loot_type == LOOT_PICKPOCKETING);
|
||||
@@ -210,11 +210,11 @@ void WorldSession::HandleLootMoneyOpcode(WorldPacket& /*recvData*/)
|
||||
loot->gold = 0;
|
||||
|
||||
// Delete the money loot record from the DB
|
||||
if (loot->containerId > 0)
|
||||
sLootItemStorage->RemoveStoredLootMoney(loot->containerId, loot);
|
||||
if (loot->containerGUID)
|
||||
sLootItemStorage->RemoveStoredLootMoney(loot->containerGUID, loot);
|
||||
|
||||
// Delete container if empty
|
||||
if (loot->isLooted() && IS_ITEM_GUID(guid))
|
||||
if (loot->isLooted() && guid.IsItem())
|
||||
DoLootRelease(guid);
|
||||
}
|
||||
}
|
||||
@@ -225,11 +225,11 @@ void WorldSession::HandleLootOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_LOOT");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
// Check possible cheat
|
||||
if (!GetPlayer()->IsAlive() || !IS_CRE_OR_VEH_GUID(guid))
|
||||
if (!GetPlayer()->IsAlive() || !guid.IsCreatureOrVehicle())
|
||||
return;
|
||||
|
||||
GetPlayer()->SendLoot(guid, LOOT_CORPSE);
|
||||
@@ -247,20 +247,20 @@ void WorldSession::HandleLootReleaseOpcode(WorldPacket& recvData)
|
||||
|
||||
// cheaters can modify lguid to prevent correct apply loot release code and re-loot
|
||||
// use internal stored guid
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
if (uint64 lguid = GetPlayer()->GetLootGUID())
|
||||
if (ObjectGuid lguid = GetPlayer()->GetLootGUID())
|
||||
if (lguid == guid)
|
||||
DoLootRelease(lguid);
|
||||
}
|
||||
|
||||
void WorldSession::DoLootRelease(uint64 lguid)
|
||||
void WorldSession::DoLootRelease(ObjectGuid lguid)
|
||||
{
|
||||
Player* player = GetPlayer();
|
||||
Loot* loot;
|
||||
|
||||
player->SetLootGUID(0);
|
||||
player->SetLootGUID(ObjectGuid::Empty);
|
||||
player->SendLootRelease(lguid);
|
||||
|
||||
player->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_LOOTING);
|
||||
@@ -268,7 +268,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
if (!player->IsInWorld())
|
||||
return;
|
||||
|
||||
if (IS_GAMEOBJECT_GUID(lguid))
|
||||
if (lguid.IsGameObject())
|
||||
{
|
||||
GameObject* go = GetPlayer()->GetMap()->GetGameObject(lguid);
|
||||
|
||||
@@ -304,7 +304,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
if (go->GetGoType() == GAMEOBJECT_TYPE_CHEST && go->GetGOInfo()->chest.eventId)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("spells.aura", "Chest ScriptStart id %u for GO %u", go->GetGOInfo()->chest.eventId, go->GetDBTableGUIDLow());
|
||||
LOG_DEBUG("spells.aura", "Chest ScriptStart id %u for GO %u", go->GetGOInfo()->chest.eventId, go->GetSpawnId());
|
||||
#endif
|
||||
player->GetMap()->ScriptsStart(sEventScripts, go->GetGOInfo()->chest.eventId, player, go);
|
||||
}
|
||||
@@ -319,10 +319,10 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
|
||||
// if the round robin player release, reset it.
|
||||
if (player->GetGUID() == loot->roundRobinPlayer)
|
||||
loot->roundRobinPlayer = 0;
|
||||
loot->roundRobinPlayer.Clear();
|
||||
}
|
||||
}
|
||||
else if (IS_CORPSE_GUID(lguid)) // ONLY remove insignia at BG
|
||||
else if (lguid.IsCorpse()) // ONLY remove insignia at BG
|
||||
{
|
||||
Corpse* corpse = ObjectAccessor::GetCorpse(*player, lguid);
|
||||
if (!corpse || !corpse->IsWithinDistInMap(_player, INTERACTION_DISTANCE))
|
||||
@@ -337,7 +337,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
corpse->RemoveFlag(CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_DYNFLAG_LOOTABLE);
|
||||
}
|
||||
}
|
||||
else if (IS_ITEM_GUID(lguid))
|
||||
else if (lguid.IsItem())
|
||||
{
|
||||
Item* pItem = player->GetItemByGuid(lguid);
|
||||
if (!pItem)
|
||||
@@ -389,7 +389,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
// if the round robin player release, reset it.
|
||||
if (player->GetGUID() == loot->roundRobinPlayer)
|
||||
{
|
||||
loot->roundRobinPlayer = 0;
|
||||
loot->roundRobinPlayer.Clear();
|
||||
|
||||
if (Group* group = player->GetGroup())
|
||||
group->SendLooter(creature, nullptr);
|
||||
@@ -406,7 +406,7 @@ void WorldSession::DoLootRelease(uint64 lguid)
|
||||
void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint8 slotid;
|
||||
uint64 lootguid, target_playerguid;
|
||||
ObjectGuid lootguid, target_playerguid;
|
||||
|
||||
recvData >> lootguid >> slotid >> target_playerguid;
|
||||
|
||||
@@ -416,7 +416,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* target = ObjectAccessor::GetPlayer(*_player, MAKE_NEW_GUID(target_playerguid, 0, HIGHGUID_PLAYER));
|
||||
Player* target = ObjectAccessor::GetPlayer(*_player, target_playerguid);
|
||||
if (!target)
|
||||
{
|
||||
_player->SendLootError(lootguid, LOOT_ERROR_PLAYER_NOT_FOUND);
|
||||
@@ -442,7 +442,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
|
||||
|
||||
Loot* loot = nullptr;
|
||||
|
||||
if (IS_CRE_OR_VEH_GUID(GetPlayer()->GetLootGUID()))
|
||||
if (GetPlayer()->GetLootGUID().IsCreatureOrVehicle())
|
||||
{
|
||||
Creature* creature = GetPlayer()->GetMap()->GetCreature(lootguid);
|
||||
if (!creature)
|
||||
@@ -450,7 +450,7 @@ void WorldSession::HandleLootMasterGiveOpcode(WorldPacket& recvData)
|
||||
|
||||
loot = &creature->loot;
|
||||
}
|
||||
else if (IS_GAMEOBJECT_GUID(GetPlayer()->GetLootGUID()))
|
||||
else if (GetPlayer()->GetLootGUID().IsGameObject())
|
||||
{
|
||||
GameObject* pGO = GetPlayer()->GetMap()->GetGameObject(lootguid);
|
||||
if (!pGO)
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
#define MAX_INBOX_CLIENT_CAPACITY 50
|
||||
|
||||
bool WorldSession::CanOpenMailBox(uint64 guid)
|
||||
bool WorldSession::CanOpenMailBox(ObjectGuid guid)
|
||||
{
|
||||
if (guid == _player->GetGUID())
|
||||
{
|
||||
@@ -31,12 +31,12 @@ bool WorldSession::CanOpenMailBox(uint64 guid)
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else if (IS_GAMEOBJECT_GUID(guid))
|
||||
else if (guid.IsGameObject())
|
||||
{
|
||||
if (!_player->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX))
|
||||
return false;
|
||||
}
|
||||
else if (IS_CRE_OR_VEH_OR_PET_GUID(guid))
|
||||
else if (guid.IsAnyTypeCreature())
|
||||
{
|
||||
if (!_player->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_MAILBOX))
|
||||
return false;
|
||||
@@ -49,7 +49,8 @@ bool WorldSession::CanOpenMailBox(uint64 guid)
|
||||
|
||||
void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox, unk3;
|
||||
ObjectGuid mailbox;
|
||||
uint64 unk3;
|
||||
std::string receiver, subject, body;
|
||||
uint32 unk1, unk2, money, COD;
|
||||
uint8 unk4;
|
||||
@@ -80,7 +81,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 itemGUIDs[MAX_MAIL_ITEMS];
|
||||
ObjectGuid itemGUIDs[MAX_MAIL_ITEMS];
|
||||
|
||||
for (uint8 i = 0; i < items_count; ++i)
|
||||
{
|
||||
@@ -108,21 +109,23 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 rc = 0;
|
||||
ObjectGuid rc;
|
||||
if (normalizePlayerName(receiver))
|
||||
rc = sObjectMgr->GetPlayerGUIDByName(receiver);
|
||||
|
||||
if (!rc)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player %u is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
LOG_DEBUG("server", "Player %s is sending mail to %s (GUID: not existed!) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
|
||||
player->GetGUID().ToString().c_str(), receiver.c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
#endif
|
||||
player->SendMailResult(0, MAIL_SEND, MAIL_ERR_RECIPIENT_NOT_FOUND);
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player %u is sending mail to %s (GUID: %u) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u", player->GetGUIDLow(), receiver.c_str(), GUID_LOPART(rc), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
LOG_DEBUG("server", "Player %s is sending mail to %s (%s) with subject %s and body %s includes %u items, %u copper and %u COD copper with unk1 = %u, unk2 = %u",
|
||||
player->GetGUID().ToString().c_str(), receiver.c_str(), rc.ToString().c_str(), subject.c_str(), body.c_str(), items_count, money, COD, unk1, unk2);
|
||||
#endif
|
||||
|
||||
if (player->GetGUID() == rc)
|
||||
@@ -155,7 +158,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* receive = ObjectAccessor::FindPlayerInOrOutOfWorld(rc);
|
||||
Player* receive = ObjectAccessor::FindConnectedPlayer(rc);
|
||||
|
||||
uint32 rc_teamId = TEAM_NEUTRAL;
|
||||
uint16 mails_count = 0; //do not allow to send to one player more than 100 mails
|
||||
@@ -168,7 +171,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
else
|
||||
{
|
||||
// xinef: get data from global storage
|
||||
if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(rc)))
|
||||
if (GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(rc.GetCounter()))
|
||||
{
|
||||
rc_teamId = Player::TeamIdForRace(playerData->race);
|
||||
mails_count = playerData->mailCount;
|
||||
@@ -197,7 +200,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
}
|
||||
}*/
|
||||
|
||||
uint32 rc_account = receive ? receive->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(rc);
|
||||
uint32 rc_account = receive ? receive->GetSession()->GetAccountId() : sObjectMgr->GetPlayerAccountIdByGUID(rc.GetCounter());
|
||||
|
||||
if (/*!accountBound*/ GetAccountId() != rc_account && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_MAIL) && player->GetTeamId() != rc_teamId && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
{
|
||||
@@ -298,7 +301,8 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
if( money >= 10 * GOLD )
|
||||
{
|
||||
CleanStringForMysqlQuery(subject);
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<MAIL> %s\", NOW())", GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), rc_account, receiver.c_str(), money, subject.c_str());
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<MAIL> %s\", NOW())",
|
||||
GetAccountId(), player->GetGUID().GetCounter(), player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), rc_account, receiver.c_str(), money, subject.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +317,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
draft
|
||||
.AddMoney(money)
|
||||
.AddCOD(COD)
|
||||
.SendMailTo(trans, MailReceiver(receive, GUID_LOPART(rc)), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
.SendMailTo(trans, MailReceiver(receive, rc.GetCounter()), MailSender(player), body.empty() ? MAIL_CHECK_MASK_COPIED : MAIL_CHECK_MASK_HAS_BODY, deliver_delay);
|
||||
|
||||
player->SaveInventoryAndGoldToDB(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
@@ -322,7 +326,7 @@ void WorldSession::HandleSendMail(WorldPacket& recvData)
|
||||
//called when mail is read
|
||||
void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
ObjectGuid mailbox;
|
||||
uint32 mailId;
|
||||
recvData >> mailbox;
|
||||
recvData >> mailId;
|
||||
@@ -345,7 +349,7 @@ void WorldSession::HandleMailMarkAsRead(WorldPacket& recvData)
|
||||
//called when client deletes mail
|
||||
void WorldSession::HandleMailDelete(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
ObjectGuid mailbox;
|
||||
uint32 mailId;
|
||||
recvData >> mailbox;
|
||||
recvData >> mailId;
|
||||
@@ -368,14 +372,14 @@ void WorldSession::HandleMailDelete(WorldPacket& recvData)
|
||||
|
||||
m->state = MAIL_STATE_DELETED;
|
||||
// xinef: update global data
|
||||
sWorld->UpdateGlobalPlayerMails(player->GetGUIDLow(), -1);
|
||||
sWorld->UpdateGlobalPlayerMails(player->GetGUID().GetCounter(), -1);
|
||||
}
|
||||
player->SendMailResult(mailId, MAIL_DELETED, MAIL_OK);
|
||||
}
|
||||
|
||||
void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
ObjectGuid mailbox;
|
||||
uint32 mailId;
|
||||
recvData >> mailbox;
|
||||
recvData >> mailId;
|
||||
@@ -432,18 +436,18 @@ void WorldSession::HandleMailReturnToSender(WorldPacket& recvData)
|
||||
player->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, MAIL_OK);
|
||||
|
||||
// xinef: update global data
|
||||
sWorld->UpdateGlobalPlayerMails(player->GetGUIDLow(), -1);
|
||||
sWorld->UpdateGlobalPlayerMails(player->GetGUID().GetCounter(), -1);
|
||||
}
|
||||
|
||||
//called when player takes item attached in mail
|
||||
void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
ObjectGuid mailbox;
|
||||
uint32 mailId;
|
||||
uint32 itemId;
|
||||
uint32 itemLowGuid;
|
||||
recvData >> mailbox;
|
||||
recvData >> mailId;
|
||||
recvData >> itemId; // item guid low
|
||||
recvData >> itemLowGuid; // item guid low
|
||||
|
||||
if (!CanOpenMailBox(mailbox))
|
||||
return;
|
||||
@@ -460,7 +464,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
// verify that the mail has the item to avoid cheaters taking COD items without paying
|
||||
bool foundItem = false;
|
||||
for (std::vector<MailItemInfo>::const_iterator itr = m->items.begin(); itr != m->items.end(); ++itr)
|
||||
if (itr->item_guid == itemId)
|
||||
if (itr->item_guid == itemLowGuid)
|
||||
{
|
||||
foundItem = true;
|
||||
break;
|
||||
@@ -478,25 +482,24 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
Item* it = player->GetMItem(itemId);
|
||||
Item* it = player->GetMItem(itemLowGuid);
|
||||
|
||||
ItemPosCountVec dest;
|
||||
uint8 msg = _player->CanStoreItem(NULL_BAG, NULL_SLOT, dest, it, false);
|
||||
if (msg == EQUIP_ERR_OK)
|
||||
{
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
m->RemoveItem(itemId);
|
||||
m->removedItems.push_back(itemId);
|
||||
m->RemoveItem(itemLowGuid);
|
||||
m->removedItems.push_back(itemLowGuid);
|
||||
|
||||
if (m->COD > 0) // if there is COD, take COD money from player and send them to sender by mail
|
||||
{
|
||||
uint64 sender_guid = MAKE_NEW_GUID(m->sender, 0, HIGHGUID_PLAYER);
|
||||
uint32 sender_accId = 0;
|
||||
Player* sender = ObjectAccessor::FindPlayerInOrOutOfWorld(sender_guid);
|
||||
Player* sender = ObjectAccessor::FindPlayerByLowGUID(m->sender);
|
||||
if (sender)
|
||||
sender_accId = sender->GetSession()->GetAccountId();
|
||||
else
|
||||
sender_accId = sObjectMgr->GetPlayerAccountIdByGUID(sender_guid);
|
||||
sender_accId = sObjectMgr->GetPlayerAccountIdByGUID(m->sender);
|
||||
|
||||
// check player existence
|
||||
if (sender || sender_accId)
|
||||
@@ -508,11 +511,12 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
if( m->COD >= 10 * GOLD )
|
||||
{
|
||||
std::string senderName;
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(sender_guid, senderName))
|
||||
if (!sObjectMgr->GetPlayerNameByGUID(m->sender, senderName))
|
||||
senderName = sObjectMgr->GetAcoreStringForDBCLocale(LANG_UNKNOWN);
|
||||
std::string subj = m->subject;
|
||||
CleanStringForMysqlQuery(subj);
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<COD> %s\", NOW())", GetAccountId(), player->GetGUIDLow(), player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), sender_accId, senderName.c_str(), m->COD, subj.c_str());
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<COD> %s\", NOW())",
|
||||
GetAccountId(), player->GetGUID().GetCounter(), player->GetName().c_str(), player->GetSession()->GetRemoteAddress().c_str(), sender_accId, senderName.c_str(), m->COD, subj.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -522,7 +526,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
m->COD = 0;
|
||||
m->state = MAIL_STATE_CHANGED;
|
||||
player->m_mailsUpdated = true;
|
||||
player->RemoveMItem(it->GetGUIDLow());
|
||||
player->RemoveMItem(it->GetGUID().GetCounter());
|
||||
|
||||
uint32 count = it->GetCount(); // save counts before store and possible merge with deleting
|
||||
it->SetState(ITEM_UNCHANGED); // need to set this state, otherwise item cannot be removed later, if neccessary
|
||||
@@ -532,7 +536,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
player->_SaveMail(trans);
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_OK, 0, itemId, count);
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_OK, 0, itemLowGuid, count);
|
||||
}
|
||||
else
|
||||
player->SendMailResult(mailId, MAIL_ITEM_TAKEN, MAIL_ERR_EQUIP_ERROR, msg);
|
||||
@@ -540,7 +544,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
ObjectGuid mailbox;
|
||||
uint32 mailId;
|
||||
recvData >> mailbox;
|
||||
recvData >> mailId;
|
||||
@@ -579,7 +583,7 @@ void WorldSession::HandleMailTakeMoney(WorldPacket& recvData)
|
||||
//called when player lists his received mails
|
||||
void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
ObjectGuid mailbox;
|
||||
recvData >> mailbox;
|
||||
|
||||
if (!CanOpenMailBox(mailbox))
|
||||
@@ -623,7 +627,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
switch ((*itr)->messageType)
|
||||
{
|
||||
case MAIL_NORMAL: // sender guid
|
||||
data << uint64(MAKE_NEW_GUID((*itr)->sender, 0, HIGHGUID_PLAYER));
|
||||
data << ObjectGuid::Create<HighGuid::Player>((*itr)->sender);
|
||||
break;
|
||||
case MAIL_CREATURE:
|
||||
case MAIL_GAMEOBJECT:
|
||||
@@ -663,7 +667,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
// item index (0-6?)
|
||||
data << uint8(i);
|
||||
// item guid low?
|
||||
data << uint32((item ? item->GetGUIDLow() : 0));
|
||||
data << uint32((item ? item->GetGUID().GetCounter() : 0));
|
||||
// entry
|
||||
data << uint32((item ? item->GetEntry() : 0));
|
||||
for (uint8 j = 0; j < MAX_INSPECTED_ENCHANTMENT_SLOT; ++j)
|
||||
@@ -702,7 +706,7 @@ void WorldSession::HandleGetMailList(WorldPacket& recvData)
|
||||
//used when player copies mail body to his inventory
|
||||
void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
|
||||
{
|
||||
uint64 mailbox;
|
||||
ObjectGuid mailbox;
|
||||
uint32 mailId;
|
||||
|
||||
recvData >> mailbox;
|
||||
@@ -721,7 +725,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
Item* bodyItem = new Item; // This is not bag and then can be used new Item.
|
||||
if (!bodyItem->Create(sObjectMgr->GenerateLowGuid(HIGHGUID_ITEM), MAIL_BODY_ITEM_TEMPLATE, player))
|
||||
if (!bodyItem->Create(sObjectMgr->GetGenerator<HighGuid::Item>().Generate(), MAIL_BODY_ITEM_TEMPLATE, player))
|
||||
{
|
||||
delete bodyItem;
|
||||
return;
|
||||
@@ -798,7 +802,7 @@ void WorldSession::HandleQueryNextMailTime(WorldPacket& /*recvData*/)
|
||||
if (sentSenders.count(m->sender))
|
||||
continue;
|
||||
|
||||
data << uint64(m->messageType == MAIL_NORMAL ? m->sender : 0); // player guid
|
||||
data << (m->messageType == MAIL_NORMAL ? ObjectGuid::Create<HighGuid::Player>(m->sender) : ObjectGuid::Empty); // player guid
|
||||
data << uint32(m->messageType != MAIL_NORMAL ? m->sender : 0); // non-player entries
|
||||
data << uint32(m->messageType);
|
||||
data << uint32(m->stationery);
|
||||
|
||||
@@ -68,7 +68,8 @@ void WorldSession::HandleRepopRequestOpcode(WorldPacket& recv_data)
|
||||
if (GetPlayer()->getDeathState() == JUST_DIED)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "HandleRepopRequestOpcode: got request after player %s(%d) was killed and before he was updated", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||
LOG_DEBUG("network", "HandleRepopRequestOpcode: got request after player %s (%s) was killed and before he was updated",
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
GetPlayer()->KillPlayer();
|
||||
}
|
||||
@@ -91,7 +92,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data)
|
||||
|
||||
uint32 gossipListId;
|
||||
uint32 menuId;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::string code = "";
|
||||
|
||||
recv_data >> guid >> menuId >> gossipListId;
|
||||
@@ -102,29 +103,29 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data)
|
||||
Creature* unit = nullptr;
|
||||
GameObject* go = nullptr;
|
||||
Item* item = nullptr;
|
||||
if (IS_CRE_OR_VEH_GUID(guid))
|
||||
if (guid.IsCreatureOrVehicle())
|
||||
{
|
||||
unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (IS_GAMEOBJECT_GUID(guid))
|
||||
else if (guid.IsGameObject())
|
||||
{
|
||||
go = _player->GetMap()->GetGameObject(guid);
|
||||
if (!go)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - GameObject (GUID: %u) not found.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - GameObject (%s) not found.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (IS_ITEM_GUID(guid))
|
||||
else if (guid.IsItem())
|
||||
{
|
||||
item = _player->GetItemByGuid(guid);
|
||||
if (!item || _player->IsBankPos(item->GetPos()))
|
||||
@@ -133,7 +134,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data)
|
||||
return;
|
||||
}
|
||||
}
|
||||
else if (IS_PLAYER_GUID(guid))
|
||||
else if (guid.IsPlayer())
|
||||
{
|
||||
if (guid != _player->GetGUID() || menuId != _player->PlayerTalkClass->GetGossipMenu().GetMenuId())
|
||||
{
|
||||
@@ -144,7 +145,7 @@ void WorldSession::HandleGossipSelectOptionOpcode(WorldPacket& recv_data)
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for highguid %u. lowpart %u.", uint32(GUID_HIPART(guid)), uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleGossipSelectOptionOpcode - unsupported GUID type for %s.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -292,7 +293,7 @@ void WorldSession::HandleWhoOpcode(WorldPacket& recvData)
|
||||
data << uint32(displaycount); // placeholder, count of players displayed
|
||||
|
||||
std::shared_lock<std::shared_mutex> lock(*HashMapHolder<Player>::GetLock());
|
||||
HashMapHolder<Player>::MapType const& m = sObjectAccessor->GetPlayers();
|
||||
HashMapHolder<Player>::MapType const& m = ObjectAccessor::GetPlayers();
|
||||
for (HashMapHolder<Player>::MapType::const_iterator itr = m.begin(); itr != m.end(); ++itr)
|
||||
{
|
||||
if (AccountMgr::IsPlayerAccount(security))
|
||||
@@ -415,7 +416,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recv_data*/)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_LOGOUT_REQUEST Message, security - %u", GetSecurity());
|
||||
#endif
|
||||
|
||||
if (uint64 lguid = GetPlayer()->GetLootGUID())
|
||||
if (ObjectGuid lguid = GetPlayer()->GetLootGUID())
|
||||
DoLootRelease(lguid);
|
||||
|
||||
bool instantLogout = ((GetSecurity() >= 0 && uint32(GetSecurity()) >= sWorld->getIntConfig(CONFIG_INSTANT_LOGOUT))
|
||||
@@ -463,7 +464,7 @@ void WorldSession::HandleLogoutRequestOpcode(WorldPacket& /*recv_data*/)
|
||||
GetPlayer()->SetStandState(UNIT_STAND_STATE_SIT);
|
||||
|
||||
WorldPacket data(SMSG_FORCE_MOVE_ROOT, (8 + 4)); // guess size
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data << GetPlayer()->GetPackGUID();
|
||||
data << (uint32)2;
|
||||
SendPacket(&data);
|
||||
GetPlayer()->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_STUNNED);
|
||||
@@ -490,7 +491,7 @@ void WorldSession::HandleLogoutCancelOpcode(WorldPacket& /*recv_data*/)
|
||||
if (GetPlayer()->CanFreeMove())
|
||||
{
|
||||
data.Initialize(SMSG_FORCE_MOVE_UNROOT, 9 + 4);
|
||||
data.append(GetPlayer()->GetPackGUID());
|
||||
data << GetPlayer()->GetPackGUID();
|
||||
data << uint32(0);
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -538,7 +539,7 @@ void WorldSession::HandleZoneUpdateOpcode(WorldPacket& recv_data)
|
||||
|
||||
void WorldSession::HandleSetSelectionOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
_player->SetSelection(guid);
|
||||
@@ -633,7 +634,7 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_RECLAIM_CORPSE");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
if (_player->IsAlive())
|
||||
@@ -648,7 +649,6 @@ void WorldSession::HandleReclaimCorpseOpcode(WorldPacket& recv_data)
|
||||
return;
|
||||
|
||||
Corpse* corpse = _player->GetCorpse();
|
||||
|
||||
if (!corpse)
|
||||
return;
|
||||
|
||||
@@ -672,7 +672,7 @@ void WorldSession::HandleResurrectResponseOpcode(WorldPacket& recv_data)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_RESURRECT_RESPONSE");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint8 status;
|
||||
recv_data >> guid;
|
||||
recv_data >> status;
|
||||
@@ -723,8 +723,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
if (player->IsInFlight())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) in flight, ignore Area Trigger ID:%u",
|
||||
player->GetName().c_str(), player->GetGUIDLow(), triggerId);
|
||||
LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (%s) in flight, ignore Area Trigger ID:%u",
|
||||
player->GetName().c_str(), player->GetGUID().ToString().c_str(), triggerId);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -733,8 +733,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
if (!atEntry)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) send unknown (by DBC) Area Trigger ID:%u",
|
||||
player->GetName().c_str(), player->GetGUIDLow(), triggerId);
|
||||
LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (%s) send unknown (by DBC) Area Trigger ID:%u",
|
||||
player->GetName().c_str(), player->GetGUID().ToString().c_str(), triggerId);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -742,8 +742,8 @@ void WorldSession::HandleAreaTriggerOpcode(WorldPacket& recv_data)
|
||||
if (!player->IsInAreaTriggerRadius(atEntry))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player '%s' (GUID: %u) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
|
||||
player->GetName().c_str(), atEntry->map, player->GetMapId(), player->GetGUIDLow(), triggerId);
|
||||
LOG_DEBUG("network", "HandleAreaTriggerOpcode: Player %s (%s) too far (trigger map: %u player map: %u), ignore Area Trigger ID: %u",
|
||||
player->GetName().c_str(), player->GetGUID().ToString().c_str(), atEntry->map, player->GetMapId(), triggerId);
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -895,11 +895,11 @@ void WorldSession::HandleRequestAccountData(WorldPacket& recv_data)
|
||||
dest.resize(destSize);
|
||||
|
||||
WorldPacket data(SMSG_UPDATE_ACCOUNT_DATA, 8 + 4 + 4 + 4 + destSize);
|
||||
data << uint64(_player ? _player->GetGUID() : 0); // player guid
|
||||
data << uint32(type); // type (0-7)
|
||||
data << uint32(adata->Time); // unix time
|
||||
data << uint32(size); // decompressed length
|
||||
data.append(dest); // compressed data
|
||||
data << (_player ? _player->GetGUID() : ObjectGuid::Empty); // player guid
|
||||
data << uint32(type); // type (0-7)
|
||||
data << uint32(adata->Time); // unix time
|
||||
data << uint32(size); // decompressed length
|
||||
data.append(dest); // compressed data
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -951,7 +951,8 @@ void WorldSession::HandleSetActionButtonOpcode(WorldPacket& recv_data)
|
||||
#endif
|
||||
break;
|
||||
default:
|
||||
LOG_ERROR("server", "MISC: Unknown action button type %u for action %u into button %u for player %s (GUID: %u)", type, action, button, _player->GetName().c_str(), _player->GetGUIDLow());
|
||||
LOG_ERROR("server", "MISC: Unknown action button type %u for action %u into button %u for player %s (%s)",
|
||||
type, action, button, _player->GetName().c_str(), _player->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
GetPlayer()->addActionButton(button, action, type);
|
||||
@@ -995,7 +996,7 @@ void WorldSession::HandleMoveUnRootAck(WorldPacket& recv_data)
|
||||
// no used
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
/*
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
// now can skip not our packet
|
||||
@@ -1023,7 +1024,7 @@ void WorldSession::HandleMoveRootAck(WorldPacket& recv_data)
|
||||
// no used
|
||||
recv_data.rfinish(); // prevent warnings spam
|
||||
/*
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
// now can skip not our packet
|
||||
@@ -1074,7 +1075,7 @@ void WorldSession::HandlePlayedTime(WorldPacket& recv_data)
|
||||
|
||||
void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
@@ -1085,15 +1086,15 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
|
||||
if (!player)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_INSPECT: No player found from GUID: " UI64FMTD, guid);
|
||||
LOG_DEBUG("network", "CMSG_INSPECT: No player found from %s", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 talent_points = 0x47;
|
||||
uint32 guid_size = player->GetPackGUID().wpos();
|
||||
uint32 guid_size = player->GetPackGUID().size();
|
||||
WorldPacket data(SMSG_INSPECT_TALENT, guid_size + 4 + talent_points);
|
||||
data.append(player->GetPackGUID());
|
||||
data << player->GetPackGUID();
|
||||
|
||||
if (sWorld->getBoolConfig(CONFIG_TALENTS_INSPECTING) || _player->IsGameMaster())
|
||||
{
|
||||
@@ -1112,20 +1113,20 @@ void WorldSession::HandleInspectOpcode(WorldPacket& recv_data)
|
||||
|
||||
void WorldSession::HandleInspectHonorStatsOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Player* player = ObjectAccessor::GetPlayer(*_player, guid);
|
||||
if (!player)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "MSG_INSPECT_HONOR_STATS: No player found from GUID: " UI64FMTD, guid);
|
||||
LOG_DEBUG("network", "MSG_INSPECT_HONOR_STATS: No player found from %s", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
WorldPacket data(MSG_INSPECT_HONOR_STATS, 8 + 1 + 4 * 4);
|
||||
data << uint64(player->GetGUID());
|
||||
data << player->GetGUID();
|
||||
data << uint8(player->GetHonorPoints());
|
||||
data << uint32(player->GetUInt32Value(PLAYER_FIELD_KILLS));
|
||||
data << uint32(player->GetUInt32Value(PLAYER_FIELD_TODAY_CONTRIBUTION));
|
||||
@@ -1157,7 +1158,7 @@ void WorldSession::HandleWorldTeleportOpcode(WorldPacket& recv_data)
|
||||
if (GetPlayer()->IsInFlight())
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Player '%s' (GUID: %u) in flight, ignore worldport command.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow());
|
||||
LOG_DEBUG("network", "Player '%s' (%s) in flight, ignore worldport command.", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -1243,7 +1244,7 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recv_data)
|
||||
#endif
|
||||
|
||||
uint8 spam_type; // 0 - mail, 1 - chat
|
||||
uint64 spammer_guid;
|
||||
ObjectGuid spammer_guid;
|
||||
uint32 unk1 = 0;
|
||||
uint32 unk2 = 0;
|
||||
uint32 unk3 = 0;
|
||||
@@ -1276,7 +1277,8 @@ void WorldSession::HandleComplainOpcode(WorldPacket& recv_data)
|
||||
SendPacket(&data);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "REPORT SPAM: type %u, guid %u, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s", spam_type, GUID_LOPART(spammer_guid), unk1, unk2, unk3, unk4, description.c_str());
|
||||
LOG_DEBUG("network", "REPORT SPAM: type %u, %s, unk1 %u, unk2 %u, unk3 %u, unk4 %u, message %s",
|
||||
spam_type, spammer_guid.ToString().c_str(), unk1, unk2, unk3, unk4, description.c_str());
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -1313,21 +1315,21 @@ void WorldSession::HandleFarSightOpcode(WorldPacket& recvData)
|
||||
if (apply)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Added FarSight " UI64FMTD " to player %u", _player->GetUInt64Value(PLAYER_FARSIGHT), _player->GetGUIDLow());
|
||||
LOG_DEBUG("network", "Added FarSight %s to player %s", _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str(), _player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
if (WorldObject* target = _player->GetViewpoint())
|
||||
_player->SetSeer(target);
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_ERROR("server", "Player %s requests non-existing seer " UI64FMTD, _player->GetName().c_str(), _player->GetUInt64Value(PLAYER_FARSIGHT));
|
||||
LOG_ERROR("server", "Player %s requests non-existing seer %s", _player->GetName().c_str(), _player->GetGuidValue(PLAYER_FARSIGHT).ToString().c_str());
|
||||
#endif
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Player %u set vision to self", _player->GetGUIDLow());
|
||||
LOG_DEBUG("network", "Player %s set vision to self", _player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
_player->SetSeer(_player);
|
||||
}
|
||||
@@ -1368,7 +1370,7 @@ void WorldSession::HandleResetInstancesOpcode(WorldPacket& /*recv_data*/)
|
||||
group->ResetInstances(INSTANCE_RESET_ALL, false, _player);
|
||||
}
|
||||
else
|
||||
Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_ALL, false);
|
||||
Player::ResetInstances(_player->GetGUID(), INSTANCE_RESET_ALL, false);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recv_data)
|
||||
@@ -1421,7 +1423,7 @@ void WorldSession::HandleSetDungeonDifficultyOpcode(WorldPacket& recv_data)
|
||||
_player->SendDungeonDifficulty(group != nullptr);
|
||||
return;
|
||||
}
|
||||
Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_CHANGE_DIFFICULTY, false);
|
||||
Player::ResetInstances(_player->GetGUID(), INSTANCE_RESET_CHANGE_DIFFICULTY, false);
|
||||
_player->SetDungeonDifficulty(Difficulty(mode));
|
||||
}
|
||||
}
|
||||
@@ -1583,7 +1585,7 @@ void WorldSession::HandleSetRaidDifficultyOpcode(WorldPacket& recv_data)
|
||||
_player->SendRaidDifficulty(group != nullptr);
|
||||
return;
|
||||
}
|
||||
Player::ResetInstances(_player->GetGUIDLow(), INSTANCE_RESET_CHANGE_DIFFICULTY, true);
|
||||
Player::ResetInstances(_player->GetGUID(), INSTANCE_RESET_CHANGE_DIFFICULTY, true);
|
||||
_player->SetRaidDifficulty(Difficulty(mode));
|
||||
}
|
||||
}
|
||||
@@ -1618,8 +1620,8 @@ void WorldSession::HandleMoveSetCanFlyAckOpcode(WorldPacket& recv_data)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_MOVE_SET_CAN_FLY_ACK");
|
||||
#endif
|
||||
|
||||
uint64 guid; // guid - unused
|
||||
recv_data.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid.ReadAsPacked();
|
||||
|
||||
// pussywizard: typical check for incomming movement packets
|
||||
if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID())
|
||||
@@ -1668,8 +1670,8 @@ void WorldSession::HandleSetTaxiBenchmarkOpcode(WorldPacket& recv_data)
|
||||
|
||||
void WorldSession::HandleQueryInspectAchievements(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
recv_data.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid.ReadAsPacked();
|
||||
|
||||
Player* player = ObjectAccessor::GetPlayer(*_player, guid);
|
||||
if (!player)
|
||||
@@ -1716,7 +1718,7 @@ void WorldSession::HandleAreaSpiritHealerQueryOpcode(WorldPacket& recv_data)
|
||||
|
||||
Battleground* bg = _player->GetBattleground();
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
@@ -1741,7 +1743,7 @@ void WorldSession::HandleAreaSpiritHealerQueueOpcode(WorldPacket& recv_data)
|
||||
|
||||
Battleground* bg = _player->GetBattleground();
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recv_data >> guid;
|
||||
|
||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
@@ -1787,7 +1789,8 @@ void WorldSession::HandleInstanceLockResponse(WorldPacket& recvPacket)
|
||||
if (!_player->HasPendingBind() || _player->GetPendingBind() != _player->GetInstanceId() || (_player->GetGroup() && _player->GetGroup()->isLFGGroup() && _player->GetGroup()->IsLfgRandomInstance()))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "InstanceLockResponse: Player %s (guid %u) tried to bind himself/teleport to graveyard without a pending bind!", _player->GetName().c_str(), _player->GetGUIDLow());
|
||||
LOG_DEBUG("server", "InstanceLockResponse: Player %s (%s) tried to bind himself/teleport to graveyard without a pending bind!",
|
||||
_player->GetName().c_str(), _player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -1806,7 +1809,7 @@ void WorldSession::HandleUpdateMissileTrajectory(WorldPacket& recvPacket)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_UPDATE_MISSILE_TRAJECTORY");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 spellId;
|
||||
float elevation, speed;
|
||||
float curX, curY, curZ;
|
||||
|
||||
@@ -71,8 +71,8 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
{
|
||||
GetPlayer()->m_InstanceValid = true;
|
||||
// pussywizard: m_InstanceValid can be false only by leaving a group in an instance => so remove temp binds that could not be removed because player was still on the map!
|
||||
if (!sInstanceSaveMgr->PlayerIsPermBoundToInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty()))
|
||||
sInstanceSaveMgr->PlayerUnbindInstance(GetPlayer()->GetGUIDLow(), oldMap->GetId(), oldMap->GetDifficulty(), true);
|
||||
if (!sInstanceSaveMgr->PlayerIsPermBoundToInstance(GetPlayer()->GetGUID(), oldMap->GetId(), oldMap->GetDifficulty()))
|
||||
sInstanceSaveMgr->PlayerUnbindInstance(GetPlayer()->GetGUID(), oldMap->GetId(), oldMap->GetDifficulty(), true);
|
||||
}
|
||||
|
||||
// relocate the player to the teleport destination
|
||||
@@ -81,7 +81,7 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
// while the player is in transit, for example the map may get full
|
||||
if (!newMap || !newMap->CanEnter(GetPlayer(), false))
|
||||
{
|
||||
LOG_ERROR("server", "Map %d could not be created for player %d, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUIDLow());
|
||||
LOG_ERROR("server", "Map %d could not be created for player %s, porting player to homebind", loc.GetMapId(), GetPlayer()->GetGUID().ToString().c_str());
|
||||
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
|
||||
return;
|
||||
}
|
||||
@@ -95,7 +95,8 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
GetPlayer()->SendInitialPacketsBeforeAddToMap();
|
||||
if (!GetPlayer()->GetMap()->AddPlayerToMap(GetPlayer()))
|
||||
{
|
||||
LOG_ERROR("server", "WORLD: failed to teleport player %s (%d) to map %d because of unknown reason!", GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), loc.GetMapId());
|
||||
LOG_ERROR("server", "WORLD: failed to teleport player %s (%s) to map %d because of unknown reason!",
|
||||
GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str(), loc.GetMapId());
|
||||
GetPlayer()->ResetMap();
|
||||
GetPlayer()->SetMap(oldMap);
|
||||
GetPlayer()->TeleportTo(GetPlayer()->m_homebindMapId, GetPlayer()->m_homebindX, GetPlayer()->m_homebindY, GetPlayer()->m_homebindZ, GetPlayer()->GetOrientation());
|
||||
@@ -177,8 +178,8 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
||||
GetPlayer()->SendInitialPacketsAfterAddToMap();
|
||||
|
||||
// resurrect character at enter into instance where his corpse exist after add to map
|
||||
Corpse* corpse = GetPlayer()->GetCorpse();
|
||||
if (corpse && corpse->GetType() != CORPSE_BONES && corpse->GetMapId() == GetPlayer()->GetMapId())
|
||||
Corpse* corpse = GetPlayer()->GetMap()->GetCorpseByPlayer(GetPlayer()->GetGUID());
|
||||
if (corpse && corpse->GetType() != CORPSE_BONES)
|
||||
{
|
||||
if (mEntry->IsDungeon())
|
||||
{
|
||||
@@ -230,14 +231,14 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "MSG_MOVE_TELEPORT_ACK");
|
||||
#endif
|
||||
uint64 guid;
|
||||
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
uint32 flags, time;
|
||||
recvData >> flags >> time; // unused
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Guid " UI64FMTD, guid);
|
||||
LOG_DEBUG("server", "Guid %s", guid.ToString().c_str());
|
||||
#endif
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Flags %u, time %u", flags, time / IN_MILLISECONDS);
|
||||
@@ -317,9 +318,8 @@ void WorldSession::HandleMovementOpcodes(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
/* extract packet */
|
||||
uint64 guid;
|
||||
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
// prevent tampered movement data
|
||||
if (!guid || guid != mover->GetGUID())
|
||||
@@ -523,11 +523,11 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket& recvData)
|
||||
#endif
|
||||
|
||||
/* extract packet */
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 unk1;
|
||||
float newspeed;
|
||||
|
||||
recvData.readPackGUID(guid);
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
// pussywizard: special check, only player mover allowed here
|
||||
if (guid != _player->m_mover->GetGUID() || guid != _player->GetGUID())
|
||||
@@ -629,13 +629,14 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_SET_ACTIVE_MOVER");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
if (GetPlayer()->IsInWorld() && _player->m_mover && _player->m_mover->IsInWorld())
|
||||
{
|
||||
if (_player->m_mover->GetGUID() != guid)
|
||||
LOG_ERROR("server", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is " UI64FMTD " (%s - Entry: %u) and should be " UI64FMTD, guid, GetLogNameForGuid(guid), GUID_ENPART(guid), _player->m_mover->GetGUID());
|
||||
LOG_ERROR("server", "HandleSetActiveMoverOpcode: incorrect mover guid: mover is %s and should be %s",
|
||||
guid.ToString().c_str(), _player->m_mover->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -645,8 +646,8 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
|
||||
#endif
|
||||
|
||||
uint64 old_mover_guid;
|
||||
recvData.readPackGUID(old_mover_guid);
|
||||
ObjectGuid old_mover_guid;
|
||||
recvData >> old_mover_guid.ReadAsPacked();
|
||||
|
||||
// pussywizard: typical check for incomming movement packets
|
||||
if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || old_mover_guid != _player->m_mover->GetGUID())
|
||||
@@ -665,7 +666,7 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket& recvData)
|
||||
void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvData*/)
|
||||
{
|
||||
WorldPacket data(SMSG_MOUNTSPECIAL_ANIM, 8);
|
||||
data << uint64(GetPlayer()->GetGUID());
|
||||
data << GetPlayer()->GetGUID();
|
||||
|
||||
GetPlayer()->SendMessageToSet(&data, false);
|
||||
}
|
||||
@@ -676,8 +677,8 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "CMSG_MOVE_KNOCK_BACK_ACK");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
// pussywizard: typical check for incomming movement packets
|
||||
if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID())
|
||||
@@ -695,7 +696,7 @@ void WorldSession::HandleMoveKnockBackAck(WorldPacket& recvData)
|
||||
_player->m_mover->m_movementInfo = movementInfo;
|
||||
|
||||
WorldPacket data(MSG_MOVE_KNOCK_BACK, 66);
|
||||
data.appendPackGUID(guid);
|
||||
data << guid.WriteAsPacked();
|
||||
_player->m_mover->BuildMovementPacket(&data);
|
||||
|
||||
// knockback specific info
|
||||
@@ -713,8 +714,8 @@ void WorldSession::HandleMoveHoverAck(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "CMSG_MOVE_HOVER_ACK");
|
||||
#endif
|
||||
|
||||
uint64 guid; // guid - unused
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
recvData.read_skip<uint32>(); // unk
|
||||
|
||||
@@ -731,8 +732,8 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "CMSG_MOVE_WATER_WALK_ACK");
|
||||
#endif
|
||||
|
||||
uint64 guid; // guid - unused
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
recvData.read_skip<uint32>(); // unk
|
||||
|
||||
@@ -748,7 +749,7 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recvData)
|
||||
if (!_player->IsAlive() || _player->IsInCombat())
|
||||
return;
|
||||
|
||||
uint64 summoner_guid;
|
||||
ObjectGuid summoner_guid;
|
||||
bool agree;
|
||||
recvData >> summoner_guid;
|
||||
recvData >> agree;
|
||||
@@ -773,30 +774,30 @@ void WorldSession::HandleMoveTimeSkippedOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_MOVE_TIME_SKIPPED");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 timeSkipped;
|
||||
recvData.readPackGUID(guid);
|
||||
recvData >> guid.ReadAsPacked();
|
||||
recvData >> timeSkipped;
|
||||
|
||||
Unit* mover = GetPlayer()->m_mover;
|
||||
|
||||
if (!mover)
|
||||
{
|
||||
LOG_ERROR("server", "WorldSession::HandleMoveTimeSkippedOpcode wrong mover state from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
LOG_ERROR("server", "WorldSession::HandleMoveTimeSkippedOpcode wrong mover state from the unit moved by the player [%s]", GetPlayer()->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
// prevent tampered movement data
|
||||
if (guid != mover->GetGUID())
|
||||
{
|
||||
LOG_ERROR("server", "WorldSession::HandleMoveTimeSkippedOpcode wrong guid from the unit moved by the player [" UI64FMTD "]", GetPlayer()->GetGUID());
|
||||
LOG_ERROR("server", "WorldSession::HandleMoveTimeSkippedOpcode wrong guid from the unit moved by the player [%s]", GetPlayer()->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
mover->m_movementInfo.time += timeSkipped;
|
||||
|
||||
WorldPacket data(MSG_MOVE_TIME_SKIPPED, recvData.size());
|
||||
data.appendPackGUID(guid);
|
||||
data << guid.WriteAsPacked();
|
||||
data << timeSkipped;
|
||||
GetPlayer()->SendMessageToSet(&data, false);
|
||||
}
|
||||
|
||||
@@ -39,14 +39,14 @@ enum StableResultCode
|
||||
|
||||
void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TABARDDESIGNER);
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleTabardVendorActivateOpcode - Unit (%s) not found or you can not interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -58,7 +58,7 @@ void WorldSession::HandleTabardVendorActivateOpcode(WorldPacket& recvData)
|
||||
SendTabardVendorActivate(guid);
|
||||
}
|
||||
|
||||
void WorldSession::SendTabardVendorActivate(uint64 guid)
|
||||
void WorldSession::SendTabardVendorActivate(ObjectGuid guid)
|
||||
{
|
||||
WorldPacket data(MSG_TABARDVENDOR_ACTIVATE, 8);
|
||||
data << guid;
|
||||
@@ -67,7 +67,7 @@ void WorldSession::SendTabardVendorActivate(uint64 guid)
|
||||
|
||||
void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_BANKER_ACTIVATE");
|
||||
@@ -79,7 +79,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleBankerActivateOpcode - Unit (%s) not found or you can not interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -91,7 +91,7 @@ void WorldSession::HandleBankerActivateOpcode(WorldPacket& recvData)
|
||||
SendShowBank(guid);
|
||||
}
|
||||
|
||||
void WorldSession::SendShowBank(uint64 guid)
|
||||
void WorldSession::SendShowBank(ObjectGuid guid)
|
||||
{
|
||||
WorldPacket data(SMSG_SHOW_BANK, 8);
|
||||
data << guid;
|
||||
@@ -99,7 +99,7 @@ void WorldSession::SendShowBank(uint64 guid)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
void WorldSession::SendShowMailBox(uint64 guid)
|
||||
void WorldSession::SendShowMailBox(ObjectGuid guid)
|
||||
{
|
||||
WorldPacket data(SMSG_SHOW_MAILBOX, 8);
|
||||
data << guid;
|
||||
@@ -108,19 +108,19 @@ void WorldSession::SendShowMailBox(uint64 guid)
|
||||
|
||||
void WorldSession::HandleTrainerListOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid;
|
||||
SendTrainerList(guid);
|
||||
}
|
||||
|
||||
void WorldSession::SendTrainerList(uint64 guid)
|
||||
void WorldSession::SendTrainerList(ObjectGuid guid)
|
||||
{
|
||||
std::string str = GetAcoreString(LANG_NPC_TAINER_HELLO);
|
||||
SendTrainerList(guid, str);
|
||||
}
|
||||
|
||||
void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
|
||||
void WorldSession::SendTrainerList(ObjectGuid guid, const std::string& strTitle)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: SendTrainerList");
|
||||
@@ -130,7 +130,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: SendTrainerList - Unit (%s) not found or you can not interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -144,7 +144,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
|
||||
if (!ci)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: SendTrainerList - (GUID: %u) NO CREATUREINFO!", GUID_LOPART(guid));
|
||||
LOG_DEBUG("network", "WORLD: SendTrainerList - (%s) NO CREATUREINFO!", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -153,7 +153,7 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
|
||||
if (!trainer_spells)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (GUID: %u Entry: %u)", GUID_LOPART(guid), unit->GetEntry());
|
||||
LOG_DEBUG("network", "WORLD: SendTrainerList - Training spells not found for creature (%s)", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -243,19 +243,19 @@ void WorldSession::SendTrainerList(uint64 guid, const std::string& strTitle)
|
||||
|
||||
void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 spellId = 0;
|
||||
|
||||
recvData >> guid >> spellId;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u", uint32(GUID_LOPART(guid)), spellId);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_TRAINER_BUY_SPELL Npc %s, learn spell id is: %u", guid.ToString().c_str(), spellId);
|
||||
#endif
|
||||
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleTrainerBuySpellOpcode - Unit (%s) not found or you can not interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -297,7 +297,7 @@ void WorldSession::HandleTrainerBuySpellOpcode(WorldPacket& recvData)
|
||||
_player->learnSpell(spellId);
|
||||
|
||||
WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, 12);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
data << uint32(spellId); // should be same as in packet from client
|
||||
SendPacket(&data);
|
||||
}
|
||||
@@ -308,14 +308,14 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_GOSSIP_HELLO");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleGossipHelloOpcode - Unit (%s) not found or you can not interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -373,7 +373,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
|
||||
|
||||
uint32 option;
|
||||
uint32 unk;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::string code = "";
|
||||
|
||||
recvData >> guid >> unk >> option;
|
||||
@@ -393,7 +393,7 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network.opcode", "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network.opcode", "WORLD: HandleGossipSelectOptionOpcode - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -420,7 +420,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_SPIRIT_HEALER_ACTIVATE");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid;
|
||||
|
||||
@@ -428,7 +428,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode(WorldPacket& recvData)
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleSpiritHealerActivateOpcode - Unit (%s) not found or you can not interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -448,9 +448,12 @@ void WorldSession::SendSpiritResurrect()
|
||||
|
||||
// get corpse nearest graveyard
|
||||
GraveyardStruct const* corpseGrave = nullptr;
|
||||
Corpse* corpse = _player->GetCorpse();
|
||||
if (corpse)
|
||||
corpseGrave = sGraveyard->GetClosestGraveyard(corpse->GetPositionX(), corpse->GetPositionY(), corpse->GetPositionZ(), corpse->GetMapId(), _player->GetTeamId());
|
||||
WorldLocation corpseLocation = _player->GetCorpseLocation();
|
||||
if (_player->HasCorpse())
|
||||
{
|
||||
corpseGrave = sGraveyard->GetClosestGraveyard(corpseLocation.GetPositionX(), corpseLocation.GetPositionY(),
|
||||
corpseLocation.GetPositionZ(), corpseLocation.GetMapId(), _player->GetTeamId());
|
||||
}
|
||||
|
||||
// now can spawn bones
|
||||
_player->SpawnCorpseBones();
|
||||
@@ -473,7 +476,7 @@ void WorldSession::SendSpiritResurrect()
|
||||
|
||||
void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
recvData >> npcGUID;
|
||||
|
||||
if (!GetPlayer()->IsInWorld() || !GetPlayer()->IsAlive())
|
||||
@@ -483,7 +486,7 @@ void WorldSession::HandleBinderActivateOpcode(WorldPacket& recvData)
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
|
||||
LOG_DEBUG("network", "WORLD: HandleBinderActivateOpcode - Unit (%s) not found or you can not interact with him.", npcGUID.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -507,7 +510,7 @@ void WorldSession::SendBindPoint(Creature* npc)
|
||||
npc->CastSpell(_player, bindspell, true);
|
||||
|
||||
WorldPacket data(SMSG_TRAINER_BUY_SUCCEEDED, (8 + 4));
|
||||
data << uint64(npc->GetGUID());
|
||||
data << npc->GetGUID();
|
||||
data << uint32(bindspell);
|
||||
SendPacket(&data);
|
||||
|
||||
@@ -519,7 +522,7 @@ void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Recv MSG_LIST_STABLED_PETS");
|
||||
#endif
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
|
||||
recvData >> npcGUID;
|
||||
|
||||
@@ -537,11 +540,11 @@ void WorldSession::HandleListStabledPetsOpcode(WorldPacket& recvData)
|
||||
SendStablePet(npcGUID);
|
||||
}
|
||||
|
||||
void WorldSession::SendStablePet(uint64 guid)
|
||||
void WorldSession::SendStablePet(ObjectGuid guid)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS_DETAIL);
|
||||
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(1, PET_SAVE_FIRST_STABLE_SLOT);
|
||||
stmt->setUInt8(2, PET_SAVE_LAST_STABLE_SLOT);
|
||||
|
||||
@@ -549,7 +552,7 @@ void WorldSession::SendStablePet(uint64 guid)
|
||||
_sendStabledPetCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
|
||||
}
|
||||
|
||||
void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid)
|
||||
void WorldSession::SendStablePetCallback(PreparedQueryResult result, ObjectGuid guid)
|
||||
{
|
||||
if (!GetPlayer())
|
||||
return;
|
||||
@@ -560,7 +563,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid
|
||||
|
||||
WorldPacket data(MSG_LIST_STABLED_PETS, 200); // guess size
|
||||
|
||||
data << uint64 (guid);
|
||||
data << guid;
|
||||
|
||||
Pet* pet = _player->GetPet();
|
||||
|
||||
@@ -584,7 +587,7 @@ void WorldSession::SendStablePetCallback(PreparedQueryResult result, uint64 guid
|
||||
else if (_player->IsPetDismissed() || _player->GetTemporaryUnsummonedPetNumber())
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHAR_PET_BY_ENTRY_AND_SLOT);
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(1, uint8(_player->GetTemporaryUnsummonedPetNumber() ? PET_SAVE_AS_CURRENT : PET_SAVE_NOT_IN_SLOT));
|
||||
|
||||
if (PreparedQueryResult _result = CharacterDatabase.AsyncQuery(stmt))
|
||||
@@ -632,7 +635,7 @@ void WorldSession::HandleStablePet(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_PET");
|
||||
#endif
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
|
||||
recvData >> npcGUID;
|
||||
|
||||
@@ -675,7 +678,7 @@ void WorldSession::HandleStablePet(WorldPacket& recvData)
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOTS);
|
||||
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(1, PET_SAVE_FIRST_STABLE_SLOT);
|
||||
stmt->setUInt8(2, PET_SAVE_LAST_STABLE_SLOT);
|
||||
|
||||
@@ -720,7 +723,7 @@ void WorldSession::HandleStablePetCallback(PreparedQueryResult result)
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT);
|
||||
stmt->setUInt8(0, freeSlot);
|
||||
stmt->setUInt32(1, _player->GetGUIDLow());
|
||||
stmt->setUInt32(1, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(2, uint8(_player->GetTemporaryUnsummonedPetNumber() ? PET_SAVE_AS_CURRENT : PET_SAVE_NOT_IN_SLOT));
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -739,7 +742,7 @@ void WorldSession::HandleUnstablePet(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Recv CMSG_UNSTABLE_PET.");
|
||||
#endif
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
uint32 petnumber;
|
||||
|
||||
recvData >> npcGUID >> petnumber;
|
||||
@@ -756,7 +759,7 @@ void WorldSession::HandleUnstablePet(WorldPacket& recvData)
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_ENTRY);
|
||||
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, petnumber);
|
||||
stmt->setUInt8(2, PET_SAVE_FIRST_STABLE_SLOT);
|
||||
stmt->setUInt8(3, PET_SAVE_LAST_STABLE_SLOT);
|
||||
@@ -822,7 +825,7 @@ void WorldSession::HandleUnstablePetCallback(PreparedQueryResult result, uint32
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT);
|
||||
stmt->setUInt8(0, slot);
|
||||
stmt->setUInt32(1, _player->GetGUIDLow());
|
||||
stmt->setUInt32(1, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(2, uint8(_player->GetTemporaryUnsummonedPetNumber() ? PET_SAVE_AS_CURRENT : PET_SAVE_NOT_IN_SLOT));
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -842,7 +845,7 @@ void WorldSession::HandleBuyStableSlot(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Recv CMSG_BUY_STABLE_SLOT.");
|
||||
#endif
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
|
||||
recvData >> npcGUID;
|
||||
|
||||
@@ -884,7 +887,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Recv CMSG_STABLE_SWAP_PET.");
|
||||
#endif
|
||||
uint64 npcGUID;
|
||||
ObjectGuid npcGUID;
|
||||
uint32 petId;
|
||||
|
||||
recvData >> npcGUID >> petId;
|
||||
@@ -923,7 +926,7 @@ void WorldSession::HandleStableSwapPet(WorldPacket& recvData)
|
||||
// Find swapped pet slot in stable
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_PET_SLOT_BY_ID);
|
||||
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, petId);
|
||||
|
||||
_stableSwapCallback.SetParam(petId);
|
||||
@@ -975,7 +978,7 @@ void WorldSession::HandleStableSwapPetCallback(PreparedQueryResult result, uint3
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT);
|
||||
stmt->setUInt8(0, slot);
|
||||
stmt->setUInt32(1, _player->GetGUIDLow());
|
||||
stmt->setUInt32(1, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt8(2, uint8(_player->GetTemporaryUnsummonedPetNumber() ? PET_SAVE_AS_CURRENT : PET_SAVE_NOT_IN_SLOT));
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -998,7 +1001,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_REPAIR_ITEM");
|
||||
#endif
|
||||
|
||||
uint64 npcGUID, itemGUID;
|
||||
ObjectGuid npcGUID, itemGUID;
|
||||
uint8 guildBank; // new in 2.3.2, bool that means from guild bank money
|
||||
|
||||
recvData >> npcGUID >> itemGUID >> guildBank;
|
||||
@@ -1007,7 +1010,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can not interact with him.", uint32(GUID_LOPART(npcGUID)));
|
||||
LOG_DEBUG("network", "WORLD: HandleRepairItemOpcode - Unit (%s) not found or you can not interact with him.", npcGUID.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -1024,7 +1027,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
|
||||
if (itemGUID)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "ITEM: Repair item, itemGUID = %u, npcGUID = %u", GUID_LOPART(itemGUID), GUID_LOPART(npcGUID));
|
||||
LOG_DEBUG("network", "ITEM: Repair item, item %s, npc %s", itemGUID.ToString().c_str(), npcGUID.ToString().c_str());
|
||||
#endif
|
||||
|
||||
Item* item = _player->GetItemByGuid(itemGUID);
|
||||
@@ -1034,7 +1037,7 @@ void WorldSession::HandleRepairItemOpcode(WorldPacket& recvData)
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "ITEM: Repair all items, npcGUID = %u", GUID_LOPART(npcGUID));
|
||||
LOG_DEBUG("network", "ITEM: Repair all items, npc %s", npcGUID.ToString().c_str());
|
||||
#endif
|
||||
_player->DurabilityRepairAll(true, discountMod, guildBank);
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
}
|
||||
|
||||
Map* map = owner->GetMap();
|
||||
uint32 guid = sObjectMgr->GenerateLowGuid(HIGHGUID_PET);
|
||||
ObjectGuid::LowType guid = map->GenerateLowGuid<HighGuid::Pet>();
|
||||
Pet* pet = new Pet(owner, pet_type);
|
||||
LoadPetFromDBQueryHolder* holder = new LoadPetFromDBQueryHolder(pet_number, current, uint32(time(nullptr) - fields[14].GetUInt32()), fields[13].GetString(), savedhealth, savedmana);
|
||||
if (!pet->Create(guid, map, owner->GetPhaseMask(), petentry, pet_number) || !holder->Initialize())
|
||||
@@ -140,7 +140,8 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
owner->GetClosePoint(px, py, pz, pet->GetObjectSize(), PET_FOLLOW_DIST, pet->GetFollowAngle());
|
||||
if (!pet->IsPositionValid())
|
||||
{
|
||||
LOG_ERROR("server", "Pet (guidlow %d, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)", pet->GetGUIDLow(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
|
||||
LOG_ERROR("server", "Pet (%s, entry %d) not loaded. Suggested coordinates isn't valid (X: %f Y: %f)",
|
||||
pet->GetGUID().ToString().c_str(), pet->GetEntry(), pet->GetPositionX(), pet->GetPositionY());
|
||||
delete pet;
|
||||
delete holder;
|
||||
return PET_LOAD_ERROR;
|
||||
@@ -222,14 +223,14 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UDP_CHAR_PET_SLOT_BY_SLOT_EXCLUDE_ID);
|
||||
stmt->setUInt8(0, uint8(PET_SAVE_NOT_IN_SLOT));
|
||||
stmt->setUInt32(1, owner->GetGUIDLow());
|
||||
stmt->setUInt32(1, owner->GetGUID().GetCounter());
|
||||
stmt->setUInt8(2, uint8(PET_SAVE_AS_CURRENT));
|
||||
stmt->setUInt32(3, pet_number);
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_SLOT_BY_ID);
|
||||
stmt->setUInt8(0, uint8(PET_SAVE_AS_CURRENT));
|
||||
stmt->setUInt32(1, owner->GetGUIDLow());
|
||||
stmt->setUInt32(1, owner->GetGUID().GetCounter());
|
||||
stmt->setUInt32(2, pet_number);
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -242,8 +243,8 @@ uint8 WorldSession::HandleLoadPetFromDBFirstCallback(PreparedQueryResult result,
|
||||
if (summon_spell_id)
|
||||
{
|
||||
WorldPacket data(SMSG_SPELL_GO, (8 + 8 + 4 + 4 + 2));
|
||||
data.append(owner->GetPackGUID());
|
||||
data.append(owner->GetPackGUID());
|
||||
data << owner->GetPackGUID();
|
||||
data << owner->GetPackGUID();
|
||||
data << uint8(0);
|
||||
data << uint32(summon_spell_id);
|
||||
data << uint32(256); // CAST_FLAG_UNKNOWN3
|
||||
@@ -354,11 +355,11 @@ void WorldSession::HandleLoadPetFromDBSecondCallback(LoadPetFromDBQueryHolder* h
|
||||
|
||||
void WorldSession::HandleDismissCritter(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for GUID " UI64FMTD, guid);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_DISMISS_CRITTER for %s", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
@@ -366,7 +367,8 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData)
|
||||
if (!pet)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Vanitypet (guid: %u) does not exist - player '%s' (guid: %u / account: %u) attempted to dismiss it (possibly lagged out)", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUIDLow(), GetAccountId());
|
||||
LOG_DEBUG("network", "Vanitypet (%s) does not exist - player %s (%s / account: %u) attempted to dismiss it (possibly lagged out)",
|
||||
guid.ToString().c_str(), GetPlayer()->GetName().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetAccountId());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -380,9 +382,9 @@ void WorldSession::HandleDismissCritter(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandlePetAction(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid1;
|
||||
ObjectGuid guid1;
|
||||
uint32 data;
|
||||
uint64 guid2;
|
||||
ObjectGuid guid2;
|
||||
recvData >> guid1; //pet guid
|
||||
recvData >> data;
|
||||
recvData >> guid2; //tag guid
|
||||
@@ -393,18 +395,18 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
|
||||
// used also for charmed creature
|
||||
Unit* pet = ObjectAccessor::GetUnit(*_player, guid1);
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "HandlePetAction: Pet %u - flag: %u, spellid: %u, target: %u.", uint32(GUID_LOPART(guid1)), uint32(flag), spellid, uint32(GUID_LOPART(guid2)));
|
||||
LOG_DEBUG("server", "HandlePetAction: Pet %s - flag: %u, spellid: %u, target: %s.", guid1.ToString().c_str(), uint32(flag), spellid, guid2.ToString().c_str());
|
||||
#endif
|
||||
|
||||
if (!pet)
|
||||
{
|
||||
LOG_ERROR("server", "HandlePetAction: Pet (GUID: %u) doesn't exist for player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetAction: Pet (%s) doesn't exist for player %s", guid1.ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet != GetPlayer()->GetFirstControlled())
|
||||
{
|
||||
LOG_ERROR("server", "HandlePetAction: Pet (GUID: %u) does not belong to player '%s'", uint32(GUID_LOPART(guid1)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetAction: Pet (%s) does not belong to player %s", guid1.ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -445,24 +447,24 @@ void WorldSession::HandlePetAction(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandlePetStopAttack(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for GUID " UI64FMTD "", guid);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_PET_STOP_ATTACK for %s", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
Unit* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
|
||||
if (!pet)
|
||||
{
|
||||
LOG_ERROR("server", "HandlePetStopAttack: Pet %u does not exist", uint32(GUID_LOPART(guid)));
|
||||
LOG_ERROR("server", "HandlePetStopAttack: Pet %s does not exist", guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet != GetPlayer()->GetPet() && pet != GetPlayer()->GetCharm())
|
||||
{
|
||||
LOG_ERROR("server", "HandlePetStopAttack: Pet GUID %u isn't a pet or charmed creature of player %s", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetStopAttack: Pet %s isn't a pet or charmed creature of player %s", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -473,13 +475,13 @@ void WorldSession::HandlePetStopAttack(WorldPacket& recvData)
|
||||
pet->ClearInPetCombat();
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid, uint16 flag, uint64 guid2)
|
||||
void WorldSession::HandlePetActionHelper(Unit* pet, ObjectGuid guid1, uint16 spellid, uint16 flag, ObjectGuid guid2)
|
||||
{
|
||||
CharmInfo* charmInfo = pet->GetCharmInfo();
|
||||
if (!charmInfo)
|
||||
{
|
||||
LOG_ERROR("server", "WorldSession::HandlePetAction(petGuid: " UI64FMTD ", tagGuid: " UI64FMTD ", spellId: %u, flag: %u): object (entry: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!",
|
||||
guid1, guid2, spellid, flag, pet->GetGUIDLow(), pet->GetTypeId());
|
||||
LOG_ERROR("server", "WorldSession::HandlePetAction(petGuid: %s, tagGuid: %s, spellId: %u, flag: %u): object (%s) is considered pet-like but doesn't have a charminfo!",
|
||||
guid1.ToString().c_str(), guid2.ToString().c_str(), spellid, flag, pet->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -509,7 +511,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
pet->ToPet()->ClearCastWhenWillAvailable();
|
||||
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID(0);
|
||||
charmInfo->SetForcedTargetGUID();
|
||||
break;
|
||||
}
|
||||
case COMMAND_FOLLOW: //spellid=1792 //FOLLOW
|
||||
@@ -529,7 +531,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
charmInfo->SetIsFollowing(false);
|
||||
charmInfo->RemoveStayPosition();
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID(0);
|
||||
charmInfo->SetForcedTargetGUID();
|
||||
break;
|
||||
}
|
||||
case COMMAND_ATTACK: //spellid=1792 //ATTACK
|
||||
@@ -748,7 +750,7 @@ void WorldSession::HandlePetActionHelper(Unit* pet, uint64 guid1, uint16 spellid
|
||||
spell->prepare(&(spell->m_targets));
|
||||
|
||||
charmInfo->SetForcedSpell(0);
|
||||
charmInfo->SetForcedTargetGUID(0);
|
||||
charmInfo->SetForcedTargetGUID();
|
||||
}
|
||||
else if (pet->ToPet() && (result == SPELL_FAILED_LINE_OF_SIGHT || result == SPELL_FAILED_OUT_OF_RANGE))
|
||||
{
|
||||
@@ -909,7 +911,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
|
||||
#endif
|
||||
|
||||
uint32 petnumber;
|
||||
uint64 petguid;
|
||||
ObjectGuid petguid;
|
||||
|
||||
recvData >> petnumber;
|
||||
recvData >> petguid;
|
||||
@@ -917,7 +919,7 @@ void WorldSession::HandlePetNameQuery(WorldPacket& recvData)
|
||||
SendPetNameQuery(petguid, petnumber);
|
||||
}
|
||||
|
||||
void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
|
||||
void WorldSession::SendPetNameQuery(ObjectGuid petguid, uint32 petnumber)
|
||||
{
|
||||
Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, petguid);
|
||||
if (!pet)
|
||||
@@ -961,7 +963,7 @@ void WorldSession::SendPetNameQuery(uint64 petguid, uint32 petnumber)
|
||||
SendPacket(&data);
|
||||
}
|
||||
|
||||
bool WorldSession::CheckStableMaster(uint64 guid)
|
||||
bool WorldSession::CheckStableMaster(ObjectGuid guid)
|
||||
{
|
||||
// spell case or GM
|
||||
if (guid == GetPlayer()->GetGUID())
|
||||
@@ -969,7 +971,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
|
||||
if (!GetPlayer()->IsGameMaster() && !GetPlayer()->HasAuraType(SPELL_AURA_OPEN_STABLE))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player (GUID:%u) attempt open stable in cheating way.", GUID_LOPART(guid));
|
||||
LOG_DEBUG("server", "Player (%s) attempt open stable in cheating way.", guid.ToString().c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@@ -980,7 +982,7 @@ bool WorldSession::CheckStableMaster(uint64 guid)
|
||||
if (!GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_STABLEMASTER))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Stablemaster (GUID:%u) not found or you can't interact with him.", GUID_LOPART(guid));
|
||||
LOG_DEBUG("server", "Stablemaster (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
@@ -994,7 +996,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
|
||||
LOG_DEBUG("server", "HandlePetSetAction. CMSG_PET_SET_ACTION");
|
||||
#endif
|
||||
|
||||
uint64 petguid;
|
||||
ObjectGuid petguid;
|
||||
uint8 count;
|
||||
|
||||
recvData >> petguid;
|
||||
@@ -1002,7 +1004,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
|
||||
Unit* checkPet = ObjectAccessor::GetUnit(*_player, petguid);
|
||||
if (!checkPet || checkPet != _player->GetFirstControlled())
|
||||
{
|
||||
LOG_ERROR("server", "HandlePetSetAction: Unknown pet (GUID: %u) or pet owner (GUID: %u)", GUID_LOPART(petguid), _player->GetGUIDLow());
|
||||
LOG_ERROR("server", "HandlePetSetAction: Unknown pet (%s) or pet owner (%s)", petguid.ToString().c_str(), _player->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1036,7 +1038,7 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
Unit::ControlSet petsSet;
|
||||
if (checkPet->GetEntry() != GUID_ENPART(petguid))
|
||||
if (checkPet->GetEntry() != petguid.GetEntry())
|
||||
petsSet.insert(checkPet);
|
||||
else
|
||||
petsSet = _player->m_Controlled;
|
||||
@@ -1045,13 +1047,14 @@ void WorldSession::HandlePetSetAction(WorldPacket& recvData)
|
||||
for (Unit::ControlSet::const_iterator itr = petsSet.begin(); itr != petsSet.end(); ++itr)
|
||||
{
|
||||
Unit* pet = *itr;
|
||||
if (checkPet->GetEntry() == GUID_ENPART(petguid) && pet->GetEntry() != GUID_ENPART(petguid))
|
||||
if (checkPet->GetEntry() == petguid.GetEntry() && pet->GetEntry() != petguid.GetEntry())
|
||||
continue;
|
||||
|
||||
CharmInfo* charmInfo = pet->GetCharmInfo();
|
||||
if (!charmInfo)
|
||||
{
|
||||
LOG_ERROR("server", "WorldSession::HandlePetSetAction: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
|
||||
LOG_ERROR("server", "WorldSession::HandlePetSetAction: object (%s TypeId: %u) is considered pet-like but doesn't have a charminfo!",
|
||||
pet->GetGUID().ToString().c_str(), pet->GetTypeId());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1123,7 +1126,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
LOG_DEBUG("server", "HandlePetRename. CMSG_PET_RENAME");
|
||||
#endif
|
||||
|
||||
uint64 petguid;
|
||||
ObjectGuid petguid;
|
||||
uint8 isdeclined;
|
||||
|
||||
std::string name;
|
||||
@@ -1133,7 +1136,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
recvData >> name;
|
||||
recvData >> isdeclined;
|
||||
|
||||
Pet* pet = ObjectAccessor::FindPet(petguid);
|
||||
Pet* pet = ObjectAccessor::GetPet(*_player, petguid);
|
||||
// check it!
|
||||
if (!pet || !pet->IsPet() || ((Pet*)pet)->getPetType() != HUNTER_PET ||
|
||||
!pet->HasByteFlag(UNIT_FIELD_BYTES_2, 2, UNIT_CAN_BE_RENAMED) ||
|
||||
@@ -1187,7 +1190,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_ADD_CHAR_PET_DECLINEDNAME);
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
|
||||
for (uint8 i = 0; i < 5; i++)
|
||||
stmt->setString(i + 1, declinedname.name[i]);
|
||||
@@ -1198,7 +1201,7 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_CHAR_PET_NAME);
|
||||
stmt->setString(0, name);
|
||||
stmt->setUInt32(1, _player->GetGUIDLow());
|
||||
stmt->setUInt32(1, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt32(2, pet->GetCharmInfo()->GetPetNumber());
|
||||
trans->Append(stmt);
|
||||
|
||||
@@ -1209,10 +1212,10 @@ void WorldSession::HandlePetRename(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandlePetAbandon(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid; //pet guid
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "HandlePetAbandon. CMSG_PET_ABANDON pet guid is %u", GUID_LOPART(guid));
|
||||
LOG_DEBUG("server", "HandlePetAbandon. CMSG_PET_ABANDON pet is %s", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
if (!_player->IsInWorld())
|
||||
@@ -1242,7 +1245,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "CMSG_PET_SPELL_AUTOCAST");
|
||||
#endif
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 spellid;
|
||||
uint8 state; //1 for on, 0 for off
|
||||
recvPacket >> guid >> spellid >> state;
|
||||
@@ -1250,7 +1253,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
if (!_player->GetGuardianPet() && !_player->GetCharm())
|
||||
return;
|
||||
|
||||
if (IS_PLAYER_GUID(guid))
|
||||
if (guid.IsPlayer())
|
||||
return;
|
||||
|
||||
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
|
||||
@@ -1260,12 +1263,12 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
Creature* checkPet = ObjectAccessor::GetCreatureOrPetOrVehicle(*_player, guid);
|
||||
if (!checkPet || (checkPet != _player->GetGuardianPet() && checkPet != _player->GetCharm()))
|
||||
{
|
||||
LOG_ERROR("server", "HandlePetSpellAutocastOpcode.Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetSpellAutocastOpcode.Pet %s isn't pet of player %s .", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
Unit::ControlSet petsSet;
|
||||
if (checkPet->GetEntry() != GUID_ENPART(guid))
|
||||
if (checkPet->GetEntry() != guid.GetEntry())
|
||||
petsSet.insert(checkPet);
|
||||
else
|
||||
petsSet = _player->m_Controlled;
|
||||
@@ -1274,7 +1277,7 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
for (Unit::ControlSet::const_iterator itr = petsSet.begin(); itr != petsSet.end(); ++itr)
|
||||
{
|
||||
Unit* pet = *itr;
|
||||
if (checkPet->GetEntry() == GUID_ENPART(guid) && pet->GetEntry() != GUID_ENPART(guid))
|
||||
if (checkPet->GetEntry() == guid.GetEntry() && pet->GetEntry() != guid.GetEntry())
|
||||
continue;
|
||||
|
||||
// do not add not learned spells/ passive spells
|
||||
@@ -1284,7 +1287,8 @@ void WorldSession::HandlePetSpellAutocastOpcode(WorldPacket& recvPacket)
|
||||
CharmInfo* charmInfo = pet->GetCharmInfo();
|
||||
if (!charmInfo)
|
||||
{
|
||||
LOG_ERROR("server", "WorldSession::HandlePetSpellAutocastOpcod: object (GUID: %u TypeId: %u) is considered pet-like but doesn't have a charminfo!", pet->GetGUIDLow(), pet->GetTypeId());
|
||||
LOG_ERROR("server", "WorldSession::HandlePetSpellAutocastOpcod: object (%s TypeId: %u) is considered pet-like but doesn't have a charminfo!",
|
||||
pet->GetGUID().ToString().c_str(), pet->GetTypeId());
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -1303,7 +1307,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint8 castCount;
|
||||
uint32 spellId;
|
||||
uint8 castFlags;
|
||||
@@ -1311,7 +1315,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
recvPacket >> guid >> castCount >> spellId >> castFlags;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, guid: " UI64FMTD ", castCount: %u, spellId %u, castFlags %u", guid, castCount, spellId, castFlags);
|
||||
LOG_DEBUG("network", "WORLD: CMSG_PET_CAST_SPELL, guid: %s, castCount: %u, spellId %u, castFlags %u", guid.ToString().c_str(), castCount, spellId, castFlags);
|
||||
#endif
|
||||
|
||||
// This opcode is also sent from charmed and possessed units (players and creatures)
|
||||
@@ -1322,7 +1326,7 @@ void WorldSession::HandlePetCastSpellOpcode(WorldPacket& recvPacket)
|
||||
|
||||
if (!caster || (caster != _player->GetGuardianPet() && caster != _player->GetCharm()))
|
||||
{
|
||||
LOG_ERROR("server", "HandlePetCastSpellOpcode: Pet %u isn't pet of player %s .", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetCastSpellOpcode: Pet %s isn't pet of player %s .", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1424,7 +1428,7 @@ void WorldSession::HandlePetLearnTalent(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_PET_LEARN_TALENT");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 talent_id, requested_rank;
|
||||
recvData >> guid >> talent_id >> requested_rank;
|
||||
|
||||
@@ -1438,7 +1442,7 @@ void WorldSession::HandleLearnPreviewTalentsPet(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "CMSG_LEARN_PREVIEW_TALENTS_PET");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
uint32 talentsCount;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU GPL v2 license, you may redistribute it and/or modify it under version 2 of the License, or (at your option), any later version.
|
||||
* Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
|
||||
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
|
||||
@@ -27,7 +27,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "Received opcode CMSG_PETITION_BUY");
|
||||
#endif
|
||||
|
||||
uint64 guidNPC;
|
||||
ObjectGuid guidNPC;
|
||||
uint32 clientIndex; // 1 for guild and arenaslot+1 for arenas in client
|
||||
std::string name;
|
||||
|
||||
@@ -55,7 +55,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
recvData.read_skip<uint32>(); // 0
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
|
||||
LOG_DEBUG("network", "Petitioner (%s) tried sell petition: name %s", guidNPC.ToString().c_str(), name.c_str());
|
||||
#endif
|
||||
|
||||
// prevent cheating
|
||||
@@ -63,7 +63,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC));
|
||||
LOG_DEBUG("network", "WORLD: HandlePetitionBuyOpcode - Unit (%s) not found or you can't interact with him.", guidNPC.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
if (!charter)
|
||||
return;
|
||||
|
||||
charter->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1, charter->GetGUIDLow());
|
||||
charter->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1, charter->GetGUID().GetCounter());
|
||||
// ITEM_FIELD_ENCHANTMENT_1_1 is guild/arenateam id
|
||||
// ITEM_FIELD_ENCHANTMENT_1_1+1 is current signatures count (showed on item)
|
||||
charter->SetState(ITEM_CHANGED, _player);
|
||||
@@ -192,7 +192,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
// a petition is invalid, if both the owner and the type matches
|
||||
// we checked above, if this player is in an arenateam, so this must be
|
||||
// datacorruption
|
||||
Petition const* petition = sPetitionMgr->GetPetitionByOwnerWithType(_player->GetGUIDLow(), type);
|
||||
Petition const* petition = sPetitionMgr->GetPetitionByOwnerWithType(_player->GetGUID(), type);
|
||||
|
||||
CharacterDatabase.EscapeString(name);
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
@@ -200,7 +200,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
if (petition)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Invalid petition GUIDs: %u", petition->petitionGuid);
|
||||
LOG_DEBUG("network", "Invalid petition: %s", petition->petitionGuid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
trans->PAppend("DELETE FROM petition WHERE petitionguid = %u", petition->petitionGuid);
|
||||
@@ -212,8 +212,8 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
// xinef: petition pointer is invalid from now on
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION);
|
||||
stmt->setUInt32(0, _player->GetGUIDLow());
|
||||
stmt->setUInt32(1, charter->GetGUIDLow());
|
||||
stmt->setUInt32(0, _player->GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, charter->GetGUID().GetCounter());
|
||||
stmt->setString(2, name);
|
||||
stmt->setUInt8(3, uint8(type));
|
||||
trans->Append(stmt);
|
||||
@@ -221,7 +221,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket& recvData)
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
// xinef: fill petition store
|
||||
sPetitionMgr->AddPetition(charter->GetGUIDLow(), _player->GetGUIDLow(), name, uint8(type));
|
||||
sPetitionMgr->AddPetition(charter->GetGUID(), _player->GetGUID(), name, uint8(type));
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
|
||||
@@ -230,13 +230,11 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "Received opcode CMSG_PETITION_SHOW_SIGNATURES");
|
||||
#endif
|
||||
|
||||
uint64 petitionguid;
|
||||
ObjectGuid petitionguid;
|
||||
recvData >> petitionguid; // petition guid
|
||||
|
||||
// solve (possible) some strange compile problems with explicit use GUID_LOPART(petitionguid) at some GCC versions (wrong code optimization in compiler?)
|
||||
uint32 petitionGuidLow = GUID_LOPART(petitionguid);
|
||||
|
||||
Petition const* petition = sPetitionMgr->GetPetition(petitionGuidLow);
|
||||
// solve (possible) some strange compile problems with explicit use petition low guid at some GCC versions (wrong code optimization in compiler?)
|
||||
Petition const* petition = sPetitionMgr->GetPetition(petitionguid);
|
||||
if (!petition)
|
||||
return;
|
||||
|
||||
@@ -246,23 +244,23 @@ void WorldSession::HandlePetitionShowSignOpcode(WorldPacket& recvData)
|
||||
if (type == GUILD_CHARTER_TYPE && _player->GetGuildId())
|
||||
return;
|
||||
|
||||
Signatures const* signatures = sPetitionMgr->GetSignature(petitionGuidLow);
|
||||
Signatures const* signatures = sPetitionMgr->GetSignature(petitionguid);
|
||||
uint8 signs = signatures ? signatures->signatureMap.size() : 0;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionGuidLow);
|
||||
LOG_DEBUG("network", "CMSG_PETITION_SHOW_SIGNATURES petition entry: '%u'", petitionguid.GetCounter());
|
||||
#endif
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8 + 8 + 4 + 1 + signs * 12));
|
||||
data << uint64(petitionguid); // petition guid
|
||||
data << uint64(_player->GetGUID()); // owner guid
|
||||
data << uint32(petitionGuidLow); // guild guid
|
||||
data << petitionguid; // petition guid
|
||||
data << _player->GetGUID(); // owner guid
|
||||
data << uint32(petitionguid.GetCounter()); // guild guid
|
||||
data << uint8(signs); // sign's count
|
||||
|
||||
if (signs)
|
||||
for (SignatureMap::const_iterator itr = signatures->signatureMap.begin(); itr != signatures->signatureMap.end(); ++itr)
|
||||
{
|
||||
data << uint64(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); // Player GUID
|
||||
data << itr->first; // Player GUID
|
||||
data << uint32(0); // there 0 ...
|
||||
}
|
||||
|
||||
@@ -275,34 +273,34 @@ void WorldSession::HandlePetitionQueryOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "Received opcode CMSG_PETITION_QUERY"); // ok
|
||||
#endif
|
||||
|
||||
uint32 guildguid;
|
||||
uint64 petitionguid;
|
||||
recvData >> guildguid; // in Trinity always same as GUID_LOPART(petitionguid)
|
||||
ObjectGuid::LowType guildguid;
|
||||
ObjectGuid petitionguid;
|
||||
recvData >> guildguid; // in Trinity always same as petition low guid
|
||||
recvData >> petitionguid; // petition guid
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition GUID %u Guild GUID %u", GUID_LOPART(petitionguid), guildguid);
|
||||
LOG_DEBUG("network", "CMSG_PETITION_QUERY Petition (%s) Guild GUID %u", petitionguid.ToString().c_str(), guildguid);
|
||||
#endif
|
||||
|
||||
SendPetitionQueryOpcode(petitionguid);
|
||||
}
|
||||
|
||||
void WorldSession::SendPetitionQueryOpcode(uint64 petitionguid)
|
||||
void WorldSession::SendPetitionQueryOpcode(ObjectGuid petitionguid)
|
||||
{
|
||||
Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid));
|
||||
Petition const* petition = sPetitionMgr->GetPetition(petitionguid);
|
||||
if (!petition)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionguid));
|
||||
LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (%s)", petitionguid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
uint8 type = petition->petitionType;
|
||||
WorldPacket data(SMSG_PETITION_QUERY_RESPONSE, (4 + 8 + petition->petitionName.size() + 1 + 1 + 4 * 12 + 2 + 10));
|
||||
data << uint32(GUID_LOPART(petitionguid)); // guild/team guid (in Trinity always same as GUID_LOPART(petition guid)
|
||||
data << MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER); // charter owner guid
|
||||
data << petition->petitionName; // name (guild/arena team)
|
||||
data << uint8(0); // some string
|
||||
data << uint32(petitionguid.GetCounter()); // guild/team guid (in Trinity always same as petition low guid
|
||||
data << petition->ownerGuid; // charter owner guid
|
||||
data << petition->petitionName; // name (guild/arena team)
|
||||
data << uint8(0); // some string
|
||||
if (type == GUILD_CHARTER_TYPE)
|
||||
{
|
||||
uint32 needed = sWorld->getIntConfig(CONFIG_MIN_PETITION_SIGNS);
|
||||
@@ -341,7 +339,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "Received opcode MSG_PETITION_RENAME"); // ok
|
||||
#endif
|
||||
|
||||
uint64 petitionGuid;
|
||||
ObjectGuid petitionGuid;
|
||||
std::string newName;
|
||||
|
||||
recvData >> petitionGuid; // guid
|
||||
@@ -351,11 +349,11 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid));
|
||||
Petition const* petition = sPetitionMgr->GetPetition(petitionGuid);
|
||||
if (!petition)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (GUID: %u)", GUID_LOPART(petitionGuid));
|
||||
LOG_DEBUG("network", "CMSG_PETITION_QUERY failed for petition (%s)", petitionGuid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -390,7 +388,7 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_PETITION_NAME);
|
||||
|
||||
stmt->setString(0, newName);
|
||||
stmt->setUInt32(1, GUID_LOPART(petitionGuid));
|
||||
stmt->setUInt32(1, petitionGuid.GetCounter());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
@@ -398,10 +396,10 @@ void WorldSession::HandlePetitionRenameOpcode(WorldPacket& recvData)
|
||||
const_cast<Petition*>(petition)->petitionName = newName;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Petition (GUID: %u) renamed to '%s'", GUID_LOPART(petitionGuid), newName.c_str());
|
||||
LOG_DEBUG("network", "Petition (%s) renamed to %s", petitionGuid.ToString().c_str(), newName.c_str());
|
||||
#endif
|
||||
WorldPacket data(MSG_PETITION_RENAME, (8 + newName.size() + 1));
|
||||
data << uint64(petitionGuid);
|
||||
data << petitionGuid;
|
||||
data << newName;
|
||||
SendPacket(&data);
|
||||
}
|
||||
@@ -412,31 +410,30 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "Received opcode CMSG_PETITION_SIGN"); // ok
|
||||
#endif
|
||||
|
||||
uint64 petitionGuid;
|
||||
ObjectGuid petitionGuid;
|
||||
uint8 unk;
|
||||
recvData >> petitionGuid; // petition guid
|
||||
recvData >> unk;
|
||||
|
||||
Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid));
|
||||
Petition const* petition = sPetitionMgr->GetPetition(petitionGuid);
|
||||
if (!petition)
|
||||
{
|
||||
LOG_ERROR("server", "Petition %u is not found for player %u %s", GUID_LOPART(petitionGuid), GetPlayer()->GetGUIDLow(), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "Petition %s is not found for player %s (Name: %s)", petitionGuid.ToString().c_str(), GetPlayer()->GetGUID().ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 ownerGuid = MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER);
|
||||
uint8 type = petition->petitionType;
|
||||
|
||||
uint32 playerGuid = _player->GetGUIDLow();
|
||||
ObjectGuid playerGuid = _player->GetGUID();
|
||||
if (petition->ownerGuid == playerGuid)
|
||||
return;
|
||||
|
||||
Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionGuid));
|
||||
Signatures const* signatures = sPetitionMgr->GetSignature(petitionGuid);
|
||||
if (!signatures)
|
||||
return;
|
||||
|
||||
// not let enemies sign guild charter
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(ownerGuid))
|
||||
if (!sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GUILD) && GetPlayer()->GetTeamId() != sObjectMgr->GetPlayerTeamIdByGUID(petition->ownerGuid.GetCounter()))
|
||||
{
|
||||
if (type != GUILD_CHARTER_TYPE)
|
||||
SendArenaTeamCommandResult(ERR_ARENA_TEAM_INVITE_SS, "", "", ERR_ARENA_TEAM_NOT_ALLIED);
|
||||
@@ -501,38 +498,38 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
|
||||
if (found)
|
||||
{
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8 + 8 + 4));
|
||||
data << uint64(petitionGuid);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << petitionGuid;
|
||||
data << playerGuid;
|
||||
data << (uint32)PETITION_SIGN_ALREADY_SIGNED;
|
||||
|
||||
// close at signer side
|
||||
SendPacket(&data);
|
||||
|
||||
// update for owner if online
|
||||
if (Player* owner = ObjectAccessor::FindPlayerInOrOutOfWorld(ownerGuid))
|
||||
if (Player* owner = ObjectAccessor::FindConnectedPlayer(petition->ownerGuid))
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
return;
|
||||
}
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_PETITION_SIGNATURE);
|
||||
|
||||
stmt->setUInt32(0, GUID_LOPART(ownerGuid));
|
||||
stmt->setUInt32(1, GUID_LOPART(petitionGuid));
|
||||
stmt->setUInt32(2, playerGuid);
|
||||
stmt->setUInt32(0, petition->ownerGuid.GetCounter());
|
||||
stmt->setUInt32(1, petitionGuid.GetCounter());
|
||||
stmt->setUInt32(2, playerGuid.GetCounter());
|
||||
stmt->setUInt32(3, GetAccountId());
|
||||
|
||||
CharacterDatabase.Execute(stmt);
|
||||
|
||||
// xinef: fill petition store
|
||||
sPetitionMgr->AddSignature(GUID_LOPART(petitionGuid), GetAccountId(), playerGuid);
|
||||
sPetitionMgr->AddSignature(petitionGuid, GetAccountId(), playerGuid);
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "PETITION SIGN: GUID %u by player: %s (GUID: %u Account: %u)", GUID_LOPART(petitionGuid), _player->GetName().c_str(), playerGuid, GetAccountId());
|
||||
LOG_DEBUG("network", "PETITION SIGN: %s by player: %s (%s, Account: %u)", petitionGuid.ToString().c_str(), _player->GetName().c_str(), playerGuid.ToString().c_str(), GetAccountId());
|
||||
#endif
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SIGN_RESULTS, (8 + 8 + 4));
|
||||
data << uint64(petitionGuid);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << petitionGuid;
|
||||
data << playerGuid;
|
||||
data << uint32(PETITION_SIGN_OK);
|
||||
|
||||
// close at signer side
|
||||
@@ -544,7 +541,7 @@ void WorldSession::HandlePetitionSignOpcode(WorldPacket& recvData)
|
||||
// item->SetUInt32Value(ITEM_FIELD_ENCHANTMENT_1_1+1, signs);
|
||||
|
||||
// update for owner if online
|
||||
if (Player* owner = ObjectAccessor::FindPlayerInOrOutOfWorld(ownerGuid))
|
||||
if (Player* owner = ObjectAccessor::FindConnectedPlayer(petition->ownerGuid))
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -554,22 +551,21 @@ void WorldSession::HandlePetitionDeclineOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "Received opcode MSG_PETITION_DECLINE"); // ok
|
||||
#endif
|
||||
|
||||
uint64 petitionguid;
|
||||
uint64 ownerguid;
|
||||
ObjectGuid petitionguid;
|
||||
ObjectGuid ownerguid;
|
||||
recvData >> petitionguid; // petition guid
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Petition %u declined by %u", GUID_LOPART(petitionguid), _player->GetGUIDLow());
|
||||
LOG_DEBUG("network", "Petition %s declined by %s", petitionguid.ToString().c_str(), _player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
|
||||
Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid));
|
||||
Petition const* petition = sPetitionMgr->GetPetition(petitionguid);
|
||||
if (!petition)
|
||||
return;
|
||||
|
||||
ownerguid = MAKE_NEW_GUID(petition->ownerGuid, 0, HIGHGUID_PLAYER);
|
||||
if (Player* owner = ObjectAccessor::FindPlayerInOrOutOfWorld(ownerguid)) // petition owner online
|
||||
if (Player* owner = ObjectAccessor::FindConnectedPlayer(ownerguid)) // petition owner online
|
||||
{
|
||||
WorldPacket data(MSG_PETITION_DECLINE, 8);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << _player->GetGUID();
|
||||
owner->GetSession()->SendPacket(&data);
|
||||
}
|
||||
}
|
||||
@@ -580,18 +576,18 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "Received opcode CMSG_OFFER_PETITION"); // ok
|
||||
#endif
|
||||
|
||||
uint64 petitionguid, plguid;
|
||||
ObjectGuid petitionguid, plguid;
|
||||
uint32 junk;
|
||||
Player* player;
|
||||
recvData >> junk; // this is not petition type!
|
||||
recvData >> petitionguid; // petition guid
|
||||
recvData >> plguid; // player guid
|
||||
|
||||
player = ObjectAccessor::FindPlayerInOrOutOfWorld(plguid);
|
||||
player = ObjectAccessor::FindConnectedPlayer(plguid);
|
||||
if (!player)
|
||||
return;
|
||||
|
||||
Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionguid));
|
||||
Petition const* petition = sPetitionMgr->GetPetition(petitionguid);
|
||||
if (!petition)
|
||||
return;
|
||||
|
||||
@@ -645,19 +641,19 @@ void WorldSession::HandleOfferPetitionOpcode(WorldPacket& recvData)
|
||||
}
|
||||
}
|
||||
|
||||
Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionguid));
|
||||
Signatures const* signatures = sPetitionMgr->GetSignature(petitionguid);
|
||||
uint8 signs = signatures ? signatures->signatureMap.size() : 0;
|
||||
|
||||
WorldPacket data(SMSG_PETITION_SHOW_SIGNATURES, (8 + 8 + 4 + signs + signs * 12));
|
||||
data << uint64(petitionguid); // petition guid
|
||||
data << uint64(_player->GetGUID()); // owner guid
|
||||
data << uint32(GUID_LOPART(petitionguid)); // guild guid
|
||||
data << petitionguid; // petition guid
|
||||
data << _player->GetGUID(); // owner guid
|
||||
data << uint32(petitionguid.GetCounter()); // guild guid
|
||||
data << uint8(signs); // sign's count
|
||||
|
||||
if (signs)
|
||||
for (SignatureMap::const_iterator itr = signatures->signatureMap.begin(); itr != signatures->signatureMap.end(); ++itr)
|
||||
{
|
||||
data << uint64(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER)); // Player GUID
|
||||
data << itr->first; // Player GUID
|
||||
data << uint32(0); // there 0 ...
|
||||
}
|
||||
|
||||
@@ -672,7 +668,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
|
||||
|
||||
// Get petition guid from packet
|
||||
WorldPacket data;
|
||||
uint64 petitionGuid;
|
||||
ObjectGuid petitionGuid;
|
||||
|
||||
recvData >> petitionGuid;
|
||||
|
||||
@@ -682,22 +678,23 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
|
||||
return;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "Petition %u turned in by %u", GUID_LOPART(petitionGuid), _player->GetGUIDLow());
|
||||
LOG_DEBUG("network", "Petition %s turned in by %s", petitionGuid.ToString().c_str(), _player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
|
||||
Petition const* petition = sPetitionMgr->GetPetition(GUID_LOPART(petitionGuid));
|
||||
Petition const* petition = sPetitionMgr->GetPetition(petitionGuid);
|
||||
if (!petition)
|
||||
{
|
||||
LOG_ERROR("server", "Player %s (guid: %u) tried to turn in petition (guid: %u) that is not present in the database", _player->GetName().c_str(), _player->GetGUIDLow(), GUID_LOPART(petitionGuid));
|
||||
LOG_ERROR("server", "Player %s (%s) tried to turn in petition (%s) that is not present in the database",
|
||||
_player->GetName().c_str(), _player->GetGUID().ToString().c_str(), petitionGuid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 ownerguidlo = petition->ownerGuid;
|
||||
ObjectGuid ownerGuid = petition->ownerGuid;
|
||||
uint8 type = petition->petitionType;
|
||||
std::string name = petition->petitionName;
|
||||
|
||||
// Only the petition owner can turn in the petition
|
||||
if (_player->GetGUIDLow() != ownerguidlo)
|
||||
if (_player->GetGUID() != ownerGuid)
|
||||
return;
|
||||
|
||||
// Petition type (guild/arena) specific checks
|
||||
@@ -742,7 +739,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
// Get petition signatures from db
|
||||
Signatures const* signatures = sPetitionMgr->GetSignature(GUID_LOPART(petitionGuid));
|
||||
Signatures const* signatures = sPetitionMgr->GetSignature(petitionGuid);
|
||||
uint8 signs = signatures ? signatures->signatureMap.size() : 0;
|
||||
SignatureMap signatureCopy;
|
||||
if (signs)
|
||||
@@ -787,7 +784,7 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
|
||||
// Add members from signatures
|
||||
if (signs)
|
||||
for (SignatureMap::const_iterator itr = signatureCopy.begin(); itr != signatureCopy.end(); ++itr)
|
||||
guild->AddMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER));
|
||||
guild->AddMember(itr->first);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -815,30 +812,30 @@ void WorldSession::HandleTurnInPetitionOpcode(WorldPacket& recvData)
|
||||
for (SignatureMap::const_iterator itr = signatureCopy.begin(); itr != signatureCopy.end(); ++itr)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %u", arenaTeam->GetId(), itr->first);
|
||||
LOG_DEBUG("network", "PetitionsHandler: Adding arena team (guid: %u) member %s", arenaTeam->GetId(), itr->first.ToString().c_str());
|
||||
#endif
|
||||
arenaTeam->AddMember(MAKE_NEW_GUID(itr->first, 0, HIGHGUID_PLAYER));
|
||||
arenaTeam->AddMember(itr->first);
|
||||
}
|
||||
}
|
||||
|
||||
SQLTransaction trans = CharacterDatabase.BeginTransaction();
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_BY_GUID);
|
||||
stmt->setUInt32(0, GUID_LOPART(petitionGuid));
|
||||
stmt->setUInt32(0, petitionGuid.GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_PETITION_SIGNATURE_BY_GUID);
|
||||
stmt->setUInt32(0, GUID_LOPART(petitionGuid));
|
||||
stmt->setUInt32(0, petitionGuid.GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
|
||||
// xinef: clear petition store (petition and signatures)
|
||||
sPetitionMgr->RemovePetition(GUID_LOPART(petitionGuid));
|
||||
sPetitionMgr->RemovePetition(petitionGuid);
|
||||
|
||||
// created
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "TURN IN PETITION GUID %u", GUID_LOPART(petitionGuid));
|
||||
LOG_DEBUG("network", "TURN IN PETITION %s", petitionGuid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
data.Initialize(SMSG_TURN_IN_PETITION_RESULTS, 4);
|
||||
@@ -852,19 +849,19 @@ void WorldSession::HandlePetitionShowListOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "Received CMSG_PETITION_SHOWLIST");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
SendPetitionShowList(guid);
|
||||
}
|
||||
|
||||
void WorldSession::SendPetitionShowList(uint64 guid)
|
||||
void WorldSession::SendPetitionShowList(ObjectGuid guid)
|
||||
{
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER);
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandlePetitionShowListOpcode - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -19,12 +19,12 @@
|
||||
#include "WorldPacket.h"
|
||||
#include "WorldSession.h"
|
||||
|
||||
void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
void WorldSession::SendNameQueryOpcode(ObjectGuid guid)
|
||||
{
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(GUID_LOPART(guid));
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guid.GetCounter());
|
||||
|
||||
WorldPacket data(SMSG_NAME_QUERY_RESPONSE, (8 + 1 + 1 + 1 + 1 + 1 + 10));
|
||||
data.appendPackGUID(guid);
|
||||
data << guid.WriteAsPacked();
|
||||
if (!playerData)
|
||||
{
|
||||
data << uint8(1); // name unknown
|
||||
@@ -32,7 +32,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
return;
|
||||
}
|
||||
|
||||
Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
|
||||
data << uint8(0); // name known
|
||||
data << playerData->name; // played name
|
||||
@@ -42,7 +42,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
data << uint8(playerData->playerClass);
|
||||
|
||||
// pussywizard: optimization
|
||||
/*Player* player = ObjectAccessor::FindPlayerInOrOutOfWorld(guid);
|
||||
/*Player* player = ObjectAccessor::FindConnectedPlayer(guid);
|
||||
if (DeclinedName const* names = (player ? player->GetDeclinedNames() : nullptr))
|
||||
{
|
||||
data << uint8(1); // Name is declined
|
||||
@@ -57,7 +57,7 @@ void WorldSession::SendNameQueryOpcode(uint64 guid)
|
||||
|
||||
void WorldSession::HandleNameQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
// This is disable by default to prevent lots of console spam
|
||||
@@ -84,7 +84,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 entry;
|
||||
recvData >> entry;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
CreatureTemplate const* ci = sObjectMgr->GetCreatureTemplate(entry);
|
||||
@@ -138,7 +138,7 @@ void WorldSession::HandleCreatureQueryOpcode(WorldPacket& recvData)
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (GUID: %u, ENTRY: %u)", GUID_LOPART(guid), entry);
|
||||
LOG_DEBUG("network", "WORLD: CMSG_CREATURE_QUERY - NO CREATURE INFO! (%s)", guid.ToString().c_str());
|
||||
#endif
|
||||
WorldPacket data(SMSG_CREATURE_QUERY_RESPONSE, 4);
|
||||
data << uint32(entry | 0x80000000);
|
||||
@@ -154,7 +154,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 entry;
|
||||
recvData >> entry;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
const GameObjectTemplate* info = sObjectMgr->GetGameObjectTemplate(entry);
|
||||
@@ -207,8 +207,7 @@ void WorldSession::HandleGameObjectQueryOpcode(WorldPacket& recvData)
|
||||
else
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (GUID: %u, ENTRY: %u)",
|
||||
GUID_LOPART(guid), entry);
|
||||
LOG_DEBUG("network", "WORLD: CMSG_GAMEOBJECT_QUERY - Missing gameobject info for (%s)", guid.ToString().c_str());
|
||||
#endif
|
||||
WorldPacket data (SMSG_GAMEOBJECT_QUERY_RESPONSE, 4);
|
||||
data << uint32(entry | 0x80000000);
|
||||
@@ -225,9 +224,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
|
||||
LOG_DEBUG("network", "WORLD: Received MSG_CORPSE_QUERY");
|
||||
#endif
|
||||
|
||||
Corpse* corpse = GetPlayer()->GetCorpse();
|
||||
|
||||
if (!corpse)
|
||||
if (!_player->HasCorpse())
|
||||
{
|
||||
WorldPacket data(MSG_CORPSE_QUERY, 1);
|
||||
data << uint8(0); // corpse not found
|
||||
@@ -235,24 +232,25 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
|
||||
return;
|
||||
}
|
||||
|
||||
uint32 mapid = corpse->GetMapId();
|
||||
float x = corpse->GetPositionX();
|
||||
float y = corpse->GetPositionY();
|
||||
float z = corpse->GetPositionZ();
|
||||
uint32 corpsemapid = mapid;
|
||||
WorldLocation corpseLocation = _player->GetCorpseLocation();
|
||||
uint32 corpseMapID = corpseLocation.GetMapId();
|
||||
uint32 mapID = corpseLocation.GetMapId();
|
||||
float x = corpseLocation.GetPositionX();
|
||||
float y = corpseLocation.GetPositionY();
|
||||
float z = corpseLocation.GetPositionZ();
|
||||
|
||||
// if corpse at different map
|
||||
if (mapid != _player->GetMapId())
|
||||
if (mapID != _player->GetMapId())
|
||||
{
|
||||
// search entrance map for proper show entrance
|
||||
if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapid))
|
||||
if (MapEntry const* corpseMapEntry = sMapStore.LookupEntry(mapID))
|
||||
{
|
||||
if (corpseMapEntry->IsDungeon() && corpseMapEntry->entrance_map >= 0)
|
||||
{
|
||||
// if corpse map have entrance
|
||||
if (Map const* entranceMap = sMapMgr->CreateBaseMap(corpseMapEntry->entrance_map))
|
||||
{
|
||||
mapid = corpseMapEntry->entrance_map;
|
||||
mapID = corpseMapEntry->entrance_map;
|
||||
x = corpseMapEntry->entrance_x;
|
||||
y = corpseMapEntry->entrance_y;
|
||||
z = entranceMap->GetHeight(GetPlayer()->GetPhaseMask(), x, y, MAX_HEIGHT);
|
||||
@@ -263,11 +261,11 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
|
||||
|
||||
WorldPacket data(MSG_CORPSE_QUERY, 1 + (6 * 4));
|
||||
data << uint8(1); // corpse found
|
||||
data << int32(mapid);
|
||||
data << int32(mapID);
|
||||
data << float(x);
|
||||
data << float(y);
|
||||
data << float(z);
|
||||
data << int32(corpsemapid);
|
||||
data << int32(corpseMapID);
|
||||
data << uint32(0); // unknown
|
||||
SendPacket(&data);
|
||||
}
|
||||
@@ -275,7 +273,7 @@ void WorldSession::HandleCorpseQueryOpcode(WorldPacket& /*recvData*/)
|
||||
void WorldSession::HandleNpcTextQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 textID;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> textID;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
uint32 questStatus = DIALOG_STATUS_NONE;
|
||||
|
||||
@@ -36,7 +36,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
|
||||
if (!questGiver)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (Typeid: %u GUID: %u)", GuidHigh2TypeId(GUID_HIPART(guid)), GUID_LOPART(guid));
|
||||
LOG_DEBUG("server", "Error in CMSG_QUESTGIVER_STATUS_QUERY, called for not found questgiver (%s)", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -46,7 +46,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
|
||||
case TYPEID_UNIT:
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc, guid = %u", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for npc %s", guid.ToString().c_str());
|
||||
#endif
|
||||
if (!questGiver->ToCreature()->IsHostileTo(_player)) // do not show quest status to enemies
|
||||
questStatus = _player->GetQuestDialogStatus(questGiver);
|
||||
@@ -55,7 +55,7 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
|
||||
case TYPEID_GAMEOBJECT:
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject guid = %u", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_STATUS_QUERY for GameObject %s", guid.ToString().c_str());
|
||||
#endif
|
||||
questStatus = _player->GetQuestDialogStatus(questGiver);
|
||||
break;
|
||||
@@ -71,18 +71,18 @@ void WorldSession::HandleQuestgiverStatusQueryOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_HELLO npc %s", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
if (!creature)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guid));
|
||||
LOG_DEBUG("network", "WORLD: HandleQuestgiverHelloOpcode - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -110,13 +110,13 @@ void WorldSession::HandleQuestgiverHelloOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 questId;
|
||||
uint32 unk1;
|
||||
recvData >> guid >> questId >> unk1;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_ACCEPT_QUEST npc %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1);
|
||||
#endif
|
||||
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT | TYPEMASK_ITEM | TYPEMASK_PLAYER);
|
||||
@@ -126,7 +126,7 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
(object->GetTypeId() == TYPEID_PLAYER && !object->ToPlayer()->CanShareQuest(questId)))
|
||||
{
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
_player->SetDivider(0);
|
||||
_player->SetDivider();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -147,17 +147,17 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
if (!GetPlayer()->CanTakeQuest(quest, true))
|
||||
{
|
||||
_player->PlayerTalkClass->SendCloseGossip();
|
||||
_player->SetDivider(0);
|
||||
_player->SetDivider();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_player->GetDivider() != 0)
|
||||
if (_player->GetDivider())
|
||||
{
|
||||
Player* player = ObjectAccessor::GetPlayer(*_player, _player->GetDivider());
|
||||
if (player)
|
||||
{
|
||||
player->SendPushToPartyResponse(_player, QUEST_PARTY_MSG_ACCEPT_QUEST);
|
||||
_player->SetDivider(0);
|
||||
_player->SetDivider();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,12 +202,12 @@ void WorldSession::HandleQuestgiverAcceptQuestOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleQuestgiverQueryQuestOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 questId;
|
||||
uint8 unk1;
|
||||
recvData >> guid >> questId >> unk1;
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc = %u, quest = %u, unk1 = %u", uint32(GUID_LOPART(guid)), questId, unk1);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_QUERY_QUEST npc %s, quest = %u, unk1 = %u", guid.ToString().c_str(), questId, unk1);
|
||||
#endif
|
||||
|
||||
// Verify that the guid is valid and is a questgiver or involved in the requested quest
|
||||
@@ -254,17 +254,18 @@ void WorldSession::HandleQuestQueryOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 questId, reward;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid >> questId >> reward;
|
||||
|
||||
if (reward >= QUEST_REWARD_CHOICES_COUNT)
|
||||
{
|
||||
LOG_ERROR("server", "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (guid %d) tried to get invalid reward (%u) (probably packet hacking)", _player->GetName().c_str(), _player->GetGUIDLow(), reward);
|
||||
LOG_ERROR("server", "Error in CMSG_QUESTGIVER_CHOOSE_REWARD: player %s (%s) tried to get invalid reward (%u) (probably packet hacking)",
|
||||
_player->GetName().c_str(), _player->GetGUID().ToString().c_str(), reward);
|
||||
return;
|
||||
}
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc = %u, quest = %u, reward = %u", uint32(GUID_LOPART(guid)), questId, reward);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_CHOOSE_REWARD npc %s, quest = %u, reward = %u", guid.ToString().c_str(), questId, reward);
|
||||
#endif
|
||||
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
|
||||
@@ -280,8 +281,8 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
|
||||
if ((!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE) ||
|
||||
(_player->GetQuestStatus(questId) != QUEST_STATUS_COMPLETE && !quest->IsAutoComplete()))
|
||||
{
|
||||
LOG_ERROR("server", "HACK ALERT: Player %s (guid: %u) is trying to complete quest (id: %u) but he has no right to do it!",
|
||||
_player->GetName().c_str(), _player->GetGUIDLow(), questId);
|
||||
LOG_ERROR("server", "HACK ALERT: Player %s (%s) is trying to complete quest (id: %u) but he has no right to do it!",
|
||||
_player->GetName().c_str(), _player->GetGUID().ToString().c_str(), questId);
|
||||
return;
|
||||
}
|
||||
if (_player->CanRewardQuest(quest, reward, true))
|
||||
@@ -342,11 +343,11 @@ void WorldSession::HandleQuestgiverChooseRewardOpcode(WorldPacket& recvData)
|
||||
void WorldSession::HandleQuestgiverRequestRewardOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint32 questId;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid >> questId;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_REQUEST_REWARD npc %s, quest = %u", guid.ToString().c_str(), questId);
|
||||
#endif
|
||||
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
|
||||
@@ -427,7 +428,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData)
|
||||
sEluna->OnQuestAbandon(_player, questId);
|
||||
#endif
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "Player %u abandoned quest %u", _player->GetGUIDLow(), questId);
|
||||
LOG_DEBUG("server", "Player %s abandoned quest %u", _player->GetGUID().ToString().c_str(), questId);
|
||||
#endif
|
||||
// check if Quest Tracker is enabled
|
||||
if (sWorld->getBoolConfig(CONFIG_QUEST_ENABLE_QUEST_TRACKER))
|
||||
@@ -435,7 +436,7 @@ void WorldSession::HandleQuestLogRemoveQuest(WorldPacket& recvData)
|
||||
// prepare Quest Tracker datas
|
||||
auto stmt = CharacterDatabase.GetPreparedStatement(CHAR_UPD_QUEST_TRACK_ABANDON_TIME);
|
||||
stmt->setUInt32(0, questId);
|
||||
stmt->setUInt32(1, _player->GetGUIDLow());
|
||||
stmt->setUInt32(1, _player->GetGUID().GetCounter());
|
||||
|
||||
// add to Quest Tracker
|
||||
CharacterDatabase.Execute(stmt);
|
||||
@@ -481,19 +482,19 @@ void WorldSession::HandleQuestConfirmAccept(WorldPacket& recvData)
|
||||
if (_player->CanAddQuest(quest, true))
|
||||
_player->AddQuestAndCheckCompletion(quest, nullptr); // nullptr, this prevent DB script from duplicate running
|
||||
|
||||
_player->SetDivider(0);
|
||||
_player->SetDivider();
|
||||
}
|
||||
}
|
||||
|
||||
void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
|
||||
{
|
||||
uint32 questId;
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid >> questId;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc = %u, quest = %u", uint32(GUID_LOPART(guid)), questId);
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_QUESTGIVER_COMPLETE_QUEST npc %s, quest = %u", guid.ToString().c_str(), questId);
|
||||
#endif
|
||||
|
||||
Object* object = ObjectAccessor::GetObjectByTypeMask(*_player, guid, TYPEMASK_UNIT | TYPEMASK_GAMEOBJECT);
|
||||
@@ -508,8 +509,8 @@ void WorldSession::HandleQuestgiverCompleteQuest(WorldPacket& recvData)
|
||||
{
|
||||
if (!_player->CanSeeStartQuest(quest) && _player->GetQuestStatus(questId) == QUEST_STATUS_NONE)
|
||||
{
|
||||
LOG_ERROR("server", "Possible hacking attempt: Player %s [guid: %u] tried to complete quest [entry: %u] without being in possession of the quest!",
|
||||
_player->GetName().c_str(), _player->GetGUIDLow(), questId);
|
||||
LOG_ERROR("server", "Possible hacking attempt: Player %s [%s] tried to complete quest [entry: %u] without being in possession of the quest!",
|
||||
_player->GetName().c_str(), _player->GetGUID().ToString().c_str(), questId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -599,7 +600,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
||||
}
|
||||
}
|
||||
|
||||
if (player->GetDivider() != 0)
|
||||
if (player->GetDivider())
|
||||
{
|
||||
_player->SendPushToPartyResponse(player, QUEST_PARTY_MSG_BUSY);
|
||||
continue;
|
||||
@@ -624,7 +625,7 @@ void WorldSession::HandlePushQuestToParty(WorldPacket& recvPacket)
|
||||
|
||||
void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 questId;
|
||||
uint8 msg;
|
||||
recvPacket >> guid >> questId >> msg;
|
||||
@@ -638,10 +639,10 @@ void WorldSession::HandleQuestPushResult(WorldPacket& recvPacket)
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*_player, _player->GetDivider()))
|
||||
{
|
||||
WorldPacket data(MSG_QUEST_PUSH_RESULT, 8 + 4 + 1);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << _player->GetGUID();
|
||||
data << uint8(msg); // valid values: 0-8
|
||||
player->GetSession()->SendPacket(&data);
|
||||
_player->SetDivider(0);
|
||||
_player->SetDivider();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -657,11 +658,11 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
|
||||
WorldPacket data(SMSG_QUESTGIVER_STATUS_MULTIPLE, 4);
|
||||
data << uint32(count); // placeholder
|
||||
|
||||
for (Player::ClientGUIDs::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
|
||||
for (GuidUnorderedSet::const_iterator itr = _player->m_clientGUIDs.begin(); itr != _player->m_clientGUIDs.end(); ++itr)
|
||||
{
|
||||
uint32 questStatus = DIALOG_STATUS_NONE;
|
||||
|
||||
if (IS_CRE_OR_VEH_OR_PET_GUID(*itr))
|
||||
if ((*itr).IsAnyTypeCreature())
|
||||
{
|
||||
// need also pet quests case support
|
||||
Creature* questgiver = ObjectAccessor::GetCreatureOrPetOrVehicle(*GetPlayer(), *itr);
|
||||
@@ -672,11 +673,11 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
|
||||
|
||||
questStatus = _player->GetQuestDialogStatus(questgiver);
|
||||
|
||||
data << uint64(questgiver->GetGUID());
|
||||
data << questgiver->GetGUID();
|
||||
data << uint8(questStatus);
|
||||
++count;
|
||||
}
|
||||
else if (IS_GAMEOBJECT_GUID(*itr))
|
||||
else if ((*itr).IsGameObject())
|
||||
{
|
||||
GameObject* questgiver = GetPlayer()->GetMap()->GetGameObject(*itr);
|
||||
if (!questgiver || questgiver->GetGoType() != GAMEOBJECT_TYPE_QUESTGIVER)
|
||||
@@ -684,7 +685,7 @@ void WorldSession::HandleQuestgiverStatusMultipleQuery(WorldPacket& /*recvPacket
|
||||
|
||||
questStatus = _player->GetQuestDialogStatus(questgiver);
|
||||
|
||||
data << uint64(questgiver->GetGUID());
|
||||
data << questgiver->GetGUID();
|
||||
data << uint8(questStatus);
|
||||
++count;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,10 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_GRANT_LEVEL");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
Player* target = ObjectAccessor::GetObjectInWorld(guid, _player);
|
||||
Player* target = ObjectAccessor::GetPlayer(*_player, guid);
|
||||
|
||||
// check cheating
|
||||
uint8 levels = _player->GetGrantableLevels();
|
||||
@@ -51,7 +51,7 @@ void WorldSession::HandleGrantLevel(WorldPacket& recvData)
|
||||
}
|
||||
|
||||
WorldPacket data2(SMSG_PROPOSE_LEVEL_GRANT, 8);
|
||||
data2.append(_player->GetPackGUID());
|
||||
data2 << _player->GetPackGUID();
|
||||
target->GetSession()->SendPacket(&data2);
|
||||
}
|
||||
|
||||
@@ -61,10 +61,10 @@ void WorldSession::HandleAcceptGrantLevel(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_ACCEPT_LEVEL_GRANT");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
Player* other = ObjectAccessor::GetObjectInWorld(guid, _player);
|
||||
Player* other = ObjectAccessor::GetPlayer(*_player, guid);
|
||||
if (!other)
|
||||
return;
|
||||
|
||||
|
||||
@@ -55,14 +55,14 @@ void WorldSession::HandleTalentWipeConfirmOpcode(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "MSG_TALENT_WIPE_CONFIRM");
|
||||
#endif
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
Creature* unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleTalentWipeConfirmOpcode - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -40,15 +40,14 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
|
||||
LOG_DEBUG("network", "WORLD: %s asked to add friend : '%s'", GetPlayer()->GetName().c_str(), friendName.c_str());
|
||||
|
||||
// xinef: Get Data From global storage
|
||||
uint32 guidLow = sWorld->GetGlobalPlayerGUID(friendName);
|
||||
if (!guidLow)
|
||||
ObjectGuid friendGuid = sWorld->GetGlobalPlayerGUID(friendName);
|
||||
if (!friendGuid)
|
||||
return;
|
||||
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(guidLow);
|
||||
GlobalPlayerData const* playerData = sWorld->GetGlobalPlayerData(friendGuid.GetCounter());
|
||||
if (!playerData)
|
||||
return;
|
||||
|
||||
uint64 friendGuid = MAKE_NEW_GUID(guidLow, 0, HIGHGUID_PLAYER);
|
||||
uint32 friendAccountId = playerData->accountId;
|
||||
TeamId teamId = Player::TeamIdForRace(playerData->race);
|
||||
FriendsResult friendResult = FRIEND_NOT_FOUND;
|
||||
@@ -61,11 +60,11 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
|
||||
friendResult = FRIEND_SELF;
|
||||
else if (GetPlayer()->GetTeamId() != teamId && !sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_ADD_FRIEND) && AccountMgr::IsPlayerAccount(GetSecurity()))
|
||||
friendResult = FRIEND_ENEMY;
|
||||
else if (GetPlayer()->GetSocial()->HasFriend(guidLow))
|
||||
else if (GetPlayer()->GetSocial()->HasFriend(friendGuid))
|
||||
friendResult = FRIEND_ALREADY;
|
||||
else
|
||||
{
|
||||
Player* pFriend = ObjectAccessor::FindPlayerInOrOutOfWorld(friendGuid);
|
||||
Player* pFriend = ObjectAccessor::FindConnectedPlayer(friendGuid);
|
||||
if (pFriend && pFriend->IsVisibleGloballyFor(GetPlayer()) && !AccountMgr::IsGMAccount(pFriend->GetSession()->GetSecurity()))
|
||||
friendResult = FRIEND_ADDED_ONLINE;
|
||||
else
|
||||
@@ -75,23 +74,23 @@ void WorldSession::HandleAddFriendOpcode(WorldPacket& recv_data)
|
||||
else
|
||||
friendResult = FRIEND_LIST_FULL;
|
||||
}
|
||||
GetPlayer()->GetSocial()->SetFriendNote(guidLow, friendNote);
|
||||
GetPlayer()->GetSocial()->SetFriendNote(friendGuid, friendNote);
|
||||
}
|
||||
}
|
||||
|
||||
sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, guidLow, false);
|
||||
sSocialMgr->SendFriendStatus(GetPlayer(), friendResult, friendGuid, false);
|
||||
|
||||
LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
|
||||
}
|
||||
|
||||
void WorldSession::HandleDelFriendOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 FriendGUID;
|
||||
ObjectGuid FriendGUID;
|
||||
recv_data >> FriendGUID;
|
||||
|
||||
_player->GetSocial()->RemoveFromSocialList(GUID_LOPART(FriendGUID), SOCIAL_FLAG_FRIEND);
|
||||
_player->GetSocial()->RemoveFromSocialList(FriendGUID, SOCIAL_FLAG_FRIEND);
|
||||
|
||||
sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, GUID_LOPART(FriendGUID), false);
|
||||
sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_REMOVED, FriendGUID, false);
|
||||
|
||||
LOG_DEBUG("network", "WORLD: Sent motd (SMSG_FRIEND_STATUS)");
|
||||
}
|
||||
@@ -107,44 +106,43 @@ void WorldSession::HandleAddIgnoreOpcode(WorldPacket& recv_data)
|
||||
|
||||
LOG_DEBUG("network", "WORLD: %s asked to Ignore: '%s'", GetPlayer()->GetName().c_str(), ignoreName.c_str());
|
||||
|
||||
uint32 lowGuid = sWorld->GetGlobalPlayerGUID(ignoreName);
|
||||
if (!lowGuid)
|
||||
ObjectGuid ignoreGuid = sWorld->GetGlobalPlayerGUID(ignoreName);
|
||||
if (!ignoreGuid)
|
||||
return;
|
||||
|
||||
uint64 IgnoreGuid = MAKE_NEW_GUID(lowGuid, 0, HIGHGUID_PLAYER);
|
||||
FriendsResult ignoreResult;
|
||||
|
||||
if (IgnoreGuid == GetPlayer()->GetGUID()) //not add yourself
|
||||
if (ignoreGuid == GetPlayer()->GetGUID()) //not add yourself
|
||||
ignoreResult = FRIEND_IGNORE_SELF;
|
||||
else if (GetPlayer()->GetSocial()->HasIgnore(lowGuid))
|
||||
else if (GetPlayer()->GetSocial()->HasIgnore(ignoreGuid))
|
||||
ignoreResult = FRIEND_IGNORE_ALREADY;
|
||||
else
|
||||
{
|
||||
ignoreResult = FRIEND_IGNORE_ADDED;
|
||||
|
||||
// ignore list full
|
||||
if (!GetPlayer()->GetSocial()->AddToSocialList(lowGuid, SOCIAL_FLAG_IGNORED))
|
||||
if (!GetPlayer()->GetSocial()->AddToSocialList(ignoreGuid, SOCIAL_FLAG_IGNORED))
|
||||
ignoreResult = FRIEND_IGNORE_FULL;
|
||||
}
|
||||
|
||||
sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, lowGuid, false);
|
||||
sSocialMgr->SendFriendStatus(GetPlayer(), ignoreResult, ignoreGuid, false);
|
||||
|
||||
LOG_DEBUG("network", "WORLD: Sent (SMSG_FRIEND_STATUS)");
|
||||
}
|
||||
|
||||
void WorldSession::HandleDelIgnoreOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 IgnoreGUID;
|
||||
ObjectGuid IgnoreGUID;
|
||||
recv_data >> IgnoreGUID;
|
||||
|
||||
_player->GetSocial()->RemoveFromSocialList(GUID_LOPART(IgnoreGUID), SOCIAL_FLAG_IGNORED);
|
||||
sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, GUID_LOPART(IgnoreGUID), false);
|
||||
_player->GetSocial()->RemoveFromSocialList(IgnoreGUID, SOCIAL_FLAG_IGNORED);
|
||||
sSocialMgr->SendFriendStatus(GetPlayer(), FRIEND_IGNORE_REMOVED, IgnoreGUID, false);
|
||||
}
|
||||
|
||||
void WorldSession::HandleSetContactNotesOpcode(WorldPacket& recv_data)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::string note;
|
||||
recv_data >> guid >> note;
|
||||
_player->GetSocial()->SetFriendNote(GUID_LOPART(guid), note);
|
||||
_player->GetSocial()->SetFriendNote(guid, note);
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ void WorldSession::HandleUseItemOpcode(WorldPacket& recvPacket)
|
||||
|
||||
uint8 bagIndex, slot, castFlags;
|
||||
uint8 castCount; // next cast if exists (single or not)
|
||||
uint64 itemGUID;
|
||||
ObjectGuid itemGUID;
|
||||
uint32 glyphIndex; // something to do with glyphs?
|
||||
uint32 spellId; // casted spell id
|
||||
|
||||
@@ -208,8 +208,8 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||
if (!(proto->Flags & ITEM_FLAG_HAS_LOOT) && !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED))
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_CANT_DO_RIGHT_NOW, item, nullptr);
|
||||
LOG_ERROR("server", "Possible hacking attempt: Player %s [guid: %u] tried to open item [guid: %u, entry: %u] which is not openable!",
|
||||
pUser->GetName().c_str(), pUser->GetGUIDLow(), item->GetGUIDLow(), proto->ItemId);
|
||||
LOG_ERROR("server", "Possible hacking attempt: Player %s [%s] tried to open item [%s, entry: %u] which is not openable!",
|
||||
pUser->GetName().c_str(), pUser->GetGUID().ToString().c_str(), item->GetGUID().ToString().c_str(), proto->ItemId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -222,7 +222,7 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||
if (!lockInfo)
|
||||
{
|
||||
pUser->SendEquipError(EQUIP_ERR_ITEM_LOCKED, item, nullptr);
|
||||
LOG_ERROR("server", "WORLD::OpenItem: item [guid = %u] has an unknown lockId: %u!", item->GetGUIDLow(), lockId);
|
||||
LOG_ERROR("server", "WORLD::OpenItem: item [%s] has an unknown lockId: %u!", item->GetGUID().ToString().c_str(), lockId);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -238,18 +238,18 @@ void WorldSession::HandleOpenItemOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_SEL_CHARACTER_GIFT_BY_ITEM);
|
||||
|
||||
stmt->setUInt32(0, item->GetGUIDLow());
|
||||
stmt->setUInt32(0, item->GetGUID().GetCounter());
|
||||
|
||||
_openWrappedItemCallback.SetFirstParam(bagIndex);
|
||||
_openWrappedItemCallback.SetSecondParam(slot);
|
||||
_openWrappedItemCallback.SetThirdParam(item->GetGUIDLow());
|
||||
_openWrappedItemCallback.SetThirdParam(item->GetGUID().GetCounter());
|
||||
_openWrappedItemCallback.SetFutureResult(CharacterDatabase.AsyncQuery(stmt));
|
||||
}
|
||||
else
|
||||
pUser->SendLoot(item->GetGUID(), LOOT_CORPSE);
|
||||
}
|
||||
|
||||
void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uint8 bagIndex, uint8 slot, uint32 itemLowGUID)
|
||||
void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uint8 bagIndex, uint8 slot, ObjectGuid::LowType itemLowGUID)
|
||||
{
|
||||
if (!GetPlayer())
|
||||
return;
|
||||
@@ -258,12 +258,12 @@ void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uin
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
if (item->GetGUIDLow() != itemLowGUID || !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED)) // during getting result, gift was swapped with another item
|
||||
if (item->GetGUID().GetCounter() != itemLowGUID || !item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED)) // during getting result, gift was swapped with another item
|
||||
return;
|
||||
|
||||
if (!result)
|
||||
{
|
||||
LOG_ERROR("server", "Wrapped item %u don't have record in character_gifts table and will deleted", item->GetGUIDLow());
|
||||
LOG_ERROR("server", "Wrapped item %s don't have record in character_gifts table and will deleted", item->GetGUID().ToString().c_str());
|
||||
GetPlayer()->DestroyItem(item->GetBagSlot(), item->GetSlot(), true);
|
||||
return;
|
||||
}
|
||||
@@ -274,7 +274,7 @@ void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uin
|
||||
uint32 entry = fields[0].GetUInt32();
|
||||
uint32 flags = fields[1].GetUInt32();
|
||||
|
||||
item->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, 0);
|
||||
item->SetGuidValue(ITEM_FIELD_GIFTCREATOR, ObjectGuid::Empty);
|
||||
item->SetEntry(entry);
|
||||
item->SetUInt32Value(ITEM_FIELD_FLAGS, flags);
|
||||
item->SetUInt32Value(ITEM_FIELD_MAXDURABILITY, item->GetTemplate()->MaxDurability);
|
||||
@@ -283,7 +283,7 @@ void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uin
|
||||
GetPlayer()->SaveInventoryAndGoldToDB(trans);
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_DEL_GIFT);
|
||||
stmt->setUInt32(0, item->GetGUIDLow());
|
||||
stmt->setUInt32(0, item->GetGUID().GetCounter());
|
||||
trans->Append(stmt);
|
||||
|
||||
CharacterDatabase.CommitTransaction(trans);
|
||||
@@ -291,11 +291,11 @@ void WorldSession::HandleOpenWrappedItemCallback(PreparedQueryResult result, uin
|
||||
|
||||
void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [guid=%u]", GUID_LOPART(guid));
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_USE Message [%s]", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
if (GameObject* obj = GetPlayer()->GetMap()->GetGameObject(guid))
|
||||
@@ -314,11 +314,11 @@ void WorldSession::HandleGameObjectUseOpcode(WorldPacket& recvData)
|
||||
|
||||
void WorldSession::HandleGameobjectReportUse(WorldPacket& recvPacket)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvPacket >> guid;
|
||||
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [in game guid: %u]", GUID_LOPART(guid));
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_GAMEOBJ_REPORT_USE Message [%s]", guid.ToString().c_str());
|
||||
#endif
|
||||
|
||||
// ignore for remote control state
|
||||
@@ -450,7 +450,7 @@ void WorldSession::HandleCastSpellOpcode(WorldPacket& recvPacket)
|
||||
spellInfo = actualSpellInfo;
|
||||
}
|
||||
|
||||
Spell* spell = new Spell(mover, spellInfo, TRIGGERED_NONE, 0, false);
|
||||
Spell* spell = new Spell(mover, spellInfo, TRIGGERED_NONE, ObjectGuid::Empty, false);
|
||||
|
||||
sScriptMgr->ValidateSpellAtCastSpellResult(_player, mover, spell, oldSpellId, spellId);
|
||||
|
||||
@@ -493,12 +493,12 @@ void WorldSession::HandleCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
}
|
||||
|
||||
// maybe should only remove one buff when there are multiple?
|
||||
_player->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL);
|
||||
_player->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
|
||||
}
|
||||
|
||||
void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 spellId;
|
||||
|
||||
recvPacket >> guid;
|
||||
@@ -515,13 +515,13 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
|
||||
if (!pet)
|
||||
{
|
||||
LOG_ERROR("server", "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %u by player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetCancelAura: Attempt to cancel an aura for non-existant pet %s by player %s", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (pet != GetPlayer()->GetGuardianPet() && pet != GetPlayer()->GetCharm())
|
||||
{
|
||||
LOG_ERROR("server", "HandlePetCancelAura: Pet %u is not a pet of player '%s'", uint32(GUID_LOPART(guid)), GetPlayer()->GetName().c_str());
|
||||
LOG_ERROR("server", "HandlePetCancelAura: Pet %s is not a pet of player %s", guid.ToString().c_str(), GetPlayer()->GetName().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -531,7 +531,7 @@ void WorldSession::HandlePetCancelAuraOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
pet->RemoveOwnedAura(spellId, 0, 0, AURA_REMOVE_BY_CANCEL);
|
||||
pet->RemoveOwnedAura(spellId, ObjectGuid::Empty, 0, AURA_REMOVE_BY_CANCEL);
|
||||
|
||||
pet->AddSpellCooldown(spellId, 0, 0);
|
||||
}
|
||||
@@ -606,7 +606,7 @@ void WorldSession::HandleSelfResOpcode(WorldPacket& /*recvData*/)
|
||||
|
||||
void WorldSession::HandleSpellClick(WorldPacket& recvData)
|
||||
{
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
// this will get something not in world. crash
|
||||
@@ -627,11 +627,11 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_GET_MIRRORIMAGE_DATA");
|
||||
#endif
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
// Get unit for which data is needed by client
|
||||
Unit* unit = ObjectAccessor::GetObjectInWorld(guid, (Unit*)nullptr);
|
||||
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
|
||||
if (!unit)
|
||||
return;
|
||||
|
||||
@@ -644,7 +644,7 @@ void WorldSession::HandleMirrorImageDataRequest(WorldPacket& recvData)
|
||||
return;
|
||||
|
||||
WorldPacket data(SMSG_MIRRORIMAGE_DATA, 68);
|
||||
data << uint64(guid);
|
||||
data << guid;
|
||||
data << uint32(creator->GetDisplayId());
|
||||
data << uint8(creator->getRace());
|
||||
data << uint8(creator->getGender());
|
||||
@@ -723,7 +723,7 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket)
|
||||
LOG_DEBUG("network", "WORLD: CMSG_UPDATE_PROJECTILE_POSITION");
|
||||
#endif
|
||||
|
||||
uint64 casterGuid;
|
||||
ObjectGuid casterGuid;
|
||||
uint32 spellId;
|
||||
uint8 castCount;
|
||||
float x, y, z; // Position of missile hit
|
||||
@@ -748,7 +748,7 @@ void WorldSession::HandleUpdateProjectilePosition(WorldPacket& recvPacket)
|
||||
spell->m_targets.ModDst(pos);
|
||||
|
||||
WorldPacket data(SMSG_SET_PROJECTILE_POSITION, 21);
|
||||
data << uint64(casterGuid);
|
||||
data << casterGuid;
|
||||
data << uint8(castCount);
|
||||
data << float(x);
|
||||
data << float(y);
|
||||
|
||||
@@ -21,20 +21,20 @@ void WorldSession::HandleTaxiNodeStatusQueryOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_TAXINODE_STATUS_QUERY");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
|
||||
recvData >> guid;
|
||||
SendTaxiStatus(guid);
|
||||
}
|
||||
|
||||
void WorldSession::SendTaxiStatus(uint64 guid)
|
||||
void WorldSession::SendTaxiStatus(ObjectGuid guid)
|
||||
{
|
||||
// cheating checks
|
||||
Creature* unit = GetPlayer()->GetMap()->GetCreature(guid);
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WorldSession::SendTaxiStatus - Unit (GUID: %u) not found.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WorldSession::SendTaxiStatus - Unit (%s) not found.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -64,7 +64,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_TAXIQUERYAVAILABLENODES");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
recvData >> guid;
|
||||
|
||||
// cheating checks
|
||||
@@ -72,7 +72,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes(WorldPacket& recvData)
|
||||
if (!unit)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleTaxiQueryAvailableNodes - Unit (%s) not found or you can't interact with him.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ void WorldSession::SendTaxiMenu(Creature* unit)
|
||||
|
||||
WorldPacket data(SMSG_SHOWTAXINODES, (4 + 8 + 4 + 8 * 4));
|
||||
data << uint32(1);
|
||||
data << uint64(unit->GetGUID());
|
||||
data << unit->GetGUID();
|
||||
data << uint32(curloc);
|
||||
GetPlayer()->m_taxi.AppendTaximaskTo(data, GetPlayer()->isTaxiCheater());
|
||||
SendPacket(&data);
|
||||
@@ -147,7 +147,7 @@ bool WorldSession::SendLearnNewTaxiNode(Creature* unit)
|
||||
SendPacket(&msg);
|
||||
|
||||
WorldPacket update(SMSG_TAXINODE_STATUS, 9);
|
||||
update << uint64(unit->GetGUID());
|
||||
update << unit->GetGUID();
|
||||
update << uint8(1);
|
||||
SendPacket(&update);
|
||||
|
||||
@@ -172,7 +172,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXIEXPRESS");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
uint32 node_count;
|
||||
|
||||
recvData >> guid >> node_count;
|
||||
@@ -181,7 +181,7 @@ void WorldSession::HandleActivateTaxiExpressOpcode (WorldPacket& recvData)
|
||||
if (!npc)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleActivateTaxiExpressOpcode - Unit (%s) not found or you can't interact with it.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -218,8 +218,8 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_MOVE_SPLINE_DONE");
|
||||
#endif
|
||||
|
||||
uint64 guid; // used only for proper packet read
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid; // used only for proper packet read
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
MovementInfo movementInfo; // used only for proper packet read
|
||||
movementInfo.guid = guid;
|
||||
@@ -234,7 +234,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Received CMSG_ACTIVATETAXI");
|
||||
#endif
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
std::vector<uint32> nodes;
|
||||
nodes.resize(2);
|
||||
|
||||
@@ -246,7 +246,7 @@ void WorldSession::HandleActivateTaxiOpcode(WorldPacket& recvData)
|
||||
if (!npc)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)));
|
||||
LOG_DEBUG("network", "WORLD: HandleActivateTaxiOpcode - Unit (%s) not found or you can't interact with it.", guid.ToString().c_str());
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -33,7 +33,7 @@ void WorldSession::HandleGMTicketCreateOpcode(WorldPacket& recvData)
|
||||
GmTicket* ticket = sTicketMgr->GetTicketByPlayer(GetPlayer()->GetGUID());
|
||||
|
||||
if (ticket && ticket->IsCompleted())
|
||||
sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID());;
|
||||
sTicketMgr->CloseTicket(ticket->GetId(), GetPlayer()->GetGUID());
|
||||
|
||||
// Player must not have ticket
|
||||
if (!ticket || ticket->IsClosed())
|
||||
@@ -207,7 +207,7 @@ void WorldSession::HandleGMSurveySubmit(WorldPacket& recv_data)
|
||||
recv_data >> comment;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_GM_SURVEY);
|
||||
stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID()));
|
||||
stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter());
|
||||
stmt->setUInt32(1, nextSurveyID);
|
||||
stmt->setUInt32(2, mainSurvey);
|
||||
stmt->setString(3, comment);
|
||||
@@ -230,7 +230,7 @@ void WorldSession::HandleReportLag(WorldPacket& recv_data)
|
||||
recv_data >> z;
|
||||
|
||||
PreparedStatement* stmt = CharacterDatabase.GetPreparedStatement(CHAR_INS_LAG_REPORT);
|
||||
stmt->setUInt32(0, GUID_LOPART(GetPlayer()->GetGUID()));
|
||||
stmt->setUInt32(0, GetPlayer()->GetGUID().GetCounter());
|
||||
stmt->setUInt8 (1, lagType);
|
||||
stmt->setUInt16(2, mapId);
|
||||
stmt->setFloat (3, x);
|
||||
|
||||
@@ -60,7 +60,7 @@ void WorldSession::SendTradeStatus(TradeStatus status)
|
||||
void WorldSession::HandleIgnoreTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Ignore Trade %u", _player->GetGUIDLow());
|
||||
LOG_DEBUG("network", "WORLD: Ignore Trade %s", _player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
// recvPacket.print_storage();
|
||||
}
|
||||
@@ -68,7 +68,7 @@ void WorldSession::HandleIgnoreTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
void WorldSession::HandleBusyTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "WORLD: Busy Trade %u", _player->GetGUIDLow());
|
||||
LOG_DEBUG("network", "WORLD: Busy Trade %s", _player->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
// recvPacket.print_storage();
|
||||
}
|
||||
@@ -96,13 +96,13 @@ void WorldSession::SendUpdateTrade(bool trader_data /*= true*/)
|
||||
data << uint32(item->GetCount()); // stack count
|
||||
// wrapped: hide stats but show giftcreator name
|
||||
data << uint32(item->HasFlag(ITEM_FIELD_FLAGS, ITEM_FIELD_FLAG_WRAPPED) ? 1 : 0);
|
||||
data << uint64(item->GetUInt64Value(ITEM_FIELD_GIFTCREATOR));
|
||||
data << item->GetGuidValue(ITEM_FIELD_GIFTCREATOR);
|
||||
// perm. enchantment and gems
|
||||
data << uint32(item->GetEnchantmentId(PERM_ENCHANTMENT_SLOT));
|
||||
for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
|
||||
data << uint32(item->GetEnchantmentId(EnchantmentSlot(enchant_slot)));
|
||||
// creator
|
||||
data << uint64(item->GetUInt64Value(ITEM_FIELD_CREATOR));
|
||||
data << item->GetGuidValue(ITEM_FIELD_CREATOR);
|
||||
data << uint32(item->GetSpellCharges()); // charges
|
||||
data << uint32(item->GetItemSuffixFactor()); // SuffixFactor
|
||||
data << uint32(item->GetItemRandomPropertyId());// random properties id
|
||||
@@ -145,7 +145,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||
{
|
||||
// logging
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "partner storing: %u", myItems[i]->GetGUIDLow());
|
||||
LOG_DEBUG("network", "partner storing: %s", myItems[i]->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
|
||||
// adjust time (depends on /played)
|
||||
@@ -158,7 +158,7 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||
{
|
||||
// logging
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("network", "player storing: %u", hisItems[i]->GetGUIDLow());
|
||||
LOG_DEBUG("network", "player storing: %s", hisItems[i]->GetGUID().ToString().c_str());
|
||||
#endif
|
||||
|
||||
// adjust time (depends on /played)
|
||||
@@ -175,21 +175,21 @@ void WorldSession::moveItems(Item* myItems[], Item* hisItems[])
|
||||
if (myItems[i])
|
||||
{
|
||||
if (!traderCanTrade)
|
||||
LOG_ERROR("server", "trader can't store item: %u", myItems[i]->GetGUIDLow());
|
||||
LOG_ERROR("server", "trader can't store item: %s", myItems[i]->GetGUID().ToString().c_str());
|
||||
if (_player->CanStoreItem(NULL_BAG, NULL_SLOT, playerDst, myItems[i], false) == EQUIP_ERR_OK)
|
||||
_player->MoveItemToInventory(playerDst, myItems[i], true, true);
|
||||
else
|
||||
LOG_ERROR("server", "player can't take item back: %u", myItems[i]->GetGUIDLow());
|
||||
LOG_ERROR("server", "player can't take item back: %s", myItems[i]->GetGUID().ToString().c_str());
|
||||
}
|
||||
// return the already removed items to the original owner
|
||||
if (hisItems[i])
|
||||
{
|
||||
if (!playerCanTrade)
|
||||
LOG_ERROR("server", "player can't store item: %u", hisItems[i]->GetGUIDLow());
|
||||
LOG_ERROR("server", "player can't store item: %s", hisItems[i]->GetGUID().ToString().c_str());
|
||||
if (trader->CanStoreItem(NULL_BAG, NULL_SLOT, traderDst, hisItems[i], false) == EQUIP_ERR_OK)
|
||||
trader->MoveItemToInventory(traderDst, hisItems[i], true, true);
|
||||
else
|
||||
LOG_ERROR("server", "trader can't take item back: %u", hisItems[i]->GetGUIDLow());
|
||||
LOG_ERROR("server", "trader can't take item back: %s", hisItems[i]->GetGUID().ToString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -208,7 +208,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item * *
|
||||
if (Item* item = myTrade->GetItem(TradeSlots(i)))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "player trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
|
||||
LOG_DEBUG("server", "player trade item %s bag: %u slot: %u", item->GetGUID().ToString().c_str(), item->GetBagSlot(), item->GetSlot());
|
||||
#endif
|
||||
//Can return nullptr
|
||||
myItems[i] = item;
|
||||
@@ -218,7 +218,7 @@ static void setAcceptTradeMode(TradeData* myTrade, TradeData* hisTrade, Item * *
|
||||
if (Item* item = hisTrade->GetItem(TradeSlots(i)))
|
||||
{
|
||||
#if defined(ENABLE_EXTRAS) && defined(ENABLE_EXTRA_LOGS)
|
||||
LOG_DEBUG("server", "partner trade item %u bag: %u slot: %u", item->GetGUIDLow(), item->GetBagSlot(), item->GetSlot());
|
||||
LOG_DEBUG("server", "partner trade item %s bag: %u slot: %u", item->GetGUID().ToString().c_str(), item->GetBagSlot(), item->GetSlot());
|
||||
#endif
|
||||
hisItems[i] = item;
|
||||
hisItems[i]->SetInTrade();
|
||||
@@ -450,12 +450,12 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
{
|
||||
if (myItems[i])
|
||||
{
|
||||
myItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
|
||||
myItems[i]->SetGuidValue(ITEM_FIELD_GIFTCREATOR, _player->GetGUID());
|
||||
_player->MoveItemFromInventory(myItems[i]->GetBagSlot(), myItems[i]->GetSlot(), true);
|
||||
}
|
||||
if (hisItems[i])
|
||||
{
|
||||
hisItems[i]->SetUInt64Value(ITEM_FIELD_GIFTCREATOR, trader->GetGUID());
|
||||
hisItems[i]->SetGuidValue(ITEM_FIELD_GIFTCREATOR, trader->GetGUID());
|
||||
trader->MoveItemFromInventory(hisItems[i]->GetBagSlot(), hisItems[i]->GetSlot(), true);
|
||||
}
|
||||
}
|
||||
@@ -465,11 +465,13 @@ void WorldSession::HandleAcceptTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
|
||||
if( my_trade->GetMoney() >= 10 * GOLD )
|
||||
{
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<TRADE>\", NOW())", GetAccountId(), _player->GetGUIDLow(), _player->GetName().c_str(), GetRemoteAddress().c_str(), trader->GetSession()->GetAccountId(), trader->GetName().c_str(), my_trade->GetMoney());
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<TRADE>\", NOW())",
|
||||
GetAccountId(), _player->GetGUID().GetCounter(), _player->GetName().c_str(), GetRemoteAddress().c_str(), trader->GetSession()->GetAccountId(), trader->GetName().c_str(), my_trade->GetMoney());
|
||||
}
|
||||
if( his_trade->GetMoney() >= 10 * GOLD )
|
||||
{
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<TRADE>\", NOW())", trader->GetSession()->GetAccountId(), trader->GetGUIDLow(), trader->GetName().c_str(), trader->GetSession()->GetRemoteAddress().c_str(), GetAccountId(), _player->GetName().c_str(), his_trade->GetMoney());
|
||||
CharacterDatabase.PExecute("INSERT INTO log_money VALUES(%u, %u, \"%s\", \"%s\", %u, \"%s\", %u, \"<TRADE>\", NOW())",
|
||||
trader->GetSession()->GetAccountId(), trader->GetGUID().GetCounter(), trader->GetName().c_str(), trader->GetSession()->GetRemoteAddress().c_str(), GetAccountId(), _player->GetName().c_str(), his_trade->GetMoney());
|
||||
}
|
||||
|
||||
// update money
|
||||
@@ -540,7 +542,7 @@ void WorldSession::HandleCancelTradeOpcode(WorldPacket& /*recvPacket*/)
|
||||
|
||||
void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
{
|
||||
uint64 ID;
|
||||
ObjectGuid ID;
|
||||
recvPacket >> ID;
|
||||
|
||||
if (GetPlayer()->m_trade)
|
||||
@@ -617,7 +619,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetGUIDLow()))
|
||||
if (pOther->GetSocial()->HasIgnore(GetPlayer()->GetGUID()))
|
||||
{
|
||||
SendTradeStatus(TRADE_STATUS_IGNORE_YOU);
|
||||
return;
|
||||
@@ -650,7 +652,7 @@ void WorldSession::HandleInitiateTradeOpcode(WorldPacket& recvPacket)
|
||||
|
||||
WorldPacket data(SMSG_TRADE_STATUS, 12);
|
||||
data << uint32(TRADE_STATUS_BEGIN_TRADE);
|
||||
data << uint64(_player->GetGUID());
|
||||
data << _player->GetGUID();
|
||||
pOther->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
@@ -696,7 +698,7 @@ void WorldSession::HandleSetTradeItemOpcode(WorldPacket& recvPacket)
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 iGUID = item->GetGUID();
|
||||
ObjectGuid iGUID = item->GetGUID();
|
||||
|
||||
// prevent place single item into many trade slots using cheating and client bugs
|
||||
if (my_trade->HasItem(iGUID))
|
||||
|
||||
@@ -18,7 +18,7 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket& recvData)
|
||||
LOG_DEBUG("network", "WORLD: Recvd CMSG_DISMISS_CONTROLLED_VEHICLE");
|
||||
#endif
|
||||
|
||||
uint64 vehicleGUID = _player->GetCharmGUID();
|
||||
ObjectGuid vehicleGUID = _player->GetCharmGUID();
|
||||
|
||||
if (!vehicleGUID) // something wrong here...
|
||||
{
|
||||
@@ -26,9 +26,8 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket& recvData)
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 guid;
|
||||
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid;
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
// pussywizard: typical check for incomming movement packets
|
||||
if (!_player->m_mover || !_player->m_mover->IsInWorld() || _player->m_mover->IsDuringRemoveFromWorld() || guid != _player->m_mover->GetGUID())
|
||||
@@ -64,8 +63,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
if (!seat->CanSwitchFromSeat())
|
||||
{
|
||||
recvData.rfinish(); // prevent warnings spam
|
||||
LOG_ERROR("server", "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %u tried to switch seats but current seatflags %u don't permit that.",
|
||||
recvData.GetOpcode(), GetPlayer()->GetGUIDLow(), seat->m_flags);
|
||||
LOG_ERROR("server", "HandleChangeSeatsOnControlledVehicle, Opcode: %u, Player %s tried to switch seats but current seatflags %u don't permit that.",
|
||||
recvData.GetOpcode(), GetPlayer()->GetGUID().ToString().c_str(), seat->m_flags);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -79,8 +78,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
break;
|
||||
case CMSG_CHANGE_SEATS_ON_CONTROLLED_VEHICLE:
|
||||
{
|
||||
uint64 guid; // current vehicle guid
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid; // current vehicle guid
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
// pussywizard:
|
||||
if (vehicle_base->GetGUID() != guid)
|
||||
@@ -94,8 +93,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
ReadMovementInfo(recvData, &movementInfo);
|
||||
vehicle_base->m_movementInfo = movementInfo;
|
||||
|
||||
uint64 accessory; // accessory guid
|
||||
recvData.readPackGUID(accessory);
|
||||
ObjectGuid accessory; // accessory guid
|
||||
recvData >> accessory.ReadAsPacked();
|
||||
|
||||
int8 seatId;
|
||||
recvData >> seatId;
|
||||
@@ -112,8 +111,8 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
}
|
||||
case CMSG_REQUEST_VEHICLE_SWITCH_SEAT:
|
||||
{
|
||||
uint64 guid; // current vehicle guid
|
||||
recvData.readPackGUID(guid);
|
||||
ObjectGuid guid; // current vehicle guid
|
||||
recvData >> guid.ReadAsPacked();
|
||||
|
||||
int8 seatId;
|
||||
recvData >> seatId;
|
||||
@@ -134,7 +133,7 @@ void WorldSession::HandleChangeSeatsOnControlledVehicle(WorldPacket& recvData)
|
||||
void WorldSession::HandleEnterPlayerVehicle(WorldPacket& data)
|
||||
{
|
||||
// Read guid
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
data >> guid;
|
||||
|
||||
if (Player* player = ObjectAccessor::GetPlayer(*_player, guid))
|
||||
@@ -159,25 +158,25 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data)
|
||||
if (!vehicle)
|
||||
{
|
||||
data.rfinish(); // prevent warnings spam
|
||||
LOG_ERROR("server", "HandleEjectPassenger: Player %u is not in a vehicle!", GetPlayer()->GetGUIDLow());
|
||||
LOG_ERROR("server", "HandleEjectPassenger: Player %s is not in a vehicle!", GetPlayer()->GetGUID().ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
uint64 guid;
|
||||
ObjectGuid guid;
|
||||
data >> guid;
|
||||
|
||||
if (IS_PLAYER_GUID(guid))
|
||||
if (guid.IsPlayer())
|
||||
{
|
||||
Player* player = ObjectAccessor::GetPlayer(*_player, guid);
|
||||
if (!player)
|
||||
{
|
||||
LOG_ERROR("server", "Player %u tried to eject player %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s tried to eject player %s from vehicle, but the latter was not found in world!", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!player->IsOnVehicle(vehicle->GetBase()))
|
||||
{
|
||||
LOG_ERROR("server", "Player %u tried to eject player %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s tried to eject player %s, but they are not in the same vehicle", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -186,21 +185,20 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data)
|
||||
if (seat->IsEjectable())
|
||||
player->ExitVehicle();
|
||||
else
|
||||
LOG_ERROR("server", "Player %u attempted to eject player %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s attempted to eject player %s from non-ejectable seat.", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
}
|
||||
|
||||
else if (IS_CREATURE_GUID(guid))
|
||||
else if (guid.IsCreature())
|
||||
{
|
||||
Unit* unit = ObjectAccessor::GetUnit(*_player, guid);
|
||||
if (!unit) // creatures can be ejected too from player mounts
|
||||
{
|
||||
LOG_ERROR("server", "Player %u tried to eject creature guid %u from vehicle, but the latter was not found in world!", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s tried to eject creature guid %s from vehicle, but the latter was not found in world!", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
if (!unit->IsOnVehicle(vehicle->GetBase()))
|
||||
{
|
||||
LOG_ERROR("server", "Player %u tried to eject unit %u, but they are not in the same vehicle", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s tried to eject unit %s, but they are not in the same vehicle", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -212,10 +210,10 @@ void WorldSession::HandleEjectPassenger(WorldPacket& data)
|
||||
unit->ExitVehicle();
|
||||
}
|
||||
else
|
||||
LOG_ERROR("server", "Player %u attempted to eject creature GUID %u from non-ejectable seat.", GetPlayer()->GetGUIDLow(), GUID_LOPART(guid));
|
||||
LOG_ERROR("server", "Player %s attempted to eject creature %s from non-ejectable seat.", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
}
|
||||
else
|
||||
LOG_ERROR("server", "HandleEjectPassenger: Player %u tried to eject invalid GUID " UI64FMTD, GetPlayer()->GetGUIDLow(), guid);
|
||||
LOG_ERROR("server", "HandleEjectPassenger: Player %s tried to eject invalid %s", GetPlayer()->GetGUID().ToString().c_str(), guid.ToString().c_str());
|
||||
}
|
||||
|
||||
void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
|
||||
@@ -231,8 +229,8 @@ void WorldSession::HandleRequestVehicleExit(WorldPacket& /*recvData*/)
|
||||
if (seat->CanEnterOrExit())
|
||||
GetPlayer()->ExitVehicle();
|
||||
else
|
||||
LOG_ERROR("server", "Player %u tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.",
|
||||
GetPlayer()->GetGUIDLow(), seat->m_ID, seat->m_flags);
|
||||
LOG_ERROR("server", "Player %s tried to exit vehicle, but seatflags %u (ID: %u) don't permit that.",
|
||||
GetPlayer()->GetGUID().ToString().c_str(), seat->m_ID, seat->m_flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user