diff --git a/src/game/AuctionHouseHandler.cpp b/src/game/AuctionHouseHandler.cpp index 5ea820943..ad50e5d98 100644 --- a/src/game/AuctionHouseHandler.cpp +++ b/src/game/AuctionHouseHandler.cpp @@ -155,7 +155,7 @@ void WorldSession::SendAuctionOutbiddedMail(AuctionEntry *auction) Player *oldBidder = sObjectMgr.GetPlayer(oldBidder_guid); uint32 oldBidder_accId = 0; - if(!oldBidder && oldBidder_guid) + if(!oldBidder) oldBidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(oldBidder_guid); // old bidder exist @@ -180,7 +180,7 @@ void WorldSession::SendAuctionCancelledToBidderMail(AuctionEntry* auction) Player *bidder = sObjectMgr.GetPlayer(bidder_guid); uint32 bidder_accId = 0; - if (!bidder && bidder_guid) + if (!bidder) bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); // bidder exist @@ -409,7 +409,7 @@ void WorldSession::HandleAuctionPlaceBid(WorldPacket & recv_data) // impossible have online own another character (use this for speedup check in case online owner) Player* auction_owner = sObjectMgr.GetPlayer(ownerGuid); - if (!auction_owner && ownerGuid && sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid) == pl->GetSession()->GetAccountId()) + if (!auction_owner && sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid) == pl->GetSession()->GetAccountId()) { // you cannot bid your another character auction: SendAuctionCommandResult(NULL, AUCTION_BID_PLACED, AUCTION_ERR_BID_OWN); diff --git a/src/game/AuctionHouseMgr.cpp b/src/game/AuctionHouseMgr.cpp index be8a85192..28754ed85 100644 --- a/src/game/AuctionHouseMgr.cpp +++ b/src/game/AuctionHouseMgr.cpp @@ -104,7 +104,7 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction) } else { - bidder_accId = bidder_guid ? sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid) : 0; + bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); bidder_security = bidder_accId ? sAccountMgr.GetSecurity(bidder_accId) : SEC_PLAYER; if (bidder_security > SEC_PLAYER) // not do redundant DB requests @@ -122,13 +122,13 @@ void AuctionHouseMgr::SendAuctionWonMail(AuctionEntry *auction) else if (ownerGuid && !sObjectMgr.GetPlayerNameByGUID(ownerGuid, owner_name)) owner_name = sObjectMgr.GetMangosStringForDBCLocale(LANG_UNKNOWN); - uint32 owner_accid = ownerGuid ? sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid) : 0; + uint32 owner_accid = sObjectMgr.GetPlayerAccountIdByGUID(ownerGuid); sLog.outCommand(bidder_accId,"GM %s (Account: %u) won item in auction (Entry: %u Count: %u) and pay money: %u. Original owner %s (Account: %u)", bidder_name.c_str(), bidder_accId, auction->itemTemplate, auction->itemCount, auction->bid, owner_name.c_str(), owner_accid); } } - else if (!bidder && bidder_guid) + else if (!bidder) bidder_accId = sObjectMgr.GetPlayerAccountIdByGUID(bidder_guid); if (auction_owner) @@ -183,7 +183,7 @@ void AuctionHouseMgr::SendAuctionSuccessfulMail(AuctionEntry * auction) Player *owner = sObjectMgr.GetPlayer(owner_guid); uint32 owner_accId = 0; - if (!owner && owner_guid) + if (!owner) owner_accId = sObjectMgr.GetPlayerAccountIdByGUID(owner_guid); // owner exist diff --git a/src/game/MailHandler.cpp b/src/game/MailHandler.cpp index 84ada5d04..2f80ba2dd 100644 --- a/src/game/MailHandler.cpp +++ b/src/game/MailHandler.cpp @@ -514,7 +514,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) sender_accId = sender->GetSession()->GetAccountId(); sender_name = sender->GetName(); } - else + else if (sender_guid) { // can be calculated early sender_accId = sObjectMgr.GetPlayerAccountIdByGUID(sender_guid); @@ -525,7 +525,7 @@ void WorldSession::HandleMailTakeItem(WorldPacket & recv_data ) sLog.outCommand(GetAccountId(), "GM %s (Account: %u) receive mail item: %s (Entry: %u Count: %u) and send COD money: %u to player: %s (Account: %u)", GetPlayerName(), GetAccountId(), it->GetProto()->Name1, it->GetEntry(), it->GetCount(), m->COD, sender_name.c_str(), sender_accId); } - else if(!sender) + else if (!sender) sender_accId = sObjectMgr.GetPlayerAccountIdByGUID(sender_guid); // check player existence diff --git a/src/game/ObjectMgr.cpp b/src/game/ObjectMgr.cpp index dfd50b292..e49297186 100644 --- a/src/game/ObjectMgr.cpp +++ b/src/game/ObjectMgr.cpp @@ -1657,6 +1657,9 @@ Team ObjectMgr::GetPlayerTeamByGUID(ObjectGuid guid) const uint32 ObjectMgr::GetPlayerAccountIdByGUID(ObjectGuid guid) const { + if (!guid.IsPlayer()) + return 0; + // prevent DB access for online player if(Player* player = GetPlayer(guid)) return player->GetSession()->GetAccountId(); diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index ee31963d3..fc90d19a6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "11729" + #define REVISION_NR "11730" #endif // __REVISION_NR_H__