mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 13:37:05 +00:00
[11563] Add support mailbox access for npc with CREATURE_TYPEFLAGS_SQUIRE
This commit is contained in:
parent
e0c92f50f4
commit
3c0ca51db3
3 changed files with 26 additions and 4 deletions
|
|
@ -51,11 +51,33 @@ bool WorldSession::CheckMailBox(ObjectGuid guid)
|
|||
}
|
||||
}
|
||||
// mailbox case
|
||||
else
|
||||
else if (guid.IsGameObject())
|
||||
{
|
||||
if (!GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX))
|
||||
{
|
||||
DEBUG_LOG("Mailbox %s not found or you can't interact with him.", guid.GetString().c_str());
|
||||
DEBUG_LOG("Mailbox %s not found or %s can't interact with him.", guid.GetString().c_str(), GetPlayer()->GetGuidStr().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// squire case
|
||||
else if (guid.IsAnyTypeCreature())
|
||||
{
|
||||
Creature* creature = GetPlayer()->GetNPCIfCanInteractWith(guid, UNIT_NPC_FLAG_NONE);
|
||||
if (!creature)
|
||||
{
|
||||
DEBUG_LOG("%s not found or %s can't interact with him.", creature->GetGuidStr().c_str(), GetPlayer()->GetGuidStr().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(creature->GetCreatureInfo()->type_flags & CREATURE_TYPEFLAGS_SQUIRE))
|
||||
{
|
||||
DEBUG_LOG("%s not have access to mailbox.", creature->GetGuidStr().c_str());
|
||||
return false;
|
||||
}
|
||||
|
||||
if (creature->GetOwnerGuid() != GetPlayer()->GetObjectGuid())
|
||||
{
|
||||
DEBUG_LOG("%s not owned by %s for access to mailbox.", creature->GetGuidStr().c_str(), GetPlayer()->GetGuidStr().c_str());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue