fix(Core/Creature): Allow scripts to modify a creature's Gossip Menu ID (#24442)

This commit is contained in:
Gultask
2026-01-19 02:15:14 -03:00
committed by GitHub
parent 8b77562d8a
commit 03f5d038ac
9 changed files with 30 additions and 6 deletions

View File

@@ -3296,6 +3296,19 @@ void SmartScript::ProcessAction(SmartScriptHolder& e, Unit* unit, uint32 var0, u
target->ToUnit()->SetAnimTier(AnimTier(e.action.animTier.animTier));
break;
}
case SMART_ACTION_SET_GOSSIP_MENU:
{
for (WorldObject* target : targets)
{
if (Creature* creature = target->ToCreature())
{
creature->SetGossipMenuId(e.action.setGossipMenu.gossipMenuId);
LOG_DEBUG("sql.sql", "SmartScript::ProcessAction: SMART_ACTION_SET_GOSSIP_MENU: Creature {} set gossip menu to {}",
creature->GetGUID().ToString(), e.action.setGossipMenu.gossipMenuId);
}
}
break;
}
default:
LOG_ERROR("sql.sql", "SmartScript::ProcessAction: Entry {} SourceType {}, Event {}, Unhandled Action type {}", e.entryOrGuid, e.GetScriptType(), e.event_id, e.GetActionType());
break;

View File

@@ -885,6 +885,7 @@ bool SmartAIMgr::CheckUnusedActionParams(SmartScriptHolder const& e)
case SMART_ACTION_WORLD_SCRIPT: return sizeof(SmartAction::worldStateScript);
case SMART_ACTION_DISABLE_REWARD: return sizeof(SmartAction::reward);
case SMART_ACTION_SET_ANIM_TIER: return sizeof(SmartAction::animTier);
case SMART_ACTION_SET_GOSSIP_MENU: return sizeof(SmartAction::setGossipMenu);
case SMART_ACTION_DISMOUNT: return NO_PARAMS;
default:
LOG_WARN("sql.sql", "SmartAIMgr: entryorguid {} source_type {} id {} action_type {} is using an action with no unused params specified in SmartAIMgr::CheckUnusedActionParams(), please report this.",
@@ -2040,6 +2041,7 @@ bool SmartAIMgr::IsEventValid(SmartScriptHolder& e)
case SMART_ACTION_MOVEMENT_PAUSE:
case SMART_ACTION_MOVEMENT_RESUME:
case SMART_ACTION_WORLD_SCRIPT:
case SMART_ACTION_SET_GOSSIP_MENU:
break;
default:
LOG_ERROR("sql.sql", "SmartAIMgr: Not handled action_type({}), event_type({}), Entry {} SourceType {} Event {}, skipped.", e.GetActionType(), e.GetEventType(), e.entryOrGuid, e.GetScriptType(), e.event_id);

View File

@@ -724,8 +724,9 @@ enum SMART_ACTION
SMART_ACTION_WORLD_SCRIPT = 237, // eventId, param
SMART_ACTION_DISABLE_REWARD = 238, // reputation 0/1, loot 0/1
SMART_ACTION_SET_ANIM_TIER = 239, // animtier
SMART_ACTION_SET_GOSSIP_MENU = 240, // gossipMenuId
SMART_ACTION_AC_END = 240, // placeholder
SMART_ACTION_AC_END = 241, // placeholder
};
enum class SmartActionSummonCreatureFlags
@@ -1510,6 +1511,11 @@ struct SmartAction
{
uint32 animTier;
} animTier;
struct
{
uint32 gossipMenuId;
} setGossipMenu;
};
};