feat(Core/Conditions): Add new Source Type Gossip Hello. (#25413)
Co-authored-by: sogladev <sogladev@gmail.com>
This commit is contained in:
@@ -974,7 +974,7 @@ bool ConditionMgr::IsObjectMeetToConditions(ConditionSourceInfo& sourceInfo, Con
|
||||
bool ConditionMgr::CanHaveSourceGroupSet(ConditionSourceType sourceType) const
|
||||
{
|
||||
return (sourceType == CONDITION_SOURCE_TYPE_CREATURE_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_DISENCHANT_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_FISHING_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_GAMEOBJECT_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_ITEM_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_MAIL_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_MILLING_LOOT_TEMPLATE ||
|
||||
sourceType == CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU || sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION || sourceType == CONDITION_SOURCE_TYPE_VEHICLE_SPELL ||
|
||||
sourceType == CONDITION_SOURCE_TYPE_PICKPOCKETING_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_PROSPECTING_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_REFERENCE_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_SKINNING_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_SPELL_LOOT_TEMPLATE || sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU || sourceType == CONDITION_SOURCE_TYPE_GOSSIP_MENU_OPTION || sourceType == CONDITION_SOURCE_TYPE_VEHICLE_SPELL || sourceType == CONDITION_SOURCE_TYPE_GOSSIP_HELLO ||
|
||||
sourceType == CONDITION_SOURCE_TYPE_SPELL_IMPLICIT_TARGET || sourceType == CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT || sourceType == CONDITION_SOURCE_TYPE_SMART_EVENT || sourceType == CONDITION_SOURCE_TYPE_NPC_VENDOR || sourceType == CONDITION_SOURCE_TYPE_PLAYER_LOOT_TEMPLATE);
|
||||
}
|
||||
|
||||
@@ -1808,9 +1808,15 @@ bool ConditionMgr::isSourceTypeValid(Condition* cond)
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case CONDITION_SOURCE_TYPE_UNUSED_20:
|
||||
LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_UNUSED_20 is not in use. SourceEntry = ({}), skipped", cond->SourceEntry);
|
||||
case CONDITION_SOURCE_TYPE_GOSSIP_HELLO:
|
||||
{
|
||||
if (!sObjectMgr->GetCreatureTemplate(cond->SourceEntry))
|
||||
{
|
||||
LOG_ERROR("sql.sql", "CONDITION_SOURCE_TYPE_GOSSIP_HELLO: creature entry {} in `condition` table does not exist in `creature_template`, ignoring.", cond->SourceEntry);
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case CONDITION_SOURCE_TYPE_VEHICLE_SPELL:
|
||||
case CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT:
|
||||
if (!sObjectMgr->GetCreatureTemplate(cond->SourceGroup))
|
||||
|
||||
@@ -142,7 +142,7 @@ enum ConditionSourceType
|
||||
CONDITION_SOURCE_TYPE_SPELL = 17,
|
||||
CONDITION_SOURCE_TYPE_SPELL_CLICK_EVENT = 18,
|
||||
CONDITION_SOURCE_TYPE_QUEST_AVAILABLE = 19,
|
||||
CONDITION_SOURCE_TYPE_UNUSED_20 = 20, // placeholder
|
||||
CONDITION_SOURCE_TYPE_GOSSIP_HELLO = 20,
|
||||
CONDITION_SOURCE_TYPE_VEHICLE_SPELL = 21,
|
||||
CONDITION_SOURCE_TYPE_SMART_EVENT = 22,
|
||||
CONDITION_SOURCE_TYPE_NPC_VENDOR = 23,
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
|
||||
#include "Battleground.h"
|
||||
#include "ConditionMgr.h"
|
||||
#include "BattlegroundMgr.h"
|
||||
#include "Creature.h"
|
||||
#include "DatabaseEnv.h"
|
||||
@@ -150,6 +151,11 @@ void WorldSession::HandleGossipHelloOpcode(WorldPacket& recvData)
|
||||
if (unit->GetNpcFlags() == UNIT_NPC_FLAG_NONE)
|
||||
return;
|
||||
|
||||
// Check GossipHello conditions - block gossip opening if conditions not met
|
||||
ConditionList gossipConditions = sConditionMgr->GetConditionsForNotGroupedEntry(CONDITION_SOURCE_TYPE_GOSSIP_HELLO, unit->GetEntry());
|
||||
if (!sConditionMgr->IsObjectMeetToConditions(_player, unit, gossipConditions))
|
||||
return;
|
||||
|
||||
// set faction visible if needed
|
||||
if (FactionTemplateEntry const* factionTemplateEntry = sFactionTemplateStore.LookupEntry(unit->GetFaction()))
|
||||
_player->GetReputationMgr().SetVisible(factionTemplateEntry);
|
||||
|
||||
Reference in New Issue
Block a user