[7688] Move Get*IfCanInteractWith to Player including renamed IsGameObjectOfTypeInRange. Author: VladimirMangos
--HG-- branch : trunk
This commit is contained in:
@@ -41,7 +41,7 @@ void WorldSession::HandleAuctionHelloOpcode( WorldPacket & recv_data )
|
|||||||
uint64 guid; //NPC guid
|
uint64 guid; //NPC guid
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleAuctionHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -168,7 +168,7 @@ void WorldSession::HandleAuctionSellItem( WorldPacket & recv_data )
|
|||||||
if (!item || !bid || !etime)
|
if (!item || !bid || !etime)
|
||||||
return; //check for cheaters
|
return; //check for cheaters
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
|
sLog.outDebug( "WORLD: HandleAuctionSellItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
|
||||||
@@ -295,7 +295,7 @@ void WorldSession::HandleAuctionPlaceBid( WorldPacket & recv_data )
|
|||||||
if (!auctionId || !price)
|
if (!auctionId || !price)
|
||||||
return; //check for cheaters
|
return; //check for cheaters
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
|
sLog.outDebug( "WORLD: HandleAuctionPlaceBid - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
|
||||||
@@ -421,7 +421,7 @@ void WorldSession::HandleAuctionRemoveItem( WorldPacket & recv_data )
|
|||||||
recv_data >> auctionId;
|
recv_data >> auctionId;
|
||||||
//sLog.outDebug( "Cancel AUCTION AuctionID: %u", auctionId);
|
//sLog.outDebug( "Cancel AUCTION AuctionID: %u", auctionId);
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(auctioneer,UNIT_NPC_FLAG_AUCTIONEER);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
|
sLog.outDebug( "WORLD: HandleAuctionRemoveItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(auctioneer)) );
|
||||||
@@ -506,7 +506,7 @@ void WorldSession::HandleAuctionListBidderItems( WorldPacket & recv_data )
|
|||||||
outbiddedCount = 0;
|
outbiddedCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleAuctionListBidderItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -555,7 +555,7 @@ void WorldSession::HandleAuctionListOwnerItems( WorldPacket & recv_data )
|
|||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
recv_data >> listfrom; // not used in fact (this list not have page control in client)
|
recv_data >> listfrom; // not used in fact (this list not have page control in client)
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleAuctionListOwnerItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -602,7 +602,7 @@ void WorldSession::HandleAuctionListItems( WorldPacket & recv_data )
|
|||||||
recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
|
recv_data >> auctionSlotID >> auctionMainCategory >> auctionSubCategory;
|
||||||
recv_data >> quality >> usable;
|
recv_data >> quality >> usable;
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_AUCTIONEER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_AUCTIONEER);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleAuctionListItems - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
|
|||||||
@@ -782,7 +782,7 @@ void WorldSession::HandleGuildSaveEmblemOpcode(WorldPacket& recvPacket)
|
|||||||
|
|
||||||
recvPacket >> vendorGuid;
|
recvPacket >> vendorGuid;
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, vendorGuid,UNIT_NPC_FLAG_TABARDDESIGNER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorGuid,UNIT_NPC_FLAG_TABARDDESIGNER);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
//"That's not an emblem vendor!"
|
//"That's not an emblem vendor!"
|
||||||
@@ -905,7 +905,7 @@ void WorldSession::HandleGuildBankQuery( WorldPacket & recv_data )
|
|||||||
uint8 unk;
|
uint8 unk;
|
||||||
recv_data >> GoGuid >> unk;
|
recv_data >> GoGuid >> unk;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (uint32 GuildId = GetPlayer()->GetGuildId())
|
if (uint32 GuildId = GetPlayer()->GetGuildId())
|
||||||
@@ -929,7 +929,7 @@ void WorldSession::HandleGuildBankTabColon( WorldPacket & recv_data )
|
|||||||
uint8 TabId,unk1;
|
uint8 TabId,unk1;
|
||||||
recv_data >> GoGuid >> TabId >> unk1;
|
recv_data >> GoGuid >> TabId >> unk1;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 GuildId = GetPlayer()->GetGuildId();
|
uint32 GuildId = GetPlayer()->GetGuildId();
|
||||||
@@ -958,7 +958,7 @@ void WorldSession::HandleGuildBankDeposit( WorldPacket & recv_data )
|
|||||||
if (!money)
|
if (!money)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 GuildId = GetPlayer()->GetGuildId();
|
uint32 GuildId = GetPlayer()->GetGuildId();
|
||||||
@@ -1006,7 +1006,7 @@ void WorldSession::HandleGuildBankWithdraw( WorldPacket & recv_data )
|
|||||||
if (!money)
|
if (!money)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 GuildId = GetPlayer()->GetGuildId();
|
uint32 GuildId = GetPlayer()->GetGuildId();
|
||||||
@@ -1108,7 +1108,7 @@ void WorldSession::HandleGuildBankDepositItem( WorldPacket & recv_data )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 GuildId = GetPlayer()->GetGuildId();
|
uint32 GuildId = GetPlayer()->GetGuildId();
|
||||||
@@ -1563,7 +1563,7 @@ void WorldSession::HandleGuildBankBuyTab( WorldPacket & recv_data )
|
|||||||
recv_data >> GoGuid;
|
recv_data >> GoGuid;
|
||||||
recv_data >> TabId;
|
recv_data >> TabId;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 GuildId = GetPlayer()->GetGuildId();
|
uint32 GuildId = GetPlayer()->GetGuildId();
|
||||||
@@ -1620,7 +1620,7 @@ void WorldSession::HandleGuildBankModifyTab( WorldPacket & recv_data )
|
|||||||
if(IconIndex.empty())
|
if(IconIndex.empty())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(GoGuid, GAMEOBJECT_TYPE_GUILD_BANK))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint32 GuildId = GetPlayer()->GetGuildId();
|
uint32 GuildId = GetPlayer()->GetGuildId();
|
||||||
|
|||||||
@@ -518,7 +518,7 @@ void WorldSession::HandleSellItemOpcode( WorldPacket & recv_data )
|
|||||||
if(!itemguid)
|
if(!itemguid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, vendorguid,UNIT_NPC_FLAG_VENDOR);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
sLog.outDebug( "WORLD: HandleSellItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
||||||
@@ -623,7 +623,7 @@ void WorldSession::HandleBuybackItem(WorldPacket & recv_data)
|
|||||||
|
|
||||||
recv_data >> vendorguid >> slot;
|
recv_data >> vendorguid >> slot;
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, vendorguid,UNIT_NPC_FLAG_VENDOR);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
sLog.outDebug( "WORLD: HandleBuybackItem - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
||||||
@@ -710,7 +710,7 @@ void WorldSession::SendListInventory( uint64 vendorguid )
|
|||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: Sent SMSG_LIST_INVENTORY" );
|
sLog.outDebug( "WORLD: Sent SMSG_LIST_INVENTORY" );
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, vendorguid,UNIT_NPC_FLAG_VENDOR);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
sLog.outDebug( "WORLD: SendListInventory - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
||||||
@@ -837,7 +837,7 @@ void WorldSession::HandleBuyBankSlotOpcode(WorldPacket& recvPacket)
|
|||||||
recvPacket >> guid;
|
recvPacket >> guid;
|
||||||
|
|
||||||
// cheating protection
|
// cheating protection
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_BANKER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_BANKER);
|
||||||
if(!pCreature)
|
if(!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleBuyBankSlotOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
|
|||||||
+8
-8
@@ -55,7 +55,7 @@ void WorldSession::HandleSendMail(WorldPacket & recv_data )
|
|||||||
recv_data >> mailbox;
|
recv_data >> mailbox;
|
||||||
recv_data >> receiver;
|
recv_data >> receiver;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// recheck
|
// recheck
|
||||||
@@ -281,7 +281,7 @@ void WorldSession::HandleMarkAsRead(WorldPacket & recv_data )
|
|||||||
uint32 mailId;
|
uint32 mailId;
|
||||||
recv_data >> mailbox;
|
recv_data >> mailbox;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
recv_data >> mailId;
|
recv_data >> mailId;
|
||||||
@@ -308,7 +308,7 @@ void WorldSession::HandleMailDelete(WorldPacket & recv_data )
|
|||||||
recv_data >> mailbox;
|
recv_data >> mailbox;
|
||||||
recv_data >> mailId;
|
recv_data >> mailId;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pl = _player;
|
Player* pl = _player;
|
||||||
@@ -327,7 +327,7 @@ void WorldSession::HandleReturnToSender(WorldPacket & recv_data )
|
|||||||
uint32 mailId;
|
uint32 mailId;
|
||||||
recv_data >> mailbox;
|
recv_data >> mailbox;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
recv_data >> mailId;
|
recv_data >> mailId;
|
||||||
@@ -435,7 +435,7 @@ void WorldSession::HandleTakeItem(WorldPacket & recv_data )
|
|||||||
uint32 itemId;
|
uint32 itemId;
|
||||||
recv_data >> mailbox;
|
recv_data >> mailbox;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
recv_data >> mailId;
|
recv_data >> mailId;
|
||||||
@@ -530,7 +530,7 @@ void WorldSession::HandleTakeMoney(WorldPacket & recv_data )
|
|||||||
recv_data >> mailbox;
|
recv_data >> mailbox;
|
||||||
recv_data >> mailId;
|
recv_data >> mailId;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player *pl = _player;
|
Player *pl = _player;
|
||||||
@@ -564,7 +564,7 @@ void WorldSession::HandleGetMail(WorldPacket & recv_data )
|
|||||||
uint64 mailbox;
|
uint64 mailbox;
|
||||||
recv_data >> mailbox;
|
recv_data >> mailbox;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player* pl = _player;
|
Player* pl = _player;
|
||||||
@@ -701,7 +701,7 @@ void WorldSession::HandleMailCreateTextItem(WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> mailbox >> mailId;
|
recv_data >> mailbox >> mailId;
|
||||||
|
|
||||||
if (!objmgr.IsGameObjectOfTypeInRange(_player, mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
if (!GetPlayer()->GetGameObjectIfCanInteractWith(mailbox, GAMEOBJECT_TYPE_MAILBOX))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Player *pl = _player;
|
Player *pl = _player;
|
||||||
|
|||||||
+14
-14
@@ -45,7 +45,7 @@ void WorldSession::HandleTabardVendorActivateOpcode( WorldPacket & recv_data )
|
|||||||
uint64 guid;
|
uint64 guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_TABARDDESIGNER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TABARDDESIGNER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleTabardVendorActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -76,7 +76,7 @@ void WorldSession::HandleBankerActivateOpcode( WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_BANKER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_BANKER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleBankerActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -117,7 +117,7 @@ void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
|
|||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: SendTrainerList" );
|
sLog.outDebug( "WORLD: SendTrainerList" );
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_TRAINER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TRAINER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: SendTrainerList - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -203,7 +203,7 @@ void WorldSession::HandleTrainerBuySpellOpcode( WorldPacket & recv_data )
|
|||||||
recv_data >> guid >> spellId;
|
recv_data >> guid >> spellId;
|
||||||
sLog.outDebug( "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u",uint32(GUID_LOPART(guid)), spellId );
|
sLog.outDebug( "WORLD: Received CMSG_TRAINER_BUY_SPELL NpcGUID=%u, learn spell id is: %u",uint32(GUID_LOPART(guid)), spellId );
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_TRAINER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_TRAINER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleTrainerBuySpellOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -269,7 +269,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
|
|||||||
uint64 guid;
|
uint64 guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_NONE);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleGossipHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -328,7 +328,7 @@ void WorldSession::HandleGossipHelloOpcode( WorldPacket & recv_data )
|
|||||||
sLog.outDebug("string read: %s", code.c_str());
|
sLog.outDebug("string read: %s", code.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_NONE);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleGossipSelectOptionOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -361,7 +361,7 @@ void WorldSession::HandleSpiritHealerActivateOpcode( WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_SPIRITHEALER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_SPIRITHEALER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleSpiritHealerActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -422,7 +422,7 @@ void WorldSession::HandleBinderActivateOpcode( WorldPacket & recv_data )
|
|||||||
if(!GetPlayer()->isAlive())
|
if(!GetPlayer()->isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, npcGUID,UNIT_NPC_FLAG_INNKEEPER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID,UNIT_NPC_FLAG_INNKEEPER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
sLog.outDebug( "WORLD: HandleBinderActivateOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||||
@@ -490,7 +490,7 @@ void WorldSession::HandleListStabledPetsOpcode( WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> npcGUID;
|
recv_data >> npcGUID;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleListStabledPetsOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
sLog.outDebug( "WORLD: HandleListStabledPetsOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||||
@@ -573,7 +573,7 @@ void WorldSession::HandleStablePet( WorldPacket & recv_data )
|
|||||||
if(!GetPlayer()->isAlive())
|
if(!GetPlayer()->isAlive())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleStablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
sLog.outDebug( "WORLD: HandleStablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||||
@@ -640,7 +640,7 @@ void WorldSession::HandleUnstablePet( WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> npcGUID >> petnumber;
|
recv_data >> npcGUID >> petnumber;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleUnstablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
sLog.outDebug( "WORLD: HandleUnstablePet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||||
@@ -699,7 +699,7 @@ void WorldSession::HandleBuyStableSlot( WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> npcGUID;
|
recv_data >> npcGUID;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleBuyStableSlot - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
sLog.outDebug( "WORLD: HandleBuyStableSlot - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||||
@@ -745,7 +745,7 @@ void WorldSession::HandleStableSwapPet( WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> npcGUID >> pet_number;
|
recv_data >> npcGUID >> pet_number;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_STABLEMASTER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleStableSwapPet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
sLog.outDebug( "WORLD: HandleStableSwapPet - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||||
@@ -802,7 +802,7 @@ void WorldSession::HandleRepairItemOpcode( WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> npcGUID >> itemGUID >> guildBank;
|
recv_data >> npcGUID >> itemGUID >> guildBank;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, npcGUID, UNIT_NPC_FLAG_REPAIR);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(npcGUID, UNIT_NPC_FLAG_REPAIR);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
sLog.outDebug( "WORLD: HandleRepairItemOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(npcGUID)) );
|
||||||
|
|||||||
@@ -48,52 +48,6 @@ INSTANTIATE_CLASS_MUTEX(ObjectAccessor, ZThread::FastMutex);
|
|||||||
ObjectAccessor::ObjectAccessor() {}
|
ObjectAccessor::ObjectAccessor() {}
|
||||||
ObjectAccessor::~ObjectAccessor() {}
|
ObjectAccessor::~ObjectAccessor() {}
|
||||||
|
|
||||||
Creature*
|
|
||||||
ObjectAccessor::GetNPCIfCanInteractWith(Player const &player, uint64 guid, uint32 npcflagmask)
|
|
||||||
{
|
|
||||||
// unit checks
|
|
||||||
if (!guid)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// exist
|
|
||||||
Creature *unit = GetCreature(player, guid);
|
|
||||||
if (!unit)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// player check
|
|
||||||
if(!player.CanInteractWithNPCs(!unit->isSpiritService()))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// appropriate npc type
|
|
||||||
if(npcflagmask && !unit->HasFlag( UNIT_NPC_FLAGS, npcflagmask ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// alive or spirit healer
|
|
||||||
if(!unit->isAlive() && (!unit->isSpiritService() || player.isAlive() ))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// not allow interaction under control
|
|
||||||
if(unit->GetCharmerOrOwnerGUID())
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// not enemy
|
|
||||||
if( unit->IsHostileTo(&player))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// not unfriendly
|
|
||||||
if(FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(unit->getFaction()))
|
|
||||||
if(factionTemplate->faction)
|
|
||||||
if(FactionEntry const* faction = sFactionStore.LookupEntry(factionTemplate->faction))
|
|
||||||
if(faction->reputationListID >= 0 && player.GetReputationMgr().GetRank(faction) <= REP_UNFRIENDLY)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
// not too far
|
|
||||||
if(!unit->IsWithinDistInMap(&player,INTERACTION_DISTANCE))
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
return unit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Creature*
|
Creature*
|
||||||
ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid)
|
ObjectAccessor::GetCreatureOrPetOrVehicle(WorldObject const &u, uint64 guid)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ class TRINITY_DLL_DECL ObjectAccessor : public Trinity::Singleton<ObjectAccessor
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Object* GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask);
|
static Object* GetObjectByTypeMask(WorldObject const &, uint64, uint32 typemask);
|
||||||
static Creature* GetNPCIfCanInteractWith(Player const &player, uint64 guid, uint32 npcflagmask);
|
|
||||||
static Creature* GetCreature(WorldObject const &, uint64);
|
static Creature* GetCreature(WorldObject const &, uint64);
|
||||||
static Creature* GetCreatureOrPetOrVehicle(WorldObject const &, uint64);
|
static Creature* GetCreatureOrPetOrVehicle(WorldObject const &, uint64);
|
||||||
static Unit* GetUnit(WorldObject const &, uint64);
|
static Unit* GetUnit(WorldObject const &, uint64);
|
||||||
|
|||||||
@@ -4364,23 +4364,6 @@ void ObjectMgr::LoadInstanceTemplate()
|
|||||||
sLog.outString();
|
sLog.outString();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::IsGameObjectOfTypeInRange(Player *player, uint64 guid, GameobjectTypes type) const
|
|
||||||
{
|
|
||||||
if(GameObject *go = ObjectAccessor::GetGameObject(*player, guid))
|
|
||||||
{
|
|
||||||
if(go->GetGoType() == type)
|
|
||||||
{
|
|
||||||
// TODO: find out how the client calculates the maximal usage distance to spellless working
|
|
||||||
// gameobjects like guildbanks and mailboxes - 10.0 is a just an abitrary choosen number
|
|
||||||
if (go->IsWithinDistInMap(player, 10.0f))
|
|
||||||
return true;
|
|
||||||
sLog.outError("IsGameObjectOfTypeInRange: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name,
|
|
||||||
go->GetGUIDLow(), player->GetName(), player->GetGUIDLow(), go->GetDistance(player));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
GossipText const *ObjectMgr::GetGossipText(uint32 Text_ID) const
|
GossipText const *ObjectMgr::GetGossipText(uint32 Text_ID) const
|
||||||
{
|
{
|
||||||
GossipTextMap::const_iterator itr = mGossipText.find(Text_ID);
|
GossipTextMap::const_iterator itr = mGossipText.find(Text_ID);
|
||||||
|
|||||||
@@ -437,8 +437,6 @@ class ObjectMgr
|
|||||||
return mGameObjectForQuestSet.find(entry) != mGameObjectForQuestSet.end();
|
return mGameObjectForQuestSet.find(entry) != mGameObjectForQuestSet.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IsGameObjectOfTypeInRange(Player *player, uint64 guid, GameobjectTypes type) const;
|
|
||||||
|
|
||||||
GossipText const* GetGossipText(uint32 Text_ID) const;
|
GossipText const* GetGossipText(uint32 Text_ID) const;
|
||||||
|
|
||||||
WorldSafeLocsEntry const *GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team);
|
WorldSafeLocsEntry const *GetClosestGraveYard(float x, float y, float z, uint32 MapId, uint32 team);
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ void WorldSession::HandlePetitionBuyOpcode(WorldPacket & recv_data)
|
|||||||
sLog.outDebug("Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
|
sLog.outDebug("Petitioner with GUID %u tried sell petition: name %s", GUID_LOPART(guidNPC), name.c_str());
|
||||||
|
|
||||||
// prevent cheating
|
// prevent cheating
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guidNPC,UNIT_NPC_FLAG_PETITIONER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guidNPC,UNIT_NPC_FLAG_PETITIONER);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug("WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC));
|
sLog.outDebug("WORLD: HandlePetitionBuyOpcode - Unit (GUID: %u) not found or you can't interact with him.", GUID_LOPART(guidNPC));
|
||||||
@@ -906,7 +906,7 @@ void WorldSession::HandlePetitionShowListOpcode(WorldPacket & recv_data)
|
|||||||
|
|
||||||
void WorldSession::SendPetitionShowList(uint64 guid)
|
void WorldSession::SendPetitionShowList(uint64 guid)
|
||||||
{
|
{
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_PETITIONER);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_PETITIONER);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug("WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
sLog.outDebug("WORLD: HandlePetitionShowListOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)));
|
||||||
|
|||||||
+83
-1
@@ -2011,6 +2011,88 @@ bool Player::CanInteractWithNPCs(bool alive) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Creature*
|
||||||
|
Player::GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask)
|
||||||
|
{
|
||||||
|
// unit checks
|
||||||
|
if (!guid)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
if(!IsInWorld())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// exist
|
||||||
|
Creature *unit = ObjectAccessor::GetCreature(*this,guid);
|
||||||
|
if (!unit)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// player check
|
||||||
|
if(!CanInteractWithNPCs(!unit->isSpiritService()))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// appropriate npc type
|
||||||
|
if(npcflagmask && !unit->HasFlag( UNIT_NPC_FLAGS, npcflagmask ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// alive or spirit healer
|
||||||
|
if(!unit->isAlive() && (!unit->isSpiritService() || isAlive() ))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// not allow interaction under control
|
||||||
|
if(unit->GetCharmerOrOwnerGUID())
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// not enemy
|
||||||
|
if( unit->IsHostileTo(this))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// not unfriendly
|
||||||
|
if(FactionTemplateEntry const* factionTemplate = sFactionTemplateStore.LookupEntry(unit->getFaction()))
|
||||||
|
if(factionTemplate->faction)
|
||||||
|
if(FactionEntry const* faction = sFactionStore.LookupEntry(factionTemplate->faction))
|
||||||
|
if(faction->reputationListID >= 0 && GetReputationMgr().GetRank(faction) <= REP_UNFRIENDLY)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
// not too far
|
||||||
|
if(!unit->IsWithinDistInMap(this,INTERACTION_DISTANCE))
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return unit;
|
||||||
|
}
|
||||||
|
|
||||||
|
GameObject* Player::GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const
|
||||||
|
{
|
||||||
|
if(GameObject *go = ObjectAccessor::GetGameObject(*this,guid))
|
||||||
|
{
|
||||||
|
if(go->GetGoType() == type)
|
||||||
|
{
|
||||||
|
float maxdist;
|
||||||
|
switch(type)
|
||||||
|
{
|
||||||
|
// TODO: find out how the client calculates the maximal usage distance to spellless working
|
||||||
|
// gameobjects like guildbanks and mailboxes - 10.0 is a just an abitrary choosen number
|
||||||
|
case GAMEOBJECT_TYPE_GUILD_BANK:
|
||||||
|
case GAMEOBJECT_TYPE_MAILBOX:
|
||||||
|
maxdist = 10.0f;
|
||||||
|
break;
|
||||||
|
case GAMEOBJECT_TYPE_FISHINGHOLE:
|
||||||
|
maxdist = 20.0f+CONTACT_DISTANCE; // max spell range
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
maxdist = INTERACTION_DISTANCE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (go->IsWithinDistInMap(this, maxdist))
|
||||||
|
return go;
|
||||||
|
|
||||||
|
sLog.outError("IsGameObjectOfTypeInRange: GameObject '%s' [GUID: %u] is too far away from player %s [GUID: %u] to be used by him (distance=%f, maximal 10 is allowed)", go->GetGOInfo()->name,
|
||||||
|
go->GetGUIDLow(), GetName(), GetGUIDLow(), go->GetDistance(this));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bool Player::IsUnderWater() const
|
bool Player::IsUnderWater() const
|
||||||
{
|
{
|
||||||
return IsInWater() &&
|
return IsInWater() &&
|
||||||
@@ -17260,7 +17342,7 @@ bool Player::BuyItemFromVendor(uint64 vendorguid, uint32 item, uint8 count, uint
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*this, vendorguid,UNIT_NPC_FLAG_VENDOR);
|
Creature *pCreature = GetNPCIfCanInteractWith(vendorguid,UNIT_NPC_FLAG_VENDOR);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
sLog.outDebug( "WORLD: BuyItemFromVendor - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(vendorguid)) );
|
||||||
|
|||||||
@@ -860,7 +860,9 @@ class TRINITY_DLL_SPEC Player : public Unit
|
|||||||
void SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg = 0);
|
void SendTransferAborted(uint32 mapid, uint8 reason, uint8 arg = 0);
|
||||||
void SendInstanceResetWarning(uint32 mapid, uint32 time);
|
void SendInstanceResetWarning(uint32 mapid, uint32 time);
|
||||||
|
|
||||||
|
Creature* GetNPCIfCanInteractWith(uint64 guid, uint32 npcflagmask);
|
||||||
bool CanInteractWithNPCs(bool alive = true) const;
|
bool CanInteractWithNPCs(bool alive = true) const;
|
||||||
|
GameObject* GetGameObjectIfCanInteractWith(uint64 guid, GameobjectTypes type) const;
|
||||||
|
|
||||||
bool ToggleAFK();
|
bool ToggleAFK();
|
||||||
bool ToggleDND();
|
bool ToggleDND();
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ void WorldSession::HandleQuestgiverHelloOpcode( WorldPacket & recv_data )
|
|||||||
|
|
||||||
sLog.outDebug ("WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
|
sLog.outDebug ("WORLD: Received CMSG_QUESTGIVER_HELLO npc = %u", GUID_LOPART(guid));
|
||||||
|
|
||||||
Creature *pCreature = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_NONE);
|
Creature *pCreature = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_NONE);
|
||||||
if (!pCreature)
|
if (!pCreature)
|
||||||
{
|
{
|
||||||
sLog.outDebug ("WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.",
|
sLog.outDebug ("WORLD: HandleQuestgiverHelloOpcode - Unit (GUID: %u) not found or you can't interact with him.",
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ void WorldSession::HandleTalentWipeOpcode( WorldPacket & recv_data )
|
|||||||
uint64 guid;
|
uint64 guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid,UNIT_NPC_FLAG_TRAINER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid,UNIT_NPC_FLAG_TRAINER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleTalentWipeOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleTalentWipeOpcode - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ void WorldSession::HandleTaxiQueryAvailableNodes( WorldPacket & recv_data )
|
|||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
// cheating checks
|
// cheating checks
|
||||||
Creature *unit = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_FLIGHTMASTER);
|
Creature *unit = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
|
||||||
if (!unit)
|
if (!unit)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleTaxiQueryAvailableNodes - Unit (GUID: %u) not found or you can't interact with him.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -167,7 +167,7 @@ void WorldSession::HandleActivateTaxiFarOpcode ( WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> guid >> _totalcost >> node_count;
|
recv_data >> guid >> _totalcost >> node_count;
|
||||||
|
|
||||||
Creature *npc = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_FLIGHTMASTER);
|
Creature *npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
|
||||||
if (!npc)
|
if (!npc)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleActivateTaxiFarOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleActivateTaxiFarOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)) );
|
||||||
@@ -268,7 +268,7 @@ void WorldSession::HandleActivateTaxiOpcode( WorldPacket & recv_data )
|
|||||||
|
|
||||||
recv_data >> guid >> nodes[0] >> nodes[1];
|
recv_data >> guid >> nodes[0] >> nodes[1];
|
||||||
sLog.outDebug( "WORLD: Received CMSG_ACTIVATETAXI from %d to %d" ,nodes[0],nodes[1]);
|
sLog.outDebug( "WORLD: Received CMSG_ACTIVATETAXI from %d to %d" ,nodes[0],nodes[1]);
|
||||||
Creature *npc = ObjectAccessor::GetNPCIfCanInteractWith(*_player, guid, UNIT_NPC_FLAG_FLIGHTMASTER);
|
Creature *npc = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_FLIGHTMASTER);
|
||||||
if (!npc)
|
if (!npc)
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)) );
|
sLog.outDebug( "WORLD: HandleActivateTaxiOpcode - Unit (GUID: %u) not found or you can't interact with it.", uint32(GUID_LOPART(guid)) );
|
||||||
|
|||||||
Reference in New Issue
Block a user