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

@@ -0,0 +1,18 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1623327182605839200');
-- Only display his Menu options whenever the player has the quest in an incomplete state
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 15) AND (`SourceGroup` = 1802) AND (`SourceEntry` = 0) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 47) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 3909) AND (`ConditionValue2` = 8) AND (`ConditionValue3` = 0);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 1802, 0, 0, 0, 47, 0, 3909, 8, 0, 0, 0, 0, '', '');
DELETE FROM `conditions` WHERE (`SourceTypeOrReferenceId` = 15) AND (`SourceGroup` = 1802) AND (`SourceEntry` = 1) AND (`SourceId` = 0) AND (`ElseGroup` = 0) AND (`ConditionTypeOrReference` = 47) AND (`ConditionTarget` = 0) AND (`ConditionValue1` = 3909) AND (`ConditionValue2` = 8) AND (`ConditionValue3` = 0);
INSERT INTO `conditions` (`SourceTypeOrReferenceId`, `SourceGroup`, `SourceEntry`, `SourceId`, `ElseGroup`, `ConditionTypeOrReference`, `ConditionTarget`, `ConditionValue1`, `ConditionValue2`, `ConditionValue3`, `NegativeCondition`, `ErrorType`, `ErrorTextId`, `ScriptName`, `Comment`) VALUES
(15, 1802, 1, 0, 0, 47, 0, 3909, 8, 0, 0, 0, 0, '', '');
-- Brewspewer has a White ballon icon when you over him regardless of his vendor flags
UPDATE `creature_template` SET `IconName` = 'Speak' WHERE (`entry` = 7775);
-- Removing his script name
UPDATE `creature_template` SET `ScriptName` = '' WHERE (`entry` = 7775);
-- This NPC has his npc flags overriden
UPDATE `creature` SET `npcflag`='131' WHERE `guid`=50145;

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))
{

View File

@@ -19,43 +19,6 @@ EndScriptData */
#include "SpellScript.h"
#include "WorldSession.h"
/*######
## npc_gregan_brewspewer
######*/
#define GOSSIP_HELLO "Buy somethin', will ya?"
class npc_gregan_brewspewer : public CreatureScript
{
public:
npc_gregan_brewspewer() : CreatureScript("npc_gregan_brewspewer") { }
bool OnGossipSelect(Player* player, Creature* creature, uint32 /*sender*/, uint32 action) override
{
ClearGossipMenuFor(player);
if (action == GOSSIP_ACTION_INFO_DEF + 1)
{
AddGossipItemFor(player, GOSSIP_ICON_VENDOR, GOSSIP_TEXT_BROWSE_GOODS, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_TRADE);
SendGossipMenuFor(player, 2434, creature->GetGUID());
}
if (action == GOSSIP_ACTION_TRADE)
player->GetSession()->SendListInventory(creature->GetGUID());
return true;
}
bool OnGossipHello(Player* player, Creature* creature) override
{
if (creature->IsQuestGiver())
player->PrepareQuestMenu(creature->GetGUID());
if (creature->IsVendor() && player->GetQuestStatus(3909) == QUEST_STATUS_INCOMPLETE)
AddGossipItemFor(player, GOSSIP_ICON_CHAT, GOSSIP_HELLO, GOSSIP_SENDER_MAIN, GOSSIP_ACTION_INFO_DEF + 1);
SendGossipMenuFor(player, 2433, creature->GetGUID());
return true;
}
};
/*######
## npc_oox22fe
######*/
@@ -210,7 +173,6 @@ public:
void AddSC_feralas()
{
new npc_gregan_brewspewer();
new npc_oox22fe();
new spell_gordunni_trap();
}