[8741] Remove trainer npcflags for player that can not train from npc.

Tracking of class and profession trainer should then work as expected client side, but database still need to apply flag values based on trainer function.

Signed-off-by: NoFantasy <nofantasy@nf.no>
This commit is contained in:
NoFantasy 2009-10-27 01:26:15 +01:00
parent 10a659a29a
commit 7b6f4accd1
2 changed files with 12 additions and 3 deletions

View file

@ -633,8 +633,17 @@ void Object::BuildValuesUpdate(uint8 updatetype, ByteBuffer * data, UpdateMask *
// remove custom flag before sending
uint32 appendValue = m_uint32Values[ index ] & ~UNIT_NPC_FLAG_GUARD;
if (GetTypeId() == TYPEID_UNIT && !target->canSeeSpellClickOn((Creature*)this))
appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
if (GetTypeId() == TYPEID_UNIT)
{
if (!target->canSeeSpellClickOn((Creature*)this))
appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
if (appendValue & UNIT_NPC_FLAG_TRAINER)
{
if (!((Creature*)this)->isCanTrainingOf(target, false))
appendValue &= ~(UNIT_NPC_FLAG_TRAINER | UNIT_NPC_FLAG_TRAINER_CLASS | UNIT_NPC_FLAG_TRAINER_PROFESSION);
}
}
*data << uint32(appendValue);
}