mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
[10769] Fixed trainer flags uses for pet trainers.
* Not exclude trainer flags for client for pet trainers. * Not report error for pet trianers empty spell lists. TODO: * Add check for redundent trainer spell data for pet trainers at server startup * Need hide train gossip option for pet trainers, but currently without it gossip window not open for pet trainer by some unknown reason.
This commit is contained in:
parent
24d410701f
commit
ce09cb70a2
3 changed files with 38 additions and 18 deletions
|
|
@ -725,24 +725,29 @@ bool Creature::Create(uint32 guidlow, Map *map, uint32 phaseMask, uint32 Entry,
|
||||||
|
|
||||||
bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const
|
bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const
|
||||||
{
|
{
|
||||||
if(!isTrainer())
|
if (!isTrainer())
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
TrainerSpellData const* trainer_spells = GetTrainerSpells();
|
// pet trainers not have spells in fact now
|
||||||
|
if (GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS)
|
||||||
if(!trainer_spells || trainer_spells->spellList.empty())
|
|
||||||
{
|
{
|
||||||
sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
|
TrainerSpellData const* trainer_spells = GetTrainerSpells();
|
||||||
GetGUIDLow(),GetEntry());
|
|
||||||
return false;
|
// for not pet trainer expected not empty trainer list always
|
||||||
|
if (!trainer_spells || trainer_spells->spellList.empty())
|
||||||
|
{
|
||||||
|
sLog.outErrorDb("Creature %u (Entry: %u) have UNIT_NPC_FLAG_TRAINER but have empty trainer spell list.",
|
||||||
|
GetGUIDLow(),GetEntry());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(GetCreatureInfo()->trainer_type)
|
switch(GetCreatureInfo()->trainer_type)
|
||||||
{
|
{
|
||||||
case TRAINER_TYPE_CLASS:
|
case TRAINER_TYPE_CLASS:
|
||||||
if(pPlayer->getClass() != GetCreatureInfo()->trainer_class)
|
if (pPlayer->getClass() != GetCreatureInfo()->trainer_class)
|
||||||
{
|
{
|
||||||
if(msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
pPlayer->PlayerTalkClass->ClearMenus();
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
switch(GetCreatureInfo()->trainer_class)
|
switch(GetCreatureInfo()->trainer_class)
|
||||||
|
|
@ -762,17 +767,20 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TRAINER_TYPE_PETS:
|
case TRAINER_TYPE_PETS:
|
||||||
if(pPlayer->getClass() != CLASS_HUNTER)
|
if (pPlayer->getClass() != CLASS_HUNTER)
|
||||||
{
|
{
|
||||||
pPlayer->PlayerTalkClass->ClearMenus();
|
if (msg)
|
||||||
pPlayer->PlayerTalkClass->SendGossipMenu(3620, GetGUID());
|
{
|
||||||
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
|
pPlayer->PlayerTalkClass->SendGossipMenu(3620, GetGUID());
|
||||||
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TRAINER_TYPE_MOUNTS:
|
case TRAINER_TYPE_MOUNTS:
|
||||||
if(GetCreatureInfo()->trainer_race && pPlayer->getRace() != GetCreatureInfo()->trainer_race)
|
if (GetCreatureInfo()->trainer_race && pPlayer->getRace() != GetCreatureInfo()->trainer_race)
|
||||||
{
|
{
|
||||||
if(msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
pPlayer->PlayerTalkClass->ClearMenus();
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
switch(GetCreatureInfo()->trainer_class)
|
switch(GetCreatureInfo()->trainer_class)
|
||||||
|
|
@ -793,9 +801,9 @@ bool Creature::IsTrainerOf(Player* pPlayer, bool msg) const
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case TRAINER_TYPE_TRADESKILLS:
|
case TRAINER_TYPE_TRADESKILLS:
|
||||||
if(GetCreatureInfo()->trainer_spell && !pPlayer->HasSpell(GetCreatureInfo()->trainer_spell))
|
if (GetCreatureInfo()->trainer_spell && !pPlayer->HasSpell(GetCreatureInfo()->trainer_spell))
|
||||||
{
|
{
|
||||||
if(msg)
|
if (msg)
|
||||||
{
|
{
|
||||||
pPlayer->PlayerTalkClass->ClearMenus();
|
pPlayer->PlayerTalkClass->ClearMenus();
|
||||||
pPlayer->PlayerTalkClass->SendGossipMenu(11031, GetGUID());
|
pPlayer->PlayerTalkClass->SendGossipMenu(11031, GetGUID());
|
||||||
|
|
|
||||||
|
|
@ -12764,6 +12764,11 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GOSSIP_OPTION_TRAINER:
|
case GOSSIP_OPTION_TRAINER:
|
||||||
|
// pet trainers not have spells in fact now
|
||||||
|
/* FIXME: gossip menu with single unlearn pet talents option not show by some reason
|
||||||
|
if (pCreature->GetCreatureInfo()->trainer_type == TRAINER_TYPE_PETS)
|
||||||
|
hasMenuItem = false;
|
||||||
|
else */
|
||||||
if (!pCreature->IsTrainerOf(this, false))
|
if (!pCreature->IsTrainerOf(this, false))
|
||||||
hasMenuItem = false;
|
hasMenuItem = false;
|
||||||
break;
|
break;
|
||||||
|
|
@ -12772,7 +12777,14 @@ void Player::PrepareGossipMenu(WorldObject *pSource, uint32 menuId)
|
||||||
hasMenuItem = false;
|
hasMenuItem = false;
|
||||||
break;
|
break;
|
||||||
case GOSSIP_OPTION_UNLEARNPETSKILLS:
|
case GOSSIP_OPTION_UNLEARNPETSKILLS:
|
||||||
if (!GetPet() || GetPet()->getPetType() != HUNTER_PET || GetPet()->m_spells.size() <= 1 || pCreature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || pCreature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
|
if (pCreature->GetCreatureInfo()->trainer_type != TRAINER_TYPE_PETS || pCreature->GetCreatureInfo()->trainer_class != CLASS_HUNTER)
|
||||||
|
hasMenuItem = false;
|
||||||
|
else if (Pet * pet = GetPet())
|
||||||
|
{
|
||||||
|
if (pet->getPetType() != HUNTER_PET || pet->m_spells.size() <= 1)
|
||||||
|
hasMenuItem = false;
|
||||||
|
}
|
||||||
|
else
|
||||||
hasMenuItem = false;
|
hasMenuItem = false;
|
||||||
break;
|
break;
|
||||||
case GOSSIP_OPTION_TAXIVENDOR:
|
case GOSSIP_OPTION_TAXIVENDOR:
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "10768"
|
#define REVISION_NR "10769"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue