[11563] Add support mailbox access for npc with CREATURE_TYPEFLAGS_SQUIRE

This commit is contained in:
VladimirMangos 2011-05-30 02:07:26 +04:00
parent e0c92f50f4
commit 3c0ca51db3
3 changed files with 26 additions and 4 deletions

View file

@ -51,11 +51,33 @@ bool WorldSession::CheckMailBox(ObjectGuid guid)
} }
} }
// mailbox case // mailbox case
else else if (guid.IsGameObject())
{ {
if (!GetPlayer()->GetGameObjectIfCanInteractWith(guid, GAMEOBJECT_TYPE_MAILBOX)) 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; return false;
} }
} }

View file

@ -1994,7 +1994,7 @@ enum CreatureTypeFlags
CREATURE_TYPEFLAGS_UNK21 = 0x00100000, // no idea, but it used by client, may be related to rendering CREATURE_TYPEFLAGS_UNK21 = 0x00100000, // no idea, but it used by client, may be related to rendering
CREATURE_TYPEFLAGS_UNK22 = 0x00200000, // may be has something to do with animation (disable animation?) CREATURE_TYPEFLAGS_UNK22 = 0x00200000, // may be has something to do with animation (disable animation?)
CREATURE_TYPEFLAGS_UNK23 = 0x00400000, // this one probably controls some creature visual CREATURE_TYPEFLAGS_UNK23 = 0x00400000, // this one probably controls some creature visual
CREATURE_TYPEFLAGS_UNK24 = 0x00800000, // ? First seen in 3.2.2. Related to banner/backpack of creature/companion, used in CanInteract function by client CREATURE_TYPEFLAGS_SQUIRE = 0x00800000, // First seen in 3.2.2. Related to banner/backpack of creature/companion, used in CanInteract function by client
CREATURE_TYPEFLAGS_UNK25 = 0x01000000, // pet sounds related? CREATURE_TYPEFLAGS_UNK25 = 0x01000000, // pet sounds related?
CREATURE_TYPEFLAGS_UNK26 = 0x02000000, // this one probably controls some creature visual CREATURE_TYPEFLAGS_UNK26 = 0x02000000, // this one probably controls some creature visual
CREATURE_TYPEFLAGS_UNK27 = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance CREATURE_TYPEFLAGS_UNK27 = 0x04000000, // creature has no type, or forces creature to be considered as in party, may be related to creature assistance

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "11562" #define REVISION_NR "11563"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__