fix(Core/DB): Brewspewer hardcoded conditions (#6301)

This commit is contained in:
Cláudio Costa
2021-06-18 16:04:41 +01:00
committed by GitHub
parent e7e0ce1ea4
commit 07861d0548
6 changed files with 46 additions and 42 deletions

View File

@@ -1469,6 +1469,11 @@ bool Creature::CreateFromProto(ObjectGuid::LowType guidlow, uint32 Entry, uint32
return true;
}
bool Creature::isVendorWithIconSpeak() const
{
return m_creatureInfo->IconName == "Speak" && m_creatureData->npcflag & UNIT_NPC_FLAG_VENDOR;
}
bool Creature::LoadCreatureFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, bool gridLoad, bool allowDuplicate /*= false*/)
{
if (!allowDuplicate)

View File

@@ -45,6 +45,8 @@ public:
void DisappearAndDie();
[[nodiscard]] bool isVendorWithIconSpeak() const;
bool Create(ObjectGuid::LowType guidlow, Map* map, uint32 phaseMask, uint32 Entry, uint32 vehId, float x, float y, float z, float ang, const CreatureData* data = nullptr);
bool LoadCreaturesAddon(bool reload = false);
void SelectLevel(bool changelevel = true);

View File

@@ -15186,11 +15186,15 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
break;
case GOSSIP_OPTION_VENDOR:
{
VendorItemData const* vendorItems = itr->second.ActionMenuID ? sObjectMgr->GetNpcVendorItemList(itr->second.ActionMenuID) : creature->GetVendorItems();
if (!vendorItems || vendorItems->Empty())
if (!creature->isVendorWithIconSpeak())
{
LOG_ERROR("sql.sql", "Creature %s have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUID().ToString().c_str());
canTalk = false;
VendorItemData const* vendorItems = itr->second.ActionMenuID ? sObjectMgr->GetNpcVendorItemList(itr->second.ActionMenuID) : creature->GetVendorItems();
if (!vendorItems || vendorItems->Empty())
{
LOG_ERROR("sql.sql", "Creature %s have UNIT_NPC_FLAG_VENDOR but have empty trading item list.", creature->GetGUID().ToString().c_str());
canTalk = false;
}
break;
}
break;
}
@@ -15229,6 +15233,15 @@ void Player::PrepareGossipMenu(WorldObject* source, uint32 menuId /*= 0*/, bool
}
break;
case GOSSIP_OPTION_GOSSIP:
if (creature->isVendorWithIconSpeak())
{
VendorItemData const* vendorItems = creature->GetVendorItems();
if (!vendorItems || vendorItems->Empty())
{
canTalk = false;
}
}
break;
case GOSSIP_OPTION_SPIRITGUIDE:
case GOSSIP_OPTION_INNKEEPER:
case GOSSIP_OPTION_BANKER:

View File

@@ -20049,10 +20049,14 @@ void Unit::BuildValuesUpdate(uint8 updateType, ByteBuffer* data, Player* target)
if (creature)
{
if (sWorld->getIntConfig(CONFIG_INSTANT_TAXI) == 2 && appendValue & UNIT_NPC_FLAG_FLIGHTMASTER)
{
appendValue |= UNIT_NPC_FLAG_GOSSIP; // flight masters need NPC gossip flag to show instant flight toggle option
}
if (!target->CanSeeSpellClickOn(creature))
{
appendValue &= ~UNIT_NPC_FLAG_SPELLCLICK;
}
if (!creature->IsValidTrainerForPlayer(target, &appendValue))
{